1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include "testutils.h"
#include "nettle-internal.h"
#include "nettle-meta.h"
/* For NETTLE_MAX_HASH_CONTEXT_SIZE */
#include "sha3.h"
const char* hashes[] = {
"gosthash94",
"gosthash94cp",
"md2",
"md4",
"md5",
"ripemd160",
"sha1",
"sha224",
"sha256",
"sha384",
"sha512",
"sha3_224",
"sha3_256",
"sha3_384",
"sha3_512",
"streebog256",
"streebog512",
"sm3",
};
void
test_main(void)
{
int i;
int count = sizeof(hashes)/sizeof(*hashes);
for (i = 0; i < count; i++) {
/* make sure we found a matching hash */
ASSERT(nettle_lookup_hash(hashes[i]) != NULL);
}
for (i = 0; NULL != nettle_hashes[i]; i++) {
ASSERT(nettle_hashes[i]->digest_size <= NETTLE_MAX_HASH_DIGEST_SIZE);
ASSERT(nettle_hashes[i]->context_size <= NETTLE_MAX_HASH_CONTEXT_SIZE);
}
ASSERT(i == count); /* we are not missing testing any hashes */
}
|