Support hash function from nettle (only)

Unlike COPTS=-DHAVE_DNSSEC, allow usage of just sha256 function from
nettle, but keep DNSSEC disabled at build time. Skips use of internal
hash implementation without support for validation built-in.
This commit is contained in:
Petr Menšík
2020-11-25 17:18:55 +01:00
committed by Simon Kelley
parent 25e63f1e56
commit 2024f97297
6 changed files with 44 additions and 24 deletions

View File

@@ -120,6 +120,9 @@ HAVE_AUTH
define this to include the facility to act as an authoritative DNS
server for one or more zones.
HAVE_NETTLEHASH
include just hash function from nettle, but no DNSSEC.
HAVE_DNSSEC
include DNSSEC validator.
@@ -187,6 +190,7 @@ RESOLVFILE
/* #define HAVE_IDN */
/* #define HAVE_LIBIDN2 */
/* #define HAVE_CONNTRACK */
/* #define HAVE_NETTLEHASH */
/* #define HAVE_DNSSEC */
@@ -420,6 +424,10 @@ static char *compile_opts =
"no-"
#endif
"auth "
#if !defined(HAVE_NETTLEHASH) && !defined(HAVE_DNSSEC)
"no-"
#endif
"nettlehash "
#ifndef HAVE_DNSSEC
"no-"
#endif

View File

@@ -25,6 +25,9 @@
#if NETTLE_VERSION_MAJOR == 3 && NETTLE_VERSION_MINOR >= 6
# include <nettle/gostdsa.h>
#endif
#endif
#if defined(HAVE_DNSSEC) || defined(HAVE_NETTLEHASH)
#include <nettle/nettle-meta.h>
#include <nettle/bignum.h>
@@ -167,6 +170,10 @@ int hash_init(const struct nettle_hash *hash, void **ctxp, unsigned char **diges
return 1;
}
#endif
#ifdef HAVE_DNSSEC
static int dnsmasq_rsa_verify(struct blockdata *key_data, unsigned int key_len, unsigned char *sig, size_t sig_len,
unsigned char *digest, size_t digest_len, int algo)

View File

@@ -157,7 +157,7 @@ extern int capget(cap_user_header_t header, cap_user_data_t data);
#include <priv.h>
#endif
#ifdef HAVE_DNSSEC
#if defined(HAVE_DNSSEC) || defined(HAVE_NETTLEHASH)
# include <nettle/nettle-meta.h>
#endif

View File

@@ -28,7 +28,7 @@
#include "dnsmasq.h"
#ifdef HAVE_DNSSEC
#if defined(HAVE_DNSSEC) || defined(HAVE_NETTLEHASH)
unsigned char *hash_questions(struct dns_header *header, size_t plen, char *name)
{
int q;