use compare_testvector() instead of XMEMCMP() in tests

This commit is contained in:
Steffen Jaeckel
2017-06-20 19:06:26 +02:00
parent 05e28d6cfa
commit 27b3ffc627
35 changed files with 81 additions and 302 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ int f9_test(void)
if ((err = f9_memory(idx, tests[x].K, 16, tests[x].M, tests[x].msglen, T, &taglen)) != CRYPT_OK) {
return err;
}
if (taglen != 4 || XMEMCMP(T, tests[x].T, 4)) {
if (compare_testvector(T, taglen, tests[x].T, 4, "F9", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
+1 -6
View File
@@ -88,12 +88,7 @@ int omac_test(void)
return err;
}
if (XMEMCMP(out, tests[x].tag, 16) != 0) {
#if 0
int y;
printf("\n\nTag: ");
for (y = 0; y < 16; y++) printf("%02x", out[y]); printf("\n\n");
#endif
if (compare_testvector(out, len, tests[x].tag, sizeof(tests[x].tag), "OMAC", x) != 0) {
return CRYPT_FAIL_TESTVECTOR;
}
}
+1 -6
View File
@@ -97,12 +97,7 @@ int pelican_test(void)
return err;
}
if (XMEMCMP(out, tests[x].T, 16)) {
#if 0
int y;
printf("\nFailed test %d\n", x);
printf("{ "); for (y = 0; y < 16; ) { printf("0x%02x, ", out[y]); if (!(++y & 7)) printf("\n"); } printf(" }\n");
#endif
if (compare_testvector(out, 16, tests[x].T, 16, "PELICAN", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
+1 -10
View File
@@ -136,16 +136,7 @@ int pmac_test(void)
return err;
}
if (XMEMCMP(outtag, tests[x].tag, len)) {
#if 0
unsigned long y;
printf("\nTAG:\n");
for (y = 0; y < len; ) {
printf("0x%02x", outtag[y]);
if (y < len-1) printf(", ");
if (!(++y % 8)) printf("\n");
}
#endif
if (compare_testvector(outtag, len, tests[x].tag, sizeof(tests[x].tag), "PMAC", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}
+1 -1
View File
@@ -109,7 +109,7 @@ int xcbc_test(void)
if ((err = xcbc_memory(idx, tests[x].K, 16, tests[x].M, tests[x].msglen, T, &taglen)) != CRYPT_OK) {
return err;
}
if (taglen != 16 || XMEMCMP(T, tests[x].T, 16)) {
if (compare_testvector(T, taglen, tests[x].T, 16, "XCBC", x)) {
return CRYPT_FAIL_TESTVECTOR;
}
}