Commit aa52330e authored by Niels Möller's avatar Niels Möller
Browse files

Implemented algorithm array nettle_aeads.

parent b672e553
2014-05-08 Niels Möller <>
* (nettle_SOURCES): Added nettle-meta-aeads.c.
* nettle-meta.h (nettle_aeads): Declare array.
* nettle-meta-aeads.c (nettle_aeads): New file, new array.
* testsuite/meta-aead-test.c: New test case.
* testsuite/ (TS_NETTLE_SOURCES): Added
* aclocal.m4 (GMP_PROG_CC_FOR_BUILD): If CC_FOR_BUILD is gcc, add
-O option. This makes eccdata twice as fast.
......@@ -106,8 +106,8 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c \
md2.c md2-meta.c md4.c md4-meta.c \
md5.c md5-compress.c md5-compat.c md5-meta.c \
memxor.c \
nettle-meta-armors.c nettle-meta-ciphers.c \
nettle-meta-hashes.c \
nettle-meta-aeads.c nettle-meta-armors.c \
nettle-meta-ciphers.c nettle-meta-hashes.c \
pbkdf2.c pbkdf2-hmac-sha1.c pbkdf2-hmac-sha256.c \
poly1305-aes.c poly1305-internal.c \
realloc.c \
/* nettle-meta-aeads.c
Copyright (C) 2014 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see
# include "config.h"
#include <stddef.h>
#include "nettle-meta.h"
const struct nettle_aead * const nettle_aeads[] = {
......@@ -155,6 +155,10 @@ struct nettle_aead
nettle_hash_digest_func *digest;
/* null-terminated list of aead constructions implemented by this
version of nettle */
extern const struct nettle_aead * const nettle_aeads[];
extern const struct nettle_aead nettle_gcm_aes128;
extern const struct nettle_aead nettle_gcm_aes192;
extern const struct nettle_aead nettle_gcm_aes256;
......@@ -136,6 +136,9 @@ meta-hash-test$(EXEEXT): meta-hash-test.$(OBJEXT)
meta-cipher-test$(EXEEXT): meta-cipher-test.$(OBJEXT)
$(LINK) meta-cipher-test.$(OBJEXT) $(TEST_OBJS) -o meta-cipher-test$(EXEEXT)
meta-aead-test$(EXEEXT): meta-aead-test.$(OBJEXT)
$(LINK) meta-aead-test.$(OBJEXT) $(TEST_OBJS) -o meta-aead-test$(EXEEXT)
meta-armor-test$(EXEEXT): meta-armor-test.$(OBJEXT)
$(LINK) meta-armor-test.$(OBJEXT) $(TEST_OBJS) -o meta-armor-test$(EXEEXT)
......@@ -28,7 +28,8 @@ TS_NETTLE_SOURCES = aes-test.c arcfour-test.c arctwo-test.c \
cbc-test.c ctr-test.c gcm-test.c eax-test.c ccm-test.c \
poly1305-test.c chacha-poly1305-test.c \
hmac-test.c umac-test.c \
meta-hash-test.c meta-cipher-test.c meta-armor-test.c \
meta-hash-test.c meta-cipher-test.c\
meta-aead-test.c meta-armor-test.c \
buffer-test.c yarrow-test.c pbkdf2-test.c
TS_HOGWEED_SOURCES = sexp-test.c sexp-format-test.c \
#include "testutils.h"
#include "nettle-internal.h"
#include "nettle-meta.h"
const char* aeads[] = {
int i,j;
int count = sizeof(aeads)/sizeof(*aeads);
for (i = 0; i < count; i++) {
for (j = 0; NULL != nettle_aeads[j]; j++) {
if (0 == strcmp(aeads[i], nettle_aeads[j]->name))
ASSERT(NULL != nettle_aeads[j]); /* make sure we found a matching aead */
j = 0;
while (NULL != nettle_aeads[j])
ASSERT(j == count); /* we are not missing testing any aeads */
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