mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
split slow tests
This commit is contained in:
parent
e7d67fc2b0
commit
782feb934a
9 changed files with 43 additions and 17 deletions
|
@ -229,10 +229,11 @@ static int usage_hf_iclass_sniff(void) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_hf_iclass_loclass(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: hf iclass loclass [options]");
|
||||
PrintAndLogEx(NORMAL, "Usage: hf iclass loclass [h] [t [l]] [f <filename>]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h Show this help");
|
||||
PrintAndLogEx(NORMAL, " t Perform self-test");
|
||||
PrintAndLogEx(NORMAL, " t l Perform self-test, including long ones");
|
||||
PrintAndLogEx(NORMAL, " f <filename> Bruteforce iclass dumpfile");
|
||||
PrintAndLogEx(NORMAL, " An iclass dumpfile is assumed to consist of an arbitrary number of");
|
||||
PrintAndLogEx(NORMAL, " malicious CSNs, and their protocol responses");
|
||||
|
@ -1831,10 +1832,11 @@ static int CmdHFiClass_loclass(const char *Cmd) {
|
|||
return PM3_EFILE;
|
||||
}
|
||||
} else if (opt == 't') {
|
||||
char opt2 = tolower(param_getchar(Cmd, 1));
|
||||
int errors = testCipherUtils();
|
||||
errors += testMAC();
|
||||
errors += doKeyTests(0);
|
||||
errors += testElite();
|
||||
errors += testElite(opt2=='l');
|
||||
if (errors) PrintAndLogEx(ERR, "There were errors!!!");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
|
|
@ -1716,19 +1716,21 @@ static int CmdEMVList(const char *Cmd) {
|
|||
static int CmdEMVTest(const char *Cmd) {
|
||||
CLIParserInit("emv test",
|
||||
"Executes tests\n",
|
||||
"Usage:\n\temv test\n");
|
||||
"Usage:\n\temv test [l]\n");
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("iI", "ignore", "ignore timing tests for VM"),
|
||||
arg_lit0("lL", "long", "run long tests too"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(Cmd, argtable, true);
|
||||
|
||||
bool ignoreTimeTest = arg_get_lit(1);
|
||||
bool runSlowTests = arg_get_lit(2);
|
||||
CLIParserFree();
|
||||
|
||||
return ExecuteCryptoTests(true, ignoreTimeTest);
|
||||
return ExecuteCryptoTests(true, ignoreTimeTest, runSlowTests);
|
||||
}
|
||||
|
||||
static int CmdEMVRoca(const char *Cmd) {
|
||||
|
|
|
@ -301,8 +301,9 @@ close_pub:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int exec_crypto_test(bool verbose) {
|
||||
unsigned int keylengths[] = {1024, 1152, 1408, 1984, 2048, 3072, 4096};
|
||||
int exec_crypto_test(bool verbose, bool include_slow_tests) {
|
||||
unsigned int keylengths[] = {1024, 2048};
|
||||
unsigned int extra_keylengths[] = {1152, 1408, 1984, 3072, 4096};
|
||||
int i;
|
||||
int ret;
|
||||
fprintf(stdout, "\n");
|
||||
|
@ -322,6 +323,15 @@ int exec_crypto_test(bool verbose) {
|
|||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (include_slow_tests) {
|
||||
for (i = 0; i < ARRAYLEN(extra_keylengths); i++) {
|
||||
unsigned int kl = extra_keylengths[i];
|
||||
ret = test_genkey(kl, message, kl / 8, verbose);
|
||||
if (ret) {
|
||||
fprintf(stderr, "Crypto generate key[%u] test: failed\n", kl);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@
|
|||
#define __CRYPTO_TEST_H
|
||||
#include <stdbool.h>
|
||||
|
||||
int exec_crypto_test(bool verbose);
|
||||
int exec_crypto_test(bool verbose, bool include_slow_tests);
|
||||
#endif
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "crypto/libpcrypto.h"
|
||||
#include "emv/emv_roca.h"
|
||||
|
||||
int ExecuteCryptoTests(bool verbose, bool ignore_time) {
|
||||
int ExecuteCryptoTests(bool verbose, bool ignore_time, bool include_slow_tests) {
|
||||
int res;
|
||||
bool TestFail = false;
|
||||
|
||||
|
@ -94,7 +94,7 @@ int ExecuteCryptoTests(bool verbose, bool ignore_time) {
|
|||
res = exec_cda_test(verbose);
|
||||
if (res) TestFail = true;
|
||||
|
||||
res = exec_crypto_test(verbose);
|
||||
res = exec_crypto_test(verbose, include_slow_tests);
|
||||
if (res) TestFail = true;
|
||||
|
||||
res = roca_self_test();
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
#define __CRYPTOTEST_H
|
||||
#include <stdbool.h>
|
||||
|
||||
int ExecuteCryptoTests(bool verbose, bool ignore_time);
|
||||
int ExecuteCryptoTests(bool verbose, bool ignore_time, bool include_slow_tests);
|
||||
#endif
|
||||
|
|
|
@ -637,7 +637,7 @@ static int _testHash1() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int testElite() {
|
||||
int testElite(bool slowtests) {
|
||||
PrintAndLogEx(INFO, "Testing iClass Elite functinality...");
|
||||
PrintAndLogEx(INFO, "Testing hash2");
|
||||
uint8_t k_cus[8] = {0x5B, 0x7C, 0x62, 0xC4, 0x91, 0xC1, 0x1B, 0x39};
|
||||
|
@ -669,6 +669,7 @@ int testElite() {
|
|||
errors += _testHash1();
|
||||
PrintAndLogEx(INFO, "Testing key diversification ...");
|
||||
errors += _test_iclass_key_permutation();
|
||||
errors += _testBruteforce();
|
||||
if (slowtests)
|
||||
errors += _testBruteforce();
|
||||
return errors;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ int calculateMasterKey(uint8_t first16bytes[], uint64_t master_key[]);
|
|||
* @brief Test function
|
||||
* @return
|
||||
*/
|
||||
int testElite(void);
|
||||
int testElite(bool slowtests);
|
||||
|
||||
/**
|
||||
Here are some pretty optimal values that can be used to recover necessary data in only
|
||||
|
|
17
pm3test.sh
17
pm3test.sh
|
@ -3,6 +3,12 @@
|
|||
PM3PATH=$(dirname "$0")
|
||||
cd "$PM3PATH" || exit 1
|
||||
|
||||
if [ "$1" == "long" ]; then
|
||||
SLOWTESTS=true
|
||||
else
|
||||
SLOWTESTS=false
|
||||
fi
|
||||
|
||||
C_RED='\033[0;31m'
|
||||
C_GREEN='\033[0;32m'
|
||||
C_YELLOW='\033[0;33m'
|
||||
|
@ -95,9 +101,14 @@ while true; do
|
|||
|
||||
printf "\n${C_BLUE}Testing HF:${C_NC}\n"
|
||||
if ! CheckExecute "hf mf offline text" "./client/proxmark3 -c 'hf mf'" "at_enc"; then break; fi
|
||||
if ! CheckExecute "hf mf hardnested test" "./client/proxmark3 -c 'hf mf hardnested t 1 000000000000'" "found:" "repeat" "ignore"; then break; fi
|
||||
if ! CheckExecute "hf iclass test" "./client/proxmark3 -c 'hf iclass loclass t'" "verified ok"; then break; fi
|
||||
if ! CheckExecute "emv test" "./client/proxmark3 -c 'emv test'" "Test(s) \[ OK"; then break; fi
|
||||
if $SLOWTESTS; then
|
||||
if ! CheckExecute "hf mf hardnested test" "./client/proxmark3 -c 'hf mf hardnested t 1 000000000000'" "found:" "repeat" "ignore"; then break; fi
|
||||
if ! CheckExecute "hf iclass test" "./client/proxmark3 -c 'hf iclass loclass t l'" "verified ok"; then break; fi
|
||||
if ! CheckExecute "emv test" "./client/proxmark3 -c 'emv test -l'" "Test(s) \[ OK"; then break; fi
|
||||
else
|
||||
if ! CheckExecute "hf iclass test" "./client/proxmark3 -c 'hf iclass loclass t'" "OK!"; then break; fi
|
||||
if ! CheckExecute "emv test" "./client/proxmark3 -c 'emv test'" "Test(s) \[ OK"; then break; fi
|
||||
fi
|
||||
|
||||
printf "\n${C_BLUE}Testing tools:${C_NC}\n"
|
||||
# Need a decent example for mfkey32...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue