summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2018-02-07 11:34:36 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2018-02-07 17:17:14 +0100
commitd4db0cc63e24b6d33e7610b72a41c24daeab456a (patch)
tree85e0cf5473f89f5acfe714f92d3d225674e466eb
parent3d10fce4625bc2c950235b35a23a9ffe188bfbb2 (diff)
downloadgnutls-d4db0cc63e24b6d33e7610b72a41c24daeab456a.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.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/nettle/pk.c b/lib/nettle/pk.c
index 0ba2c1f441..36603b0fd0 100644
--- a/lib/nettle/pk.c
+++ b/lib/nettle/pk.c
@@ -767,21 +767,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_nist_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;
}