use compare_testvector() instead of XMEMCMP() in tests
This commit is contained in:
@@ -25,7 +25,7 @@ int rc4_stream_test(void)
|
||||
|
||||
if ((err = rc4_stream_setup(&st, key, sizeof(key))) != CRYPT_OK) return err;
|
||||
if ((err = rc4_stream_crypt(&st, pt, sizeof(pt), buf)) != CRYPT_OK) return err;
|
||||
if (XMEMCMP(buf, ct, sizeof(ct))) return CRYPT_FAIL_TESTVECTOR;
|
||||
if (compare_testvector(buf, sizeof(ct), ct, sizeof(ct), "RC4", 0)) return CRYPT_FAIL_TESTVECTOR;
|
||||
if ((err = rc4_stream_done(&st)) != CRYPT_OK) return err;
|
||||
|
||||
return CRYPT_OK;
|
||||
|
||||
@@ -31,15 +31,7 @@ int sober128_stream_test(void)
|
||||
if ((err = sober128_stream_setiv(&st, iv, sizeof(iv))) != CRYPT_OK) return err;
|
||||
if ((err = sober128_stream_crypt(&st, src, len, dst)) != CRYPT_OK) return err;
|
||||
if ((err = sober128_stream_done(&st)) != CRYPT_OK) return err;
|
||||
if (XMEMCMP(dst, out, len)) {
|
||||
#if 0
|
||||
int y;
|
||||
printf("\nLTC_SOBER128 failed, I got:\n");
|
||||
for (y = 0; y < len; y++) printf("%02x ", dst[y]);
|
||||
printf("\nLTC_SOBER128 failed, expected:\n");
|
||||
for (y = 0; y < len; y++) printf("%02x ", out[y]);
|
||||
printf("\n");
|
||||
#endif
|
||||
if (compare_testvector(dst, len, out, len, "SOBER-128", 0)) {
|
||||
return CRYPT_FAIL_TESTVECTOR;
|
||||
}
|
||||
return CRYPT_OK;
|
||||
|
||||
Reference in New Issue
Block a user