chg, output

This commit is contained in:
iceman1001 2020-05-29 10:23:34 +02:00
parent 529b33b234
commit d65f2287f4
2 changed files with 12 additions and 14 deletions

View file

@ -123,6 +123,7 @@ const unsigned char c_ssd1[] = {
0x03, 0x8d, 0x0c, 0x91, 0x0a, 0x8a, 0x02, 0x95, 0x05, 0x9f, 0x37, 0x04, 0x9f, 0x4c, 0x08,
0x39, 0x00,
};
static const struct tlv ssd1_tlv = {
.len = sizeof(c_ssd1),
.value = c_ssd1,
@ -146,6 +147,7 @@ const unsigned char c_crm1[] = {
0x00, 0x00, 0x00, 0x06, 0x43, 0x14, 0x09, 0x25, 0x50, 0x12, 0x34, 0x57, 0x79, 0x23, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x03, 0x00,
};
static const struct tlv crm1_tlv = {
.len = sizeof(c_crm1),
.value = c_crm1,
@ -420,16 +422,16 @@ static int cda_test_pk(bool verbose) {
int exec_cda_test(bool verbose) {
int ret = cda_test_raw(verbose);
if (ret) {
PrintAndLogEx(WARNING, "CDA raw test: failed");
PrintAndLogEx(WARNING, "CDA raw test: (%s)", _RED_("failed"));
return ret;
}
PrintAndLogEx(INFO, "CDA raw test: passed");
PrintAndLogEx(INFO, "CDA raw test: (%s)", _GREEN_("passed"));
ret = cda_test_pk(verbose);
if (ret) {
PrintAndLogEx(WARNING, "CDA test pk: failed");
PrintAndLogEx(WARNING, "CDA test pk: (%s)", _RED_("failed"));
return ret;
}
PrintAndLogEx(INFO, "CDA test pk: passed");
PrintAndLogEx(INFO, "CDA test pk: (%s)", _GREEN_("passed"));
return 0;
}

View file

@ -304,31 +304,27 @@ close_pub:
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");
ret = test_pk(verbose);
int ret = test_pk(verbose);
if (ret) {
PrintAndLogEx(WARNING, "Crypto raw test: failed");
PrintAndLogEx(WARNING, "Crypto raw test: (%s)", _RED_("failed"));
return ret;
}
PrintAndLogEx(SUCCESS, "Crypto raw test (%s)", _GREEN_("passed"));
for (i = 0; i < ARRAYLEN(keylengths); i++) {
for (int i = 0; i < ARRAYLEN(keylengths); i++) {
unsigned int kl = keylengths[i];
ret = test_genkey(kl, message, kl / 8, verbose);
if (ret) {
PrintAndLogEx(WARNING, "Crypto generate key[%u] test: failed", kl);
PrintAndLogEx(WARNING, "Crypto generate key[%u] test: (%s)", kl, _RED_("failed"));
return ret;
}
}
if (include_slow_tests) {
for (i = 0; i < ARRAYLEN(extra_keylengths); i++) {
for (int i = 0; i < ARRAYLEN(extra_keylengths); i++) {
unsigned int kl = extra_keylengths[i];
ret = test_genkey(kl, message, kl / 8, verbose);
if (ret) {
PrintAndLogEx(WARNING, "Crypto generate key[%u] test: failed", kl);
PrintAndLogEx(WARNING, "Crypto generate key[%u] test: (%s)", kl, _RED_("failed"));
return ret;
}
}