use compare_testvector in tests.
This commit is contained in:
parent
ea8dde7f63
commit
55450078ea
@ -411,10 +411,9 @@ int blake2b_512_test(void)
|
|||||||
blake2b_512_init(&md);
|
blake2b_512_init(&md);
|
||||||
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
||||||
blake2b_done(&md, tmp);
|
blake2b_done(&md, tmp);
|
||||||
if (XMEMCMP(tmp, tests[i].hash, 64) != 0) {
|
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_512", i))
|
||||||
return CRYPT_FAIL_TESTVECTOR;
|
return CRYPT_FAIL_TESTVECTOR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -458,10 +457,9 @@ int blake2b_384_test(void)
|
|||||||
blake2b_384_init(&md);
|
blake2b_384_init(&md);
|
||||||
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
||||||
blake2b_done(&md, tmp);
|
blake2b_done(&md, tmp);
|
||||||
if (XMEMCMP(tmp, tests[i].hash, 48) != 0) {
|
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_384", i))
|
||||||
return CRYPT_FAIL_TESTVECTOR;
|
return CRYPT_FAIL_TESTVECTOR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -501,10 +499,9 @@ int blake2b_256_test(void)
|
|||||||
blake2b_256_init(&md);
|
blake2b_256_init(&md);
|
||||||
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
||||||
blake2b_done(&md, tmp);
|
blake2b_done(&md, tmp);
|
||||||
if (XMEMCMP(tmp, tests[i].hash, 32) != 0) {
|
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_256", i))
|
||||||
return CRYPT_FAIL_TESTVECTOR;
|
return CRYPT_FAIL_TESTVECTOR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -542,10 +539,9 @@ int blake2b_160_test(void)
|
|||||||
blake2b_160_init(&md);
|
blake2b_160_init(&md);
|
||||||
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
blake2b_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
||||||
blake2b_done(&md, tmp);
|
blake2b_done(&md, tmp);
|
||||||
if (XMEMCMP(tmp, tests[i].hash, 20) != 0) {
|
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2B_160", i))
|
||||||
return CRYPT_FAIL_TESTVECTOR;
|
return CRYPT_FAIL_TESTVECTOR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -394,9 +394,9 @@ int blake2s_256_test(void)
|
|||||||
blake2s_256_init(&md);
|
blake2s_256_init(&md);
|
||||||
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
||||||
blake2s_done(&md, tmp);
|
blake2s_done(&md, tmp);
|
||||||
if (XMEMCMP(tmp, tests[i].hash, 32) != 0) {
|
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_256", i))
|
||||||
return CRYPT_FAIL_TESTVECTOR;
|
return CRYPT_FAIL_TESTVECTOR;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
#endif
|
#endif
|
||||||
@ -437,9 +437,9 @@ int blake2s_224_test(void)
|
|||||||
blake2s_224_init(&md);
|
blake2s_224_init(&md);
|
||||||
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
||||||
blake2s_done(&md, tmp);
|
blake2s_done(&md, tmp);
|
||||||
if (XMEMCMP(tmp, tests[i].hash, 28) != 0) {
|
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_224", i))
|
||||||
return CRYPT_FAIL_TESTVECTOR;
|
return CRYPT_FAIL_TESTVECTOR;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
#endif
|
#endif
|
||||||
@ -478,9 +478,9 @@ int blake2s_160_test(void)
|
|||||||
blake2s_160_init(&md);
|
blake2s_160_init(&md);
|
||||||
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
||||||
blake2s_done(&md, tmp);
|
blake2s_done(&md, tmp);
|
||||||
if (XMEMCMP(tmp, tests[i].hash, 20) != 0) {
|
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_160", i))
|
||||||
return CRYPT_FAIL_TESTVECTOR;
|
return CRYPT_FAIL_TESTVECTOR;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
#endif
|
#endif
|
||||||
@ -517,10 +517,9 @@ int blake2s_128_test(void)
|
|||||||
blake2s_128_init(&md);
|
blake2s_128_init(&md);
|
||||||
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
blake2s_process(&md, (unsigned char *)tests[i].msg, (unsigned long)strlen(tests[i].msg));
|
||||||
blake2s_done(&md, tmp);
|
blake2s_done(&md, tmp);
|
||||||
if (XMEMCMP(tmp, tests[i].hash, 16) != 0) {
|
if (compare_testvector(tmp, sizeof(tmp), tests[i].hash, sizeof(tests[i].hash), "BLAKE2S_128", i))
|
||||||
return CRYPT_FAIL_TESTVECTOR;
|
return CRYPT_FAIL_TESTVECTOR;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user