]>
Commit | Line | Data |
---|---|---|
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 | ||
15 | #include "bignum.h" | |
16 | #include "aes.h" | |
c8a0f550 | 17 | #include "aes_cmac128.h" |
d03fb293 OM |
18 | #include "des.h" |
19 | #include "rsa.h" | |
20 | #include "sha1.h" | |
21 | ||
22 | #include "crypto_test.h" | |
23 | #include "sda_test.h" | |
24 | #include "dda_test.h" | |
25 | #include "cda_test.h" | |
26 | ||
27 | int ExecuteCryptoTests(bool verbose) { | |
28 | int res; | |
29 | bool TestFail = false; | |
30 | ||
31 | res = mpi_self_test(verbose); | |
32 | if (res) TestFail = true; | |
33 | ||
34 | res = aes_self_test(verbose); | |
35 | if (res) TestFail = true; | |
c8a0f550 OM |
36 | |
37 | res = aes_cmac_self_test(verbose); | |
38 | if (res) TestFail = true; | |
39 | ||
d03fb293 OM |
40 | res = des_self_test(verbose); |
41 | if (res) TestFail = true; | |
42 | ||
43 | res = sha1_self_test(verbose); | |
44 | if (res) TestFail = true; | |
45 | ||
46 | res = rsa_self_test(verbose); | |
47 | if (res) TestFail = true; | |
48 | ||
49 | res = exec_sda_test(verbose); | |
50 | if (res) TestFail = true; | |
51 | ||
52 | res = exec_dda_test(verbose); | |
53 | if (res) TestFail = true; | |
54 | ||
55 | res = exec_cda_test(verbose); | |
56 | if (res) TestFail = true; | |
57 | ||
58 | res = exec_crypto_test(verbose); | |
59 | if (res) TestFail = true; | |
60 | ||
61 | PrintAndLog("\n--------------------------"); | |
62 | if (TestFail) | |
63 | PrintAndLog("Test(s) [ERROR]."); | |
64 | else | |
65 | PrintAndLog("Tests [OK]."); | |
66 | ||
67 | return TestFail; | |
68 | } | |
69 |