]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/emv/test/cryptotest.c
restore #755 reverted after #757 (#761)
[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"
d03fb293
OM
34
35int ExecuteCryptoTests(bool verbose) {
36 int res;
37 bool TestFail = false;
38
700d8687 39 res = mbedtls_mpi_self_test(verbose);
d03fb293
OM
40 if (res) TestFail = true;
41
700d8687 42 res = mbedtls_aes_self_test(verbose);
d03fb293 43 if (res) TestFail = true;
c8a0f550 44
700d8687
OM
45 res = mbedtls_des_self_test(verbose);
46 if (res) TestFail = true;
47
48 res = mbedtls_sha1_self_test(verbose);
c8a0f550
OM
49 if (res) TestFail = true;
50
700d8687
OM
51 res = mbedtls_md5_self_test(verbose);
52 if (res) TestFail = true;
53
54 res = mbedtls_rsa_self_test(verbose);
d03fb293
OM
55 if (res) TestFail = true;
56
700d8687
OM
57 res = mbedtls_entropy_self_test(verbose);
58 if (res) TestFail = true;
59
60 res = mbedtls_timing_self_test(verbose);
61 if (res) TestFail = true;
62
63 res = mbedtls_ctr_drbg_self_test(verbose);
d03fb293
OM
64 if (res) TestFail = true;
65
700d8687
OM
66 res = mbedtls_base64_self_test(verbose);
67 if (res) TestFail = true;
68
69 res = mbedtls_cmac_self_test(verbose);
70 if (res) TestFail = true;
71
72 res = ecdsa_nist_test(verbose);
73 if (res) TestFail = true;
74
75 res = mbedtls_ecp_self_test(verbose);
76 if (res) TestFail = true;
77
78 res = mbedtls_x509_self_test(verbose);
d03fb293
OM
79 if (res) TestFail = true;
80
81 res = exec_sda_test(verbose);
82 if (res) TestFail = true;
83
84 res = exec_dda_test(verbose);
85 if (res) TestFail = true;
86
87 res = exec_cda_test(verbose);
88 if (res) TestFail = true;
89
90 res = exec_crypto_test(verbose);
91 if (res) TestFail = true;
92
93 PrintAndLog("\n--------------------------");
94 if (TestFail)
95 PrintAndLog("Test(s) [ERROR].");
96 else
97 PrintAndLog("Tests [OK].");
98
99 return TestFail;
100}
101
Impressum, Datenschutz