Merge pull request #405 from merlokk/emv_test_ignore

Emv test ignore
This commit is contained in:
Oleg Moiseenko 2019-09-16 19:26:20 +03:00 committed by GitHub
commit 63a94167ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View file

@ -383,7 +383,7 @@ test_script:
#proxmark crypto tests
ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 -c 'emv test'"} "Test?s? ? OK"
ExecTest "emv test" "emv test" {bash -lc "cd ~/client;./proxmark3 -c 'emv test -i'"} "Test?s? ? OK"
if ($global:TestsPassed) {

View file

@ -1714,8 +1714,21 @@ static int CmdEMVList(const char *Cmd) {
}
static int CmdEMVTest(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
return ExecuteCryptoTests(true);
CLIParserInit("emv test",
"Executes tests\n",
"Usage:\n\temv test\n");
void *argtable[] = {
arg_param_begin,
arg_lit0("iI", "ignore", "ignore timing tests for VM"),
arg_param_end
};
CLIExecWithReturn(Cmd, argtable, true);
bool ignoreTimeTest = arg_get_lit(1);
CLIParserFree();
return ExecuteCryptoTests(true, ignoreTimeTest);
}
static int CmdEMVRoca(const char *Cmd) {

View file

@ -33,7 +33,7 @@
#include "crypto/libpcrypto.h"
#include "emv/emv_roca.h"
int ExecuteCryptoTests(bool verbose) {
int ExecuteCryptoTests(bool verbose, bool ignore_time) {
int res;
bool TestFail = false;
@ -56,7 +56,7 @@ int ExecuteCryptoTests(bool verbose) {
if (res) TestFail = true;
res = mbedtls_entropy_self_test(verbose);
if (res) TestFail = true;
if (res && !ignore_time) TestFail = true;
// retry for CI (when resources too low)
for (int i = 0; i < 3; i++) {
@ -65,7 +65,7 @@ int ExecuteCryptoTests(bool verbose) {
break;
PrintAndLogEx(WARNING, "Repeat timing test %d", i + 1);
}
if (res) TestFail = true;
if (res && !ignore_time) TestFail = true;
res = mbedtls_ctr_drbg_self_test(verbose);
if (res) TestFail = true;

View file

@ -12,5 +12,5 @@
#define __CRYPTOTEST_H
#include <stdbool.h>
int ExecuteCryptoTests(bool verbose);
int ExecuteCryptoTests(bool verbose, bool ignore_time);
#endif