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