]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/emv/test/cryptotest.c
   1 //----------------------------------------------------------------------------- 
   2 // Copyright (C) 2017 Merlok 
   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 
   7 //----------------------------------------------------------------------------- 
   8 // Crypto algorithms testing 
   9 //----------------------------------------------------------------------------- 
  11 #include "cryptotest.h" 
  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" 
  29 #include "crypto_test.h" 
  33 #include "crypto/libpcrypto.h" 
  35 int ExecuteCryptoTests(bool verbose
) { 
  37         bool TestFail 
= false; 
  39         res 
= mbedtls_mpi_self_test(verbose
); 
  40         if (res
) TestFail 
= true; 
  42         res 
= mbedtls_aes_self_test(verbose
); 
  43         if (res
) TestFail 
= true; 
  45         res 
= mbedtls_des_self_test(verbose
); 
  46         if (res
) TestFail 
= true; 
  48         res 
= mbedtls_sha1_self_test(verbose
); 
  49         if (res
) TestFail 
= true; 
  51         res 
= mbedtls_md5_self_test(verbose
); 
  52         if (res
) TestFail 
= true; 
  54         res 
= mbedtls_rsa_self_test(verbose
); 
  55         if (res
) TestFail 
= true; 
  57         res 
= mbedtls_entropy_self_test(verbose
); 
  58         if (res
) TestFail 
= true; 
  60         res 
= mbedtls_timing_self_test(verbose
); 
  61         if (res
) TestFail 
= true; 
  63         res 
= mbedtls_ctr_drbg_self_test(verbose
); 
  64         if (res
) TestFail 
= true; 
  66         res 
= mbedtls_base64_self_test(verbose
); 
  67         if (res
) TestFail 
= true; 
  69         res 
= mbedtls_cmac_self_test(verbose
); 
  70         if (res
) TestFail 
= true; 
  72         res 
= ecdsa_nist_test(verbose
); 
  73         if (res
) TestFail 
= true; 
  75         res 
= mbedtls_ecp_self_test(verbose
); 
  76         if (res
) TestFail 
= true; 
  78         res 
= mbedtls_x509_self_test(verbose
); 
  79         if (res
) TestFail 
= true; 
  81         res 
= exec_sda_test(verbose
); 
  82         if (res
) TestFail 
= true; 
  84         res 
= exec_dda_test(verbose
); 
  85         if (res
) TestFail 
= true; 
  87         res 
= exec_cda_test(verbose
); 
  88         if (res
) TestFail 
= true; 
  90         res 
= exec_crypto_test(verbose
); 
  91         if (res
) TestFail 
= true; 
  93         PrintAndLog("\n--------------------------"); 
  95                 PrintAndLog("Test(s) [ERROR]."); 
  97                 PrintAndLog("Tests [OK].");