From: Daiki Ueno dueno@redhat.com
Signed-off-by: Daiki Ueno dueno@redhat.com --- testsuite/.gitignore | 1 + testsuite/.test-rules.make | 3 +++ testsuite/Makefile.in | 2 +- testsuite/meta-mac-test.c | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 testsuite/meta-mac-test.c
diff --git a/testsuite/.gitignore b/testsuite/.gitignore index 066bcee2..a57feccb 100644 --- a/testsuite/.gitignore +++ b/testsuite/.gitignore @@ -56,6 +56,7 @@ /meta-armor-test /meta-cipher-test /meta-hash-test +/meta-mac-test /pbkdf2-test /pkcs1-test /pkcs1-sec-decrypt-test diff --git a/testsuite/.test-rules.make b/testsuite/.test-rules.make index efb7df3c..87e288c5 100644 --- a/testsuite/.test-rules.make +++ b/testsuite/.test-rules.make @@ -160,6 +160,9 @@ meta-aead-test$(EXEEXT): meta-aead-test.$(OBJEXT) meta-armor-test$(EXEEXT): meta-armor-test.$(OBJEXT) $(LINK) meta-armor-test.$(OBJEXT) $(TEST_OBJS) -o meta-armor-test$(EXEEXT)
+meta-mac-test$(EXEEXT): meta-mac-test.$(OBJEXT) + $(LINK) meta-mac-test.$(OBJEXT) $(TEST_OBJS) -o meta-mac-test$(EXEEXT) + buffer-test$(EXEEXT): buffer-test.$(OBJEXT) $(LINK) buffer-test.$(OBJEXT) $(TEST_OBJS) -o buffer-test$(EXEEXT)
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in index f8f85701..d688c242 100644 --- a/testsuite/Makefile.in +++ b/testsuite/Makefile.in @@ -31,7 +31,7 @@ TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \ poly1305-test.c chacha-poly1305-test.c \ hmac-test.c umac-test.c \ meta-hash-test.c meta-cipher-test.c\ - meta-aead-test.c meta-armor-test.c \ + meta-aead-test.c meta-armor-test.c meta-mac-test.c \ buffer-test.c yarrow-test.c xts-test.c pbkdf2-test.c
TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \ diff --git a/testsuite/meta-mac-test.c b/testsuite/meta-mac-test.c new file mode 100644 index 00000000..dcc9fbca --- /dev/null +++ b/testsuite/meta-mac-test.c @@ -0,0 +1,37 @@ +#include "testutils.h" +#include "nettle-internal.h" +#include "nettle-meta.h" + +const char* macs[] = { + "cmac_aes128", + "cmac_aes256", + "hmac_md5", + "hmac_ripemd160", + "hmac_sha1", + "hmac_sha224", + "hmac_sha256", + "hmac_sha384", + "hmac_sha512", + "umac32", + "umac64", + "umac96", + "umac128", +}; + +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 aead */ + } + i = 0; + while (NULL != nettle_macs[i]) + i++; + ASSERT(i == count); /* we are not missing testing any hashes */ +}