meta-cipher-test.c 797 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "testutils.h"
#include "nettle-meta.h"

const char* ciphers[] = {
  "aes128",
  "aes192",
  "aes256",
  "arctwo40",
  "arctwo64",
  "arctwo128",
  "arctwo_gutmann128",
  "camellia128",
  "camellia192",
  "camellia256",
  "cast128",
  "serpent128",
  "serpent192",
  "serpent256",
  "twofish128",
  "twofish192",
  "twofish256"
};

24
void
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
test_main(void)
{
  int i,j;
  int count = sizeof(ciphers)/sizeof(*ciphers);
  for (i = 0; i < count; i++) {
    for (j = 0; NULL != nettle_ciphers[j]; j++) {
      if (0 == strcmp(ciphers[i], nettle_ciphers[j]->name))
        break;
    }
    ASSERT(NULL != nettle_ciphers[j]); /* make sure we found a matching cipher */
  }
  j = 0;
  while (NULL != nettle_ciphers[j])
    j++;
  ASSERT(j == count); /* we are not missing testing any ciphers */
}