diff --git a/ChangeLog b/ChangeLog index 788d5133bc9206a2d01c5fd8342f37aefb01fdbe..02141f5bc5da099d7dbece2631a26c4a4e99fef7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +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-ciphers.c (_nettle_ciphers): Renamed array, from... + (nettle_ciphers: ... old name. + (nettle_get_ciphers): 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-ciphers.c b/nettle-meta-ciphers.c index 802fa141774c473edfe45b69ee077f73bd2b0b86..49cb47a70243e1e9c8f196f0403d535be54b67b3 100644 --- a/nettle-meta-ciphers.c +++ b/nettle-meta-ciphers.c @@ -36,7 +36,7 @@ #include <stddef.h> #include "nettle-meta.h" -const struct nettle_cipher * const nettle_ciphers[] = { +const struct nettle_cipher * const _nettle_ciphers[] = { &nettle_aes128, &nettle_aes192, &nettle_aes256, @@ -56,3 +56,9 @@ const struct nettle_cipher * const nettle_ciphers[] = { &nettle_arctwo_gutmann128, NULL }; + +const struct nettle_cipher * const * +nettle_get_ciphers (void) +{ + return _nettle_ciphers; +} diff --git a/nettle-meta.h b/nettle-meta.h index fd1667172c7602d1b309dde4669282caac5b3423..b645fb1b669b38ee027fa475c058b5854d2937d0 100644 --- a/nettle-meta.h +++ b/nettle-meta.h @@ -61,7 +61,15 @@ struct nettle_cipher }; /* null-terminated list of ciphers implemented by this version of nettle */ -extern const struct nettle_cipher * const nettle_ciphers[]; +extern const struct nettle_cipher * const _nettle_ciphers[]; + +const struct nettle_cipher * const * +#ifdef __GNUC__ +__attribute__((pure)) +#endif +nettle_get_ciphers (void); + +#define nettle_ciphers (nettle_get_ciphers()) extern const struct nettle_cipher nettle_aes128; extern const struct nettle_cipher nettle_aes192;