diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2018-02-07 11:34:36 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2018-02-07 17:19:44 +0100 |
commit | 8e66155ad3c5934208fe2a3214ac84d4c1256191 (patch) | |
tree | a794dce01f087e22235a6824dda3cad2d72c35b9 | |
parent | a89544226aee7d3fee1646feb779c0e04dda66e5 (diff) | |
download | gnutls-8e66155ad3c5934208fe2a3214ac84d4c1256191.tar.gz |
nettle: use the nettle_get_secp API when available
Resolves #380
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | lib/nettle/pk.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/nettle/pk.c b/lib/nettle/pk.c index 368598bea6..e20bb4d062 100644 --- a/lib/nettle/pk.c +++ b/lib/nettle/pk.c @@ -861,21 +861,31 @@ _wrap_nettle_pk_verify(gnutls_pk_algorithm_t algo, return ret; } +#if NETTLE_MAJOR_VERSION < 3 || (NETTLE_MAJOR_VERSION == 3 && NETTLE_MINOR_VERSION < 4) +# ifdef ENABLE_NON_SUITEB_CURVES +# define nettle_get_secp_192r1() &nettle_secp_192r1 +# define nettle_get_secp_224r1() &nettle_secp_224r1 +# endif +# define nettle_get_secp_256r1() &nettle_secp_256r1 +# define nettle_get_secp_384r1() &nettle_secp_384r1 +# define nettle_get_secp_521r1() &nettle_secp_521r1 +#endif + static inline const struct ecc_curve *get_supported_curve(int curve) { switch (curve) { #ifdef ENABLE_NON_SUITEB_CURVES case GNUTLS_ECC_CURVE_SECP192R1: - return &nettle_secp_192r1; + return nettle_get_secp_192r1(); case GNUTLS_ECC_CURVE_SECP224R1: - return &nettle_secp_224r1; + return nettle_get_secp_224r1(); #endif case GNUTLS_ECC_CURVE_SECP256R1: - return &nettle_secp_256r1; + return nettle_get_secp_256r1(); case GNUTLS_ECC_CURVE_SECP384R1: - return &nettle_secp_384r1; + return nettle_get_secp_384r1(); case GNUTLS_ECC_CURVE_SECP521R1: - return &nettle_secp_521r1; + return nettle_get_secp_521r1(); default: return NULL; } |