]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/emv/test/cryptotest.c
fix emv search behavior
[proxmark3-svn] / client / emv / test / cryptotest.c
CommitLineData
d03fb293
OM
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
700d8687
OM
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"
d03fb293
OM
28
29#include "crypto_test.h"
30#include "sda_test.h"
31#include "dda_test.h"
32#include "cda_test.h"
700d8687 33#include "crypto/libpcrypto.h"
1511ea28 34#include "emv/emv_roca.h"
d03fb293
OM
35
36int ExecuteCryptoTests(bool verbose) {
37 int res;
38 bool TestFail = false;
39
700d8687 40 res = mbedtls_mpi_self_test(verbose);
d03fb293
OM
41 if (res) TestFail = true;
42
700d8687 43 res = mbedtls_aes_self_test(verbose);
d03fb293 44 if (res) TestFail = true;
c8a0f550 45
700d8687
OM
46 res = mbedtls_des_self_test(verbose);
47 if (res) TestFail = true;
48
49 res = mbedtls_sha1_self_test(verbose);
c8a0f550
OM
50 if (res) TestFail = true;
51
700d8687
OM
52 res = mbedtls_md5_self_test(verbose);
53 if (res) TestFail = true;
54
55 res = mbedtls_rsa_self_test(verbose);
d03fb293
OM
56 if (res) TestFail = true;
57
700d8687
OM
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);
d03fb293
OM
65 if (res) TestFail = true;
66
700d8687
OM
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);
d03fb293
OM
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
4cdd63b2 94 res = roca_self_test();
1511ea28 95 if (res) TestFail = true;
96
d03fb293
OM
97 PrintAndLog("\n--------------------------");
98 if (TestFail)
4cdd63b2 99 PrintAndLogEx(FAILED, "\tTest(s) [ %s ]", _RED_(FAIL) );
d03fb293 100 else
4cdd63b2 101 PrintAndLogEx(SUCCESS, "\tTest(s) [ %s ]", _GREEN_(OK) );
d03fb293
OM
102
103 return TestFail;
104}
105
Impressum, Datenschutz