|
|
199a5d |
From e6ab9c67f0a14adc23c1067e03a106da1b1651b7 Mon Sep 17 00:00:00 2001
|
|
|
199a5d |
From: Petr Mensik <pemensik@redhat.com>
|
|
|
199a5d |
Date: Fri, 18 Oct 2019 21:30:52 +0200
|
|
|
199a5d |
Subject: [PATCH] Move USE_PKCS11 and USE_OPENSSL out of config.h
|
|
|
199a5d |
|
|
|
199a5d |
Building two variants with the same common code requires to unset
|
|
|
199a5d |
USE_PKCS11 on part of build. That is not possible with config.h value.
|
|
|
199a5d |
Move it as normal define to CDEFINES.
|
|
|
199a5d |
---
|
|
|
199a5d |
bin/confgen/Makefile.in | 2 +-
|
|
|
199a5d |
configure.ac | 8 ++++++--
|
|
|
199a5d |
lib/dns/dst_internal.h | 12 +++++++++---
|
|
|
199a5d |
3 files changed, 16 insertions(+), 6 deletions(-)
|
|
|
199a5d |
|
|
|
199a5d |
diff --git a/bin/confgen/Makefile.in b/bin/confgen/Makefile.in
|
|
|
199a5d |
index 1b7512d..c126bf3 100644
|
|
|
199a5d |
--- a/bin/confgen/Makefile.in
|
|
|
199a5d |
+++ b/bin/confgen/Makefile.in
|
|
|
199a5d |
@@ -22,7 +22,7 @@ VERSION=@BIND9_VERSION@
|
|
|
199a5d |
CINCLUDES = -I${srcdir}/include ${ISC_INCLUDES} ${ISCCC_INCLUDES} \
|
|
|
199a5d |
${ISCCFG_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES}
|
|
|
199a5d |
|
|
|
199a5d |
-CDEFINES =
|
|
|
199a5d |
+CDEFINES = @USE_PKCS11@
|
|
|
199a5d |
CWARNINGS =
|
|
|
199a5d |
|
|
|
199a5d |
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
|
|
|
199a5d |
diff --git a/configure.ac b/configure.ac
|
|
|
199a5d |
index f5483fe..08a7d8a 100644
|
|
|
199a5d |
--- a/configure.ac
|
|
|
199a5d |
+++ b/configure.ac
|
|
|
199a5d |
@@ -935,10 +935,14 @@ AC_SUBST([PKCS11_TEST])
|
|
|
199a5d |
AC_SUBST([PKCS11_TOOLS])
|
|
|
199a5d |
AC_SUBST([PKCS11_MANS])
|
|
|
199a5d |
|
|
|
199a5d |
+USE_PKCS11='-DUSE_PKCS11=0'
|
|
|
199a5d |
+USE_OPENSSL='-DUSE_OPENSSL=0'
|
|
|
199a5d |
AC_SUBST([CRYPTO])
|
|
|
199a5d |
AS_CASE([$CRYPTO],
|
|
|
199a5d |
- [pkcs11],[AC_DEFINE([USE_PKCS11], [1], [define if PKCS11 is used for Public-Key Cryptography])],
|
|
|
199a5d |
- [AC_DEFINE([USE_OPENSSL], [1], [define if OpenSSL is used for Public-Key Cryptography])])
|
|
|
199a5d |
+ [pkcs11],[USE_PKCS11='-DUSE_PKCS11=1'],
|
|
|
199a5d |
+ [USE_OPENSSL='-DUSE_OPENSSL=1'])
|
|
|
199a5d |
+AC_SUBST(USE_PKCS11)
|
|
|
199a5d |
+AC_SUBST(USE_OPENSSL)
|
|
|
199a5d |
|
|
|
199a5d |
# preparation for automake
|
|
|
199a5d |
# AM_CONDITIONAL([PKCS11_TOOLS], [test "$with_native_pkcs11" = "yes"])
|
|
|
199a5d |
diff --git a/lib/dns/dst_internal.h b/lib/dns/dst_internal.h
|
|
|
199a5d |
index 2c3b4a3..55e9dc4 100644
|
|
|
199a5d |
--- a/lib/dns/dst_internal.h
|
|
|
199a5d |
+++ b/lib/dns/dst_internal.h
|
|
|
199a5d |
@@ -38,6 +38,13 @@
|
|
|
199a5d |
#include <isc/stdtime.h>
|
|
|
199a5d |
#include <isc/types.h>
|
|
|
199a5d |
|
|
|
199a5d |
+#ifndef USE_PKCS11
|
|
|
199a5d |
+#define USE_PKCS11 0
|
|
|
199a5d |
+#endif
|
|
|
199a5d |
+#ifndef USE_OPENSSL
|
|
|
199a5d |
+#define USE_OPENSSL (! USE_PKCS11)
|
|
|
199a5d |
+#endif
|
|
|
199a5d |
+
|
|
|
199a5d |
#if USE_PKCS11
|
|
|
199a5d |
#include <pk11/pk11.h>
|
|
|
199a5d |
#include <pk11/site.h>
|
|
|
199a5d |
@@ -116,11 +123,10 @@ struct dst_key {
|
|
|
199a5d |
void *generic;
|
|
|
199a5d |
dns_gss_ctx_id_t gssctx;
|
|
|
199a5d |
DH *dh;
|
|
|
199a5d |
-#if USE_OPENSSL
|
|
|
199a5d |
- EVP_PKEY *pkey;
|
|
|
199a5d |
-#endif /* if USE_OPENSSL */
|
|
|
199a5d |
#if USE_PKCS11
|
|
|
199a5d |
pk11_object_t *pkey;
|
|
|
199a5d |
+#else
|
|
|
199a5d |
+ EVP_PKEY *pkey;
|
|
|
199a5d |
#endif /* if USE_PKCS11 */
|
|
|
199a5d |
dst_hmac_key_t *hmac_key;
|
|
|
199a5d |
} keydata; /*%< pointer to key in crypto pkg fmt */
|
|
|
199a5d |
--
|
|
|
199a5d |
2.26.2
|
|
|
199a5d |
|