Add TEST_FAIL() support for internal hash functions
md4_vector(), md5_vector(), sha1_vector(), and sha256_vector() already supported TEST_FAIL() with the OpenSSL crypto implementation, but the same test functionality is needed for the internal crypto implementation as well. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
089e7ca372
commit
07555778a7
4 changed files with 12 additions and 0 deletions
|
@ -31,6 +31,9 @@ int md4_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
|
||||||
MD4_CTX ctx;
|
MD4_CTX ctx;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (TEST_FAIL())
|
||||||
|
return -1;
|
||||||
|
|
||||||
MD4Init(&ctx);
|
MD4Init(&ctx);
|
||||||
for (i = 0; i < num_elem; i++)
|
for (i = 0; i < num_elem; i++)
|
||||||
MD4Update(&ctx, addr[i], len[i]);
|
MD4Update(&ctx, addr[i], len[i]);
|
||||||
|
|
|
@ -33,6 +33,9 @@ int md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
|
||||||
MD5_CTX ctx;
|
MD5_CTX ctx;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (TEST_FAIL())
|
||||||
|
return -1;
|
||||||
|
|
||||||
MD5Init(&ctx);
|
MD5Init(&ctx);
|
||||||
for (i = 0; i < num_elem; i++)
|
for (i = 0; i < num_elem; i++)
|
||||||
MD5Update(&ctx, addr[i], len[i]);
|
MD5Update(&ctx, addr[i], len[i]);
|
||||||
|
|
|
@ -33,6 +33,9 @@ int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
|
||||||
SHA1_CTX ctx;
|
SHA1_CTX ctx;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (TEST_FAIL())
|
||||||
|
return -1;
|
||||||
|
|
||||||
SHA1Init(&ctx);
|
SHA1Init(&ctx);
|
||||||
for (i = 0; i < num_elem; i++)
|
for (i = 0; i < num_elem; i++)
|
||||||
SHA1Update(&ctx, addr[i], len[i]);
|
SHA1Update(&ctx, addr[i], len[i]);
|
||||||
|
|
|
@ -28,6 +28,9 @@ int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len,
|
||||||
struct sha256_state ctx;
|
struct sha256_state ctx;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
if (TEST_FAIL())
|
||||||
|
return -1;
|
||||||
|
|
||||||
sha256_init(&ctx);
|
sha256_init(&ctx);
|
||||||
for (i = 0; i < num_elem; i++)
|
for (i = 0; i < num_elem; i++)
|
||||||
if (sha256_process(&ctx, addr[i], len[i]))
|
if (sha256_process(&ctx, addr[i], len[i]))
|
||||||
|
|
Loading…
Reference in a new issue