proxmark3/client/emv/test/cryptotest.c

70 lines
1.6 KiB
C
Raw Normal View History

//-----------------------------------------------------------------------------
// Copyright (C) 2017 Merlok
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//-----------------------------------------------------------------------------
// Crypto algorithms testing
//-----------------------------------------------------------------------------
#include "cryptotest.h"
#include "util.h"
#include "ui.h"
#include "bignum.h"
#include "aes.h"
2018-10-26 19:17:08 +08:00
#include "aes_cmac128.h"
#include "des.h"
#include "rsa.h"
#include "sha1.h"
#include "crypto_test.h"
#include "sda_test.h"
#include "dda_test.h"
#include "cda_test.h"
int ExecuteCryptoTests(bool verbose) {
int res;
bool TestFail = false;
res = mpi_self_test(verbose);
if (res) TestFail = true;
res = aes_self_test(verbose);
if (res) TestFail = true;
2018-10-26 19:17:08 +08:00
res = aes_cmac_self_test(verbose);
if (res) TestFail = true;
res = des_self_test(verbose);
if (res) TestFail = true;
res = sha1_self_test(verbose);
if (res) TestFail = true;
res = rsa_self_test(verbose);
if (res) TestFail = true;
res = exec_sda_test(verbose);
if (res) TestFail = true;
res = exec_dda_test(verbose);
if (res) TestFail = true;
res = exec_cda_test(verbose);
if (res) TestFail = true;
res = exec_crypto_test(verbose);
if (res) TestFail = true;
2018-02-22 00:56:09 +08:00
PrintAndLogEx(NORMAL, "\n--------------------------");
if (TestFail)
2018-02-22 00:56:09 +08:00
PrintAndLogEx(ERR, "Test(s) [ERROR].");
else
2018-02-22 00:56:09 +08:00
PrintAndLogEx(SUCCESS, "Tests [OK].");
return TestFail;
}