use compare_testvector() instead of XMEMCMP() in tests
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user