diff options
author | Niels Möller <nisse@lysator.liu.se> | 2022-09-28 11:49:54 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2022-09-28 11:49:54 +0200 |
commit | 753d0763ef43dd12aa96db2dc1c297fde3c4dfc9 (patch) | |
tree | 712673e3556e9613ec788c1ac9ec846ff603f79e /testsuite | |
parent | a1ca3b0161a654b493a59a96d804927a3777908e (diff) | |
download | nettle-753d0763ef43dd12aa96db2dc1c297fde3c4dfc9.tar.gz |
Stricter validation of nettle_cipher and nettle_hash in tests.
Increase NETTLE_MAX_HASH_BLOCK_SIZE to 144, to accommodate sha3_224.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/meta-cipher-test.c | 8 | ||||
-rw-r--r-- | testsuite/meta-hash-test.c | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/testsuite/meta-cipher-test.c b/testsuite/meta-cipher-test.c index 62488b7f..912fac5a 100644 --- a/testsuite/meta-cipher-test.c +++ b/testsuite/meta-cipher-test.c @@ -1,5 +1,6 @@ #include "testutils.h" #include "nettle-meta.h" +#include "nettle-internal.h" const char* ciphers[] = { "aes128", @@ -35,8 +36,11 @@ test_main(void) ASSERT(NULL != nettle_ciphers[j]); /* make sure we found a matching cipher */ } j = 0; - while (NULL != nettle_ciphers[j]) - j++; + for (j = 0; NULL != nettle_ciphers[j]; j++) + { + ASSERT(nettle_ciphers[j]->block_size <= NETTLE_MAX_CIPHER_BLOCK_SIZE); + ASSERT(nettle_ciphers[j]->key_size <= NETTLE_MAX_CIPHER_KEY_SIZE); + } ASSERT(j == count); /* we are not missing testing any ciphers */ } diff --git a/testsuite/meta-hash-test.c b/testsuite/meta-hash-test.c index 3aed43fc..6a15e7db 100644 --- a/testsuite/meta-hash-test.c +++ b/testsuite/meta-hash-test.c @@ -36,6 +36,7 @@ test_main(void) } for (i = 0; NULL != nettle_hashes[i]; i++) { + ASSERT(nettle_hashes[i]->block_size <= NETTLE_MAX_HASH_BLOCK_SIZE); ASSERT(nettle_hashes[i]->digest_size <= NETTLE_MAX_HASH_DIGEST_SIZE); ASSERT(nettle_hashes[i]->context_size <= NETTLE_MAX_HASH_CONTEXT_SIZE); } |