blob: 68debeef65a384fffd1fe6b7f57a78d39fa2eaaf (
plain)
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
|
#include "testutils.h"
#include "nettle-internal.h"
#include "nettle-meta.h"
const char* hashes[] = {
"md2",
"md4",
"md5",
"ripemd160",
"sha1",
"sha224",
"sha256",
"sha384",
"sha512"
};
void
test_main(void)
{
int i,j;
int count = sizeof(hashes)/sizeof(*hashes);
for (i = 0; i < count; i++) {
for (j = 0; NULL != nettle_hashes[j]; j++) {
if (0 == strcmp(hashes[i], nettle_hashes[j]->name))
break;
}
ASSERT(NULL != nettle_hashes[j]); /* make sure we found a matching hash */
}
j = 0;
while (NULL != nettle_hashes[j])
j++;
ASSERT(j == count); /* we are not missing testing any hashes */
for (j = 0; NULL != nettle_hashes[j]; j++)
ASSERT(nettle_hashes[j]->digest_size <= NETTLE_MAX_HASH_DIGEST_SIZE);
}
|