* 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.
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.
/* 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",
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);
+ }
}
-