Commit e4d0f702 authored by Niels Möller's avatar Niels Möller

test_aead: Allow digest size smaller than the block size.

parent ed10355f
2013-06-25 Niels Möller <nisse@lysator.liu.se> 2013-06-25 Niels Möller <nisse@lysator.liu.se>
* testsuite/testutils.c (test_aead): Allow digest size smaller
than the block size.
* tools/nettle-pbkdf2.c: New command line tool. * tools/nettle-pbkdf2.c: New command line tool.
* tools/Makefile.in (TARGETS): Added nettle-pbkdf2. * tools/Makefile.in (TARGETS): Added nettle-pbkdf2.
(nettle-pbkdf2$(EXEEXT)): New target. (nettle-pbkdf2$(EXEEXT)): New target.
......
...@@ -476,7 +476,7 @@ test_aead(const struct nettle_aead *aead, ...@@ -476,7 +476,7 @@ test_aead(const struct nettle_aead *aead,
ASSERT (cleartext->length == ciphertext->length); ASSERT (cleartext->length == ciphertext->length);
length = cleartext->length; length = cleartext->length;
ASSERT (digest->length == aead->block_size); ASSERT (digest->length <= aead->block_size);
data = xalloc(length); data = xalloc(length);
...@@ -492,10 +492,10 @@ test_aead(const struct nettle_aead *aead, ...@@ -492,10 +492,10 @@ test_aead(const struct nettle_aead *aead,
if (length) if (length)
aead->encrypt(ctx, length, data, cleartext->data); aead->encrypt(ctx, length, data, cleartext->data);
aead->digest(ctx, aead->block_size, buffer); aead->digest(ctx, digest->length, buffer);
ASSERT(MEMEQ(length, data, ciphertext->data)); ASSERT(MEMEQ(length, data, ciphertext->data));
ASSERT(MEMEQ(aead->block_size, buffer, digest->data)); ASSERT(MEMEQ(digest->length, buffer, digest->data));
/* decryption */ /* decryption */
memset(buffer, 0, aead->block_size); memset(buffer, 0, aead->block_size);
...@@ -507,10 +507,10 @@ test_aead(const struct nettle_aead *aead, ...@@ -507,10 +507,10 @@ test_aead(const struct nettle_aead *aead,
if (length) if (length)
aead->decrypt(ctx, length, data, data); aead->decrypt(ctx, length, data, data);
aead->digest(ctx, aead->block_size, buffer); aead->digest(ctx, digest->length, buffer);
ASSERT(MEMEQ(length, data, cleartext->data)); ASSERT(MEMEQ(length, data, cleartext->data));
ASSERT(MEMEQ(aead->block_size, buffer, digest->data)); ASSERT(MEMEQ(digest->length, buffer, digest->data));
free(ctx); free(ctx);
free(data); free(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