File: meta-mac-test.c

package info (click to toggle)
nettle 3.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,508 kB
  • sloc: ansic: 72,410; asm: 21,179; sh: 4,328; makefile: 837; cpp: 71; awk: 7
file content (38 lines) | stat: -rw-r--r-- 765 bytes parent folder | download | duplicates (2)
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
#include "testutils.h"
#include "nettle-meta.h"

const char* macs[] = {
  "cmac_aes128",
  "cmac_aes256",
  "cmac_des3",
  "hmac_gosthash94",
  "hmac_gosthash94cp",
  "hmac_md5",
  "hmac_ripemd160",
  "hmac_sha1",
  "hmac_sha224",
  "hmac_sha256",
  "hmac_sha384",
  "hmac_sha512",
  "hmac_streebog256",
  "hmac_streebog512",
  "hmac_sm3",
};

void
test_main(void)
{
  int i, j;
  int count = sizeof(macs)/sizeof(*macs);
  for (i = 0; i < count; i++) {
    for (j = 0; NULL != nettle_macs[j]; j++) {
      if (0 == strcmp(macs[i], nettle_macs[j]->name))
	break;
    }
    ASSERT(NULL != nettle_macs[j]); /* make sure we found a matching mac */
  }
  i = 0;
  while (NULL != nettle_macs[i])
    i++;
  ASSERT(i == count); /* we are not missing testing any macs */
}