Commit 4ba3332c authored by Niels Möller's avatar Niels Möller

New constant NETTLE_MAX_HASH_CONTEXT_SIZE.

* nettle-internal.h (NETTLE_MAX_HASH_CONTEXT_SIZE): New constant.
* testsuite/meta-hash-test.c (test_main): Add sanity check for
NETTLE_MAX_HASH_CONTEXT_SIZE.
parent a7dba70c
2017-03-20 Niels Möller <nisse@lysator.liu.se>
* nettle-internal.h (NETTLE_MAX_HASH_CONTEXT_SIZE): New constant.
* testsuite/meta-hash-test.c (test_main): Add sanity check for
NETTLE_MAX_HASH_CONTEXT_SIZE.
* tools/nettle-hash.c (list_algorithms): Also display the internal
context size.
......
......@@ -54,6 +54,7 @@
/* Arbitrary limits which apply to systems that don't have alloca */
#define NETTLE_MAX_HASH_BLOCK_SIZE 128
#define NETTLE_MAX_HASH_DIGEST_SIZE 64
#define NETTLE_MAX_HASH_CONTEXT_SIZE (sizeof(struct sha3_224_ctx))
#define NETTLE_MAX_SEXP_ASSOC 17
#define NETTLE_MAX_CIPHER_BLOCK_SIZE 32
......
#include "testutils.h"
#include "nettle-internal.h"
#include "nettle-meta.h"
/* For NETTLE_MAX_HASH_CONTEXT_SIZE */
#include "sha3.h"
const char* hashes[] = {
"md2",
......@@ -34,7 +36,8 @@ test_main(void)
while (NULL != nettle_hashes[j])
j++;
ASSERT(j == count); /* we are not missing testing any hashes */
for (j = 0; NULL != nettle_hashes[j]; j++)
for (j = 0; NULL != nettle_hashes[j]; j++) {
ASSERT(nettle_hashes[j]->digest_size <= NETTLE_MAX_HASH_DIGEST_SIZE);
ASSERT(nettle_hashes[j]->context_size <= NETTLE_MAX_HASH_CONTEXT_SIZE);
}
}
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