]> git.zerfleddert.de Git - proxmark3-svn/blob - client/emv/test/cryptotest.c
implement 'hf iclass snoop -j'
[proxmark3-svn] / client / emv / test / cryptotest.c
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2017 Merlok
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // Crypto algorithms testing
9 //-----------------------------------------------------------------------------
10
11 #include "cryptotest.h"
12 #include "util.h"
13 #include "ui.h"
14
15 #include "mbedtls/bignum.h"
16 #include "mbedtls/aes.h"
17 #include "mbedtls/cmac.h"
18 #include "mbedtls/des.h"
19 #include "mbedtls/ecp.h"
20 #include "mbedtls/rsa.h"
21 #include "mbedtls/sha1.h"
22 #include "mbedtls/md5.h"
23 #include "mbedtls/x509.h"
24 #include "mbedtls/base64.h"
25 #include "mbedtls/ctr_drbg.h"
26 #include "mbedtls/entropy.h"
27 #include "mbedtls/timing.h"
28
29 #include "crypto_test.h"
30 #include "sda_test.h"
31 #include "dda_test.h"
32 #include "cda_test.h"
33 #include "crypto/libpcrypto.h"
34 #include "emv/emv_roca.h"
35
36 int ExecuteCryptoTests(bool verbose) {
37 int res;
38 bool TestFail = false;
39
40 res = mbedtls_mpi_self_test(verbose);
41 if (res) TestFail = true;
42
43 res = mbedtls_aes_self_test(verbose);
44 if (res) TestFail = true;
45
46 res = mbedtls_des_self_test(verbose);
47 if (res) TestFail = true;
48
49 res = mbedtls_sha1_self_test(verbose);
50 if (res) TestFail = true;
51
52 res = mbedtls_md5_self_test(verbose);
53 if (res) TestFail = true;
54
55 res = mbedtls_rsa_self_test(verbose);
56 if (res) TestFail = true;
57
58 res = mbedtls_entropy_self_test(verbose);
59 if (res) TestFail = true;
60
61 res = mbedtls_timing_self_test(verbose);
62 if (res) TestFail = true;
63
64 res = mbedtls_ctr_drbg_self_test(verbose);
65 if (res) TestFail = true;
66
67 res = mbedtls_base64_self_test(verbose);
68 if (res) TestFail = true;
69
70 res = mbedtls_cmac_self_test(verbose);
71 if (res) TestFail = true;
72
73 res = ecdsa_nist_test(verbose);
74 if (res) TestFail = true;
75
76 res = mbedtls_ecp_self_test(verbose);
77 if (res) TestFail = true;
78
79 res = mbedtls_x509_self_test(verbose);
80 if (res) TestFail = true;
81
82 res = exec_sda_test(verbose);
83 if (res) TestFail = true;
84
85 res = exec_dda_test(verbose);
86 if (res) TestFail = true;
87
88 res = exec_cda_test(verbose);
89 if (res) TestFail = true;
90
91 res = exec_crypto_test(verbose);
92 if (res) TestFail = true;
93
94 res = roca_self_test();
95 if (res) TestFail = true;
96
97 PrintAndLog("\n--------------------------");
98 if (TestFail)
99 PrintAndLogEx(FAILED, "\tTest(s) [ %s ]", _RED_(FAIL) );
100 else
101 PrintAndLogEx(SUCCESS, "\tTest(s) [ %s ]", _GREEN_(OK) );
102
103 return TestFail;
104 }
105
Impressum, Datenschutz