From b076e62ef304a75a273a3fd8d1455e667095ecc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Sun, 9 Apr 2017 15:15:18 +0200
Subject: [PATCH] New function nettle_get_aeads.

---
 ChangeLog           |  8 ++++++--
 nettle-meta-aeads.c |  8 +++++++-
 nettle-meta.h       | 10 +++++++++-
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 02141f5b..e8adc45a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,16 @@
 2017-04-09  Niels Möller  <nisse@lysator.liu.se>
 
-	* nettle-meta.h (nettle_ciphers): New macro, analogous to below
-	change to nettle_hashes.
+	* nettle-meta.h (nettle_ciphers, nettle_aeads): New macros,
+	analogous to below change to nettle_hashes.
 
 	* nettle-meta-ciphers.c (_nettle_ciphers): Renamed array, from...
 	(nettle_ciphers: ... old name.
 	(nettle_get_ciphers): New function.
 
+	* nettle-meta-aeads.c (_nettle_aeads): Renamed array, from...
+	(nettle_aeads: ... old name.
+	(nettle_get_aeads): New function.
+
 2017-01-12  Niels Möller  <nisse@lysator.liu.se>
 
 	* tools/nettle-hash.c (find_algorithm): Deleted function.
diff --git a/nettle-meta-aeads.c b/nettle-meta-aeads.c
index 8c052646..c99cc465 100644
--- a/nettle-meta-aeads.c
+++ b/nettle-meta-aeads.c
@@ -37,7 +37,7 @@
 
 #include "nettle-meta.h"
 
-const struct nettle_aead * const nettle_aeads[] = {
+const struct nettle_aead * const _nettle_aeads[] = {
   &nettle_gcm_aes128,
   &nettle_gcm_aes192,
   &nettle_gcm_aes256,
@@ -47,3 +47,9 @@ const struct nettle_aead * const nettle_aeads[] = {
   &nettle_chacha_poly1305,
   NULL
 };
+
+const struct nettle_aead * const *
+nettle_get_aeads (void)
+{
+  return _nettle_aeads;
+}
diff --git a/nettle-meta.h b/nettle-meta.h
index b645fb1b..c0320b45 100644
--- a/nettle-meta.h
+++ b/nettle-meta.h
@@ -176,7 +176,15 @@ struct nettle_aead
 
 /* 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 * const _nettle_aeads[];
+
+const struct nettle_aead * const *
+#ifdef __GNUC__
+__attribute__((pure))
+#endif
+nettle_get_aeads (void);
+
+#define nettle_aeads (nettle_get_aeads())
 
 extern const struct nettle_aead nettle_gcm_aes128;
 extern const struct nettle_aead nettle_gcm_aes192;
-- 
GitLab