Added some code (commented out) to print details about Camellia test failure
(and ditto for SEED) This is modeled after similar commented-out code in sober128_test(), but slightly fancier.
This commit is contained in:
parent
cecbbb88fc
commit
ee7c031ddf
@ -686,6 +686,21 @@ int camellia_test(void)
|
||||
}
|
||||
camellia_done(&skey);
|
||||
if (XMEMCMP(tests[x].ct, buf[0], 16) || XMEMCMP(tests[x].pt, buf[1], 16)) {
|
||||
#if 0
|
||||
int i, j;
|
||||
printf ("\n\nLTC_CAMELLIA failed for x=%d, I got:\n", x);
|
||||
for (i = 0; i < 2; i++) {
|
||||
const unsigned char *expected, *actual;
|
||||
expected = (i ? tests[x].pt : tests[x].ct);
|
||||
actual = buf[i];
|
||||
printf ("expected actual (%s)\n", (i ? "plaintext" : "ciphertext"));
|
||||
for (j = 0; j < 16; j++) {
|
||||
const char *eq = (expected[j] == actual[j] ? "==" : "!=");
|
||||
printf (" %02x %s %02x\n", expected[j], eq, actual[j]);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
#endif
|
||||
return CRYPT_FAIL_TESTVECTOR;
|
||||
}
|
||||
}
|
||||
|
@ -346,6 +346,21 @@ int kseed_test(void)
|
||||
kseed_ecb_encrypt(tests[x].pt, buf[0], &skey);
|
||||
kseed_ecb_decrypt(buf[0], buf[1], &skey);
|
||||
if (XMEMCMP(buf[0], tests[x].ct, 16) || XMEMCMP(buf[1], tests[x].pt, 16)) {
|
||||
#if 0
|
||||
int i, j;
|
||||
printf ("\n\nLTC_KSEED failed for x=%d, I got:\n", x);
|
||||
for (i = 0; i < 2; i++) {
|
||||
const unsigned char *expected, *actual;
|
||||
expected = (i ? tests[x].pt : tests[x].ct);
|
||||
actual = buf[i];
|
||||
printf ("expected actual (%s)\n", (i ? "plaintext" : "ciphertext"));
|
||||
for (j = 0; j < 16; j++) {
|
||||
const char *eq = (expected[j] == actual[j] ? "==" : "!=");
|
||||
printf (" %02x %s %02x\n", expected[j], eq, actual[j]);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
#endif
|
||||
return CRYPT_FAIL_TESTVECTOR;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user