52 lines
1.8 KiB
Diff
52 lines
1.8 KiB
Diff
From f332e9e3c5d5671ed8435a06daa2b45272cd20cc Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
|
|
Date: Wed, 31 Jul 2019 19:44:39 +0200
|
|
Subject: [PATCH] Compile with nettle 3.5
|
|
|
|
Nettle library no longer provides direct access to selected variables.
|
|
Use getter functions with backward compatibility with nettle 3.3.
|
|
---
|
|
src/crypto.c | 12 ++++++++++--
|
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/crypto.c b/src/crypto.c
|
|
index ebb871e..24bfc76 100644
|
|
--- a/src/crypto.c
|
|
+++ b/src/crypto.c
|
|
@@ -26,6 +26,14 @@
|
|
#include <nettle/nettle-meta.h>
|
|
#include <nettle/bignum.h>
|
|
|
|
+#ifndef nettle_hashes
|
|
+/* nettle 3.4 introduced getters, but ecc-curve does not have its own.
|
|
+ * nettle_hashes were first defined in the same version.
|
|
+ * nettle 3.5 no longer provides globals without getter access. */
|
|
+#define nettle_get_secp_256r1 (&nettle_secp_256r1)
|
|
+#define nettle_get_secp_384r1 (&nettle_secp_384r1)
|
|
+#endif
|
|
+
|
|
/* Implement a "hash-function" to the nettle API, which simply returns
|
|
the input data, concatenated into a single, statically maintained, buffer.
|
|
|
|
@@ -294,7 +302,7 @@ static int dnsmasq_ecdsa_verify(struct blockdata *key_data, unsigned int key_len
|
|
if (!(key_256 = whine_malloc(sizeof(struct ecc_point))))
|
|
return 0;
|
|
|
|
- nettle_ecc_point_init(key_256, &nettle_secp_256r1);
|
|
+ nettle_ecc_point_init(key_256, nettle_get_secp_256r1());
|
|
}
|
|
|
|
key = key_256;
|
|
@@ -307,7 +315,7 @@ static int dnsmasq_ecdsa_verify(struct blockdata *key_data, unsigned int key_len
|
|
if (!(key_384 = whine_malloc(sizeof(struct ecc_point))))
|
|
return 0;
|
|
|
|
- nettle_ecc_point_init(key_384, &nettle_secp_384r1);
|
|
+ nettle_ecc_point_init(key_384, nettle_get_secp_384r1());
|
|
}
|
|
|
|
key = key_384;
|
|
--
|
|
2.20.1
|
|
|