Commit b1ee49a5 authored by Daniel Kahn Gillmor's avatar Daniel Kahn Gillmor Committed by Niels Möller

Contributed by Daniel Kahn Gillmor:

* testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
meta-hash-test.c, meta-cipher-test.c, and meta-armor-test.c.

* testsuite/meta-hash-test.c: New file.
* testsuite/meta-cipher-test.c: New file.
* testsuite/meta-armor-test.c: New file.

Rev: nettle/testsuite/.test-rules.make:1.10
Rev: nettle/testsuite/Makefile.in:1.13
Rev: nettle/testsuite/meta-armor-test.c:1.1
Rev: nettle/testsuite/meta-cipher-test.c:1.1
Rev: nettle/testsuite/meta-hash-test.c:1.1
parent 68beda93
......@@ -82,6 +82,15 @@ gcm-test$(EXEEXT): gcm-test.$(OBJEXT)
hmac-test$(EXEEXT): hmac-test.$(OBJEXT)
$(LINK) hmac-test.$(OBJEXT) $(TEST_OBJS) -o hmac-test$(EXEEXT)
meta-hash-test$(EXEEXT): meta-hash-test.$(OBJEXT)
$(LINK) meta-hash-test.$(OBJEXT) $(TEST_OBJS) -o meta-hash-test$(EXEEXT)
meta-cipher-test$(EXEEXT): meta-cipher-test.$(OBJEXT)
$(LINK) meta-cipher-test.$(OBJEXT) $(TEST_OBJS) -o meta-cipher-test$(EXEEXT)
meta-armor-test$(EXEEXT): meta-armor-test.$(OBJEXT)
$(LINK) meta-armor-test.$(OBJEXT) $(TEST_OBJS) -o meta-armor-test$(EXEEXT)
buffer-test$(EXEEXT): buffer-test.$(OBJEXT)
$(LINK) buffer-test.$(OBJEXT) $(TEST_OBJS) -o buffer-test$(EXEEXT)
......
......@@ -22,6 +22,7 @@ TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
serpent-test.c twofish-test.c \
knuth-lfib-test.c \
cbc-test.c ctr-test.c gcm-test.c hmac-test.c \
meta-hash-test.c meta-cipher-test.c meta-armor-test.c \
buffer-test.c yarrow-test.c
TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
......
#include "testutils.h"
#include "nettle-meta.h"
const char* armors[] = {
"base16",
"base64"
};
int
test_main(void)
{
int i,j;
int count = sizeof(armors)/sizeof(*armors);
for (i = 0; i < count; i++) {
for (j = 0; NULL != nettle_armors[j]; j++) {
if (0 == strcmp(armors[i], nettle_armors[j]->name))
break;
}
ASSERT(NULL != nettle_armors[j]); /* make sure we found a matching armor */
}
j = 0;
while (NULL != nettle_armors[j])
j++;
ASSERT(j == count); /* we are not missing testing any armors */
SUCCESS();
}
#include "testutils.h"
#include "nettle-meta.h"
const char* ciphers[] = {
"aes128",
"aes192",
"aes256",
"arctwo40",
"arctwo64",
"arctwo128",
"arctwo_gutmann128",
"arcfour128",
"camellia128",
"camellia192",
"camellia256",
"cast128",
"serpent128",
"serpent192",
"serpent256",
"twofish128",
"twofish192",
"twofish256"
};
int
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 */
SUCCESS();
}
#include "testutils.h"
#include "nettle-meta.h"
const char* hashes[] = {
"md2",
"md4",
"md5",
"sha1",
"sha224",
"sha256",
"sha384",
"sha512"
};
int
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 */
SUCCESS();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment