Commit bbecbf2b authored by Niels Möller's avatar Niels Möller
Browse files

In aead tests, use aead->digest_size.

parent 360dfd98
2014-04-11 Niels Möller <nisse@lysator.liu.se> 2014-04-11 Niels Möller <nisse@lysator.liu.se>
* testsuite/testutils.c (test_aead): Use aead->digest_size.
* configure.ac: Skip GMP tests if public key support is disabled. * configure.ac: Skip GMP tests if public key support is disabled.
* eax.c (block16_xor): Fixed bug effecting 32-bit platforms. * eax.c (block16_xor): Fixed bug effecting 32-bit platforms.
......
...@@ -478,19 +478,19 @@ test_aead(const struct nettle_aead *aead, ...@@ -478,19 +478,19 @@ test_aead(const struct nettle_aead *aead,
{ {
void *ctx = xalloc(aead->context_size); void *ctx = xalloc(aead->context_size);
uint8_t *data; uint8_t *data;
uint8_t *buffer = xalloc(aead->block_size); uint8_t *buffer = xalloc(aead->digest_size);
size_t length; size_t length;
ASSERT (cleartext->length == ciphertext->length); ASSERT (cleartext->length == ciphertext->length);
length = cleartext->length; length = cleartext->length;
ASSERT (key->length == aead->key_size); ASSERT (key->length == aead->key_size);
ASSERT (digest->length <= aead->block_size); ASSERT (digest->length <= aead->digest_size);
data = xalloc(length); data = xalloc(length);
/* encryption */ /* encryption */
memset(buffer, 0, aead->block_size); memset(buffer, 0, aead->digest_size);
aead->set_encrypt_key(ctx, key->data); aead->set_encrypt_key(ctx, key->data);
if (nonce->length != aead->nonce_size) if (nonce->length != aead->nonce_size)
...@@ -513,7 +513,7 @@ test_aead(const struct nettle_aead *aead, ...@@ -513,7 +513,7 @@ test_aead(const struct nettle_aead *aead,
ASSERT(MEMEQ(digest->length, buffer, digest->data)); ASSERT(MEMEQ(digest->length, buffer, digest->data));
/* decryption */ /* decryption */
memset(buffer, 0, aead->block_size); memset(buffer, 0, aead->digest_size);
aead->set_decrypt_key(ctx, key->data); aead->set_decrypt_key(ctx, key->data);
......
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