Commit 96e96fe1 authored by Niels Möller's avatar Niels Möller

(test_hash_large): New function.

Rev: src/nettle/testsuite/testutils.c:1.28
Rev: src/nettle/testsuite/testutils.h:1.23
parent 976bd444
......@@ -341,6 +341,34 @@ test_hash(const struct nettle_hash *hash,
free(buffer);
}
void
test_hash_large(const struct nettle_hash *hash,
unsigned count, unsigned length,
uint8_t c,
const uint8_t *digest)
{
void *ctx = xalloc(hash->context_size);
uint8_t *buffer = xalloc(hash->digest_size);
uint8_t *data = xalloc(length);
unsigned i;
memset(data, c, length);
hash->init(ctx);
for (i = 0; i < count; i++)
hash->update(ctx, length, data);
hash->digest(ctx, hash->digest_size, buffer);
print_hex(hash->digest_size, buffer);
if (!MEMEQ(hash->digest_size, digest, buffer))
FAIL();
free(ctx);
free(buffer);
free(data);
}
void
test_armor(const struct nettle_armor *armor,
unsigned data_length,
......
......@@ -86,6 +86,12 @@ test_hash(const struct nettle_hash *hash,
const uint8_t *data,
const uint8_t *digest);
void
test_hash_large(const struct nettle_hash *hash,
unsigned count, unsigned length,
uint8_t c,
const uint8_t *digest);
void
test_armor(const struct nettle_armor *armor,
unsigned data_length,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment