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