2 * Self-test demonstration program
4 * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine
6 * Copyright (C) 2009 Paul Bakker <polarssl_maintainer at polarssl dot org>
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * * Neither the names of PolarSSL or XySSL nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #ifndef _CRT_SECURE_NO_DEPRECATE
37 #define _CRT_SECURE_NO_DEPRECATE 1
43 #include "tropicssl/config.h"
45 #include "tropicssl/md2.h"
46 #include "tropicssl/md4.h"
47 #include "tropicssl/md5.h"
48 #include "tropicssl/sha1.h"
49 #include "tropicssl/sha2.h"
50 #include "tropicssl/sha4.h"
51 #include "tropicssl/arc4.h"
52 #include "tropicssl/des.h"
53 #include "tropicssl/aes.h"
54 #include "tropicssl/base64.h"
55 #include "tropicssl/bignum.h"
56 #include "tropicssl/camellia.h"
57 #include "tropicssl/rsa.h"
58 #include "tropicssl/x509.h"
59 #include "tropicssl/xtea.h"
61 int main(int argc
, char *argv
[])
65 if (argc
== 2 && strcmp(argv
[1], "-quiet") == 0)
72 #if defined(TROPICSSL_MD2_C)
73 if ((ret
= md2_self_test(v
)) != 0)
77 #if defined(TROPICSSL_MD4_C)
78 if ((ret
= md4_self_test(v
)) != 0)
82 #if defined(TROPICSSL_MD5_C)
83 if ((ret
= md5_self_test(v
)) != 0)
87 #if defined(TROPICSSL_SHA1_C)
88 if ((ret
= sha1_self_test(v
)) != 0)
92 #if defined(TROPICSSL_SHA2_C)
93 if ((ret
= sha2_self_test(v
)) != 0)
97 #if defined(TROPICSSL_SHA4_C)
98 if ((ret
= sha4_self_test(v
)) != 0)
102 #if defined(TROPICSSL_ARC4_C)
103 if ((ret
= arc4_self_test(v
)) != 0)
107 #if defined(TROPICSSL_DES_C)
108 if ((ret
= des_self_test(v
)) != 0)
112 #if defined(TROPICSSL_AES_C)
113 if ((ret
= aes_self_test(v
)) != 0)
117 #if defined(TROPICSSL_BASE64_C)
118 if ((ret
= base64_self_test(v
)) != 0)
122 #if defined(TROPICSSL_BIGNUM_C)
123 if ((ret
= mpi_self_test(v
)) != 0)
127 #if defined(TROPICSSL_RSA_C)
128 if ((ret
= rsa_self_test(v
)) != 0)
132 #if defined(TROPICSSL_X509_C)
133 if ((ret
= x509_self_test(v
)) != 0)
137 #if defined(TROPICSSL_XTEA_C)
138 if ((ret
= xtea_self_test(v
)) != 0)
142 #if defined(TROPICSSL_CAMELLIA_C)
143 if ((ret
= camellia_self_test(v
)) != 0)
148 printf(" [ All tests passed ]\n\n");
150 printf(" Press Enter to exit this program.\n");