Blame SOURCES/bind-9.10-dist-native-pkcs11.patch

b7523e
From 040227009453b3f0aa7914c7a6a94dc57ad5269b Mon Sep 17 00:00:00 2001
b7523e
From: Petr Mensik <pemensik@redhat.com>
b7523e
Date: Thu, 21 Jan 2021 10:46:20 +0100
b7523e
Subject: [PATCH] Enable custom pkcs11 native build
b7523e
b7523e
Share common parts like libisc, libcc and others. But provide native
b7523e
pkcs11 libraries as a new copy of libdns and libns.
b7523e
---
b7523e
 bin/Makefile.in                  |  2 +-
b7523e
 bin/confgen/Makefile.in          |  2 +-
b7523e
 bin/dnssec-pkcs11/Makefile.in    | 39 +++++++++++++++++---------------
b7523e
 bin/named-pkcs11/Makefile.in     | 33 ++++++++++++++-------------
b7523e
 configure.ac                     | 19 ++++++++++++++++
b7523e
 lib/Makefile.in                  |  2 +-
b7523e
 lib/dns-pkcs11/Makefile.in       | 22 +++++++++---------
b7523e
 lib/dns-pkcs11/tests/Makefile.in |  8 +++----
b7523e
 lib/ns-pkcs11/Makefile.in        | 26 ++++++++++-----------
b7523e
 lib/ns-pkcs11/tests/Makefile.in  | 12 +++++-----
b7523e
 make/includes.in                 |  7 ++++++
b7523e
 11 files changed, 101 insertions(+), 71 deletions(-)
b7523e
b7523e
diff --git a/bin/Makefile.in b/bin/Makefile.in
b7523e
index 9ad7f62..094775a 100644
b7523e
--- a/bin/Makefile.in
b7523e
+++ b/bin/Makefile.in
b7523e
@@ -11,7 +11,7 @@ srcdir =	@srcdir@
b7523e
 VPATH =		@srcdir@
b7523e
 top_srcdir =	@top_srcdir@
b7523e
 
b7523e
-SUBDIRS =	named rndc dig delv dnssec tools nsupdate check confgen \
b7523e
+SUBDIRS =	named named-pkcs11 rndc dig delv dnssec dnssec-pkcs11 tools nsupdate check confgen \
b7523e
 		@NZD_TOOLS@ @PYTHON_TOOLS@ @PKCS11_TOOLS@ plugins tests
b7523e
 TARGETS =
b7523e
 
b7523e
diff --git a/bin/confgen/Makefile.in b/bin/confgen/Makefile.in
b7523e
index c126bf3..1b7512d 100644
b7523e
--- a/bin/confgen/Makefile.in
b7523e
+++ b/bin/confgen/Makefile.in
b7523e
@@ -22,7 +22,7 @@ VERSION=@BIND9_VERSION@
b7523e
 CINCLUDES = -I${srcdir}/include ${ISC_INCLUDES} ${ISCCC_INCLUDES} \
b7523e
 	${ISCCFG_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES}
b7523e
 
b7523e
-CDEFINES = @USE_PKCS11@
b7523e
+CDEFINES =
b7523e
 CWARNINGS =
b7523e
 
b7523e
 ISCCFGLIBS =	../../lib/isccfg/libisccfg.@A@
b7523e
diff --git a/bin/dnssec-pkcs11/Makefile.in b/bin/dnssec-pkcs11/Makefile.in
b7523e
index ace0e5a..e0f6a00 100644
b7523e
--- a/bin/dnssec-pkcs11/Makefile.in
b7523e
+++ b/bin/dnssec-pkcs11/Makefile.in
b7523e
@@ -15,18 +15,18 @@ VERSION=@BIND9_VERSION@
b7523e
 
b7523e
 @BIND9_MAKE_INCLUDES@
b7523e
 
b7523e
-CINCLUDES =	${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \
b7523e
+CINCLUDES =	${DNS_PKCS11_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \
b7523e
 		${OPENSSL_CFLAGS}
b7523e
 
b7523e
-CDEFINES =	-DVERSION=\"${VERSION}\" -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
b7523e
+CDEFINES =	-DVERSION=\"${VERSION}\" -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\" -DUSE_PKCS11=1
b7523e
 CWARNINGS =
b7523e
 
b7523e
-DNSLIBS =	../../lib/dns/libdns.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
+DNSLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
 ISCCFGLIBS =	../../lib/isccfg/libisccfg.@A@
b7523e
 ISCLIBS =	../../lib/isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
b7523e
 ISCNOSYMLIBS =	../../lib/isc/libisc-nosymtbl.@A@ @NO_LIBTOOL_ISCLIBS@
b7523e
 
b7523e
-DNSDEPLIBS =	../../lib/dns/libdns.@A@
b7523e
+DNSDEPLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@
b7523e
 ISCDEPLIBS =	../../lib/isc/libisc.@A@
b7523e
 ISCCFGDEPLIBS =	../../lib/isccfg/libisccfg.@A@
b7523e
 
b7523e
@@ -36,12 +36,15 @@ LIBS =		${DNSLIBS} ${ISCCFGLIBS} ${ISCLIBS} @LIBS@
b7523e
 
b7523e
 NOSYMLIBS =	${DNSLIBS} ${ISCCFGLIBS} ${ISCNOSYMLIBS} @LIBS@
b7523e
 
b7523e
+# Add suffix to all targets
b7523e
+EXEEXT =	-pkcs11@EXEEXT@
b7523e
+
b7523e
 # Alphabetically
b7523e
-TARGETS =	dnssec-cds@EXEEXT@ dnssec-dsfromkey@EXEEXT@ \
b7523e
-		dnssec-importkey@EXEEXT@ dnssec-keyfromlabel@EXEEXT@ \
b7523e
-		dnssec-keygen@EXEEXT@ dnssec-revoke@EXEEXT@ \
b7523e
-		dnssec-settime@EXEEXT@ dnssec-signzone@EXEEXT@ \
b7523e
-		dnssec-verify@EXEEXT@
b7523e
+TARGETS =	dnssec-cds${EXEEXT} dnssec-dsfromkey${EXEEXT} \
b7523e
+		dnssec-importkey${EXEEXT} dnssec-keyfromlabel${EXEEXT} \
b7523e
+		dnssec-keygen${EXEEXT} dnssec-revoke${EXEEXT} \
b7523e
+		dnssec-settime${EXEEXT} dnssec-signzone${EXEEXT} \
b7523e
+		dnssec-verify${EXEEXT}
b7523e
 
b7523e
 OBJS =		dnssectool.@O@
b7523e
 
b7523e
@@ -52,19 +55,19 @@ SRCS =		dnssec-cds.c dnssec-dsfromkey.c dnssec-importkey.c \
b7523e
 
b7523e
 @BIND9_MAKE_RULES@
b7523e
 
b7523e
-dnssec-cds@EXEEXT@: dnssec-cds.@O@ ${OBJS} ${DEPLIBS}
b7523e
+dnssec-cds-pkcs11@EXEEXT@: dnssec-cds.@O@ ${OBJS} ${DEPLIBS}
b7523e
 	export BASEOBJS="dnssec-cds.@O@ ${OBJS}"; \
b7523e
 	${FINALBUILDCMD}
b7523e
 
b7523e
-dnssec-dsfromkey@EXEEXT@: dnssec-dsfromkey.@O@ ${OBJS} ${DEPLIBS}
b7523e
+dnssec-dsfromkey-pkcs11@EXEEXT@: dnssec-dsfromkey.@O@ ${OBJS} ${DEPLIBS}
b7523e
 	export BASEOBJS="dnssec-dsfromkey.@O@ ${OBJS}"; \
b7523e
 	${FINALBUILDCMD}
b7523e
 
b7523e
-dnssec-keyfromlabel@EXEEXT@: dnssec-keyfromlabel.@O@ ${OBJS} ${DEPLIBS}
b7523e
+dnssec-keyfromlabel-pkcs11@EXEEXT@: dnssec-keyfromlabel.@O@ ${OBJS} ${DEPLIBS}
b7523e
 	export BASEOBJS="dnssec-keyfromlabel.@O@ ${OBJS}"; \
b7523e
 	${FINALBUILDCMD}
b7523e
 
b7523e
-dnssec-keygen@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS}
b7523e
+dnssec-keygen-pkcs11@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS}
b7523e
 	export BASEOBJS="dnssec-keygen.@O@ ${OBJS}"; \
b7523e
 	${FINALBUILDCMD}
b7523e
 
b7523e
@@ -72,7 +75,7 @@ dnssec-signzone.@O@: dnssec-signzone.c
b7523e
 	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
b7523e
 		-c ${srcdir}/dnssec-signzone.c
b7523e
 
b7523e
-dnssec-signzone@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS}
b7523e
+dnssec-signzone-pkcs11@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS}
b7523e
 	export BASEOBJS="dnssec-signzone.@O@ ${OBJS}"; \
b7523e
 	${FINALBUILDCMD}
b7523e
 
b7523e
@@ -80,19 +83,19 @@ dnssec-verify.@O@: dnssec-verify.c
b7523e
 	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
b7523e
 		-c ${srcdir}/dnssec-verify.c
b7523e
 
b7523e
-dnssec-verify@EXEEXT@: dnssec-verify.@O@ ${OBJS} ${DEPLIBS}
b7523e
+dnssec-verify-pkcs11@EXEEXT@: dnssec-verify.@O@ ${OBJS} ${DEPLIBS}
b7523e
 	export BASEOBJS="dnssec-verify.@O@ ${OBJS}"; \
b7523e
 	${FINALBUILDCMD}
b7523e
 
b7523e
-dnssec-revoke@EXEEXT@: dnssec-revoke.@O@ ${OBJS} ${DEPLIBS}
b7523e
+dnssec-revoke-pkcs11@EXEEXT@: dnssec-revoke.@O@ ${OBJS} ${DEPLIBS}
b7523e
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
b7523e
 	dnssec-revoke.@O@ ${OBJS} ${LIBS}
b7523e
 
b7523e
-dnssec-settime@EXEEXT@: dnssec-settime.@O@ ${OBJS} ${DEPLIBS}
b7523e
+dnssec-settime-pkcs11@EXEEXT@: dnssec-settime.@O@ ${OBJS} ${DEPLIBS}
b7523e
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
b7523e
 	dnssec-settime.@O@ ${OBJS} ${LIBS}
b7523e
 
b7523e
-dnssec-importkey@EXEEXT@: dnssec-importkey.@O@ ${OBJS} ${DEPLIBS}
b7523e
+dnssec-importkey-pkcs11@EXEEXT@: dnssec-importkey.@O@ ${OBJS} ${DEPLIBS}
b7523e
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
b7523e
 	dnssec-importkey.@O@ ${OBJS} ${LIBS}
b7523e
 
b7523e
diff --git a/bin/named-pkcs11/Makefile.in b/bin/named-pkcs11/Makefile.in
b7523e
index 98125dd..518a75f 100644
b7523e
--- a/bin/named-pkcs11/Makefile.in
b7523e
+++ b/bin/named-pkcs11/Makefile.in
b7523e
@@ -37,13 +37,14 @@ DBDRIVER_LIBS =
b7523e
 
b7523e
 DLZ_DRIVER_DIR =	${top_srcdir}/contrib/dlz/drivers
b7523e
 
b7523e
-DLZDRIVER_OBJS =	@DLZ_DRIVER_OBJS@
b7523e
-DLZDRIVER_SRCS =	@DLZ_DRIVER_SRCS@
b7523e
-DLZDRIVER_INCLUDES =	@DLZ_DRIVER_INCLUDES@
b7523e
-DLZDRIVER_LIBS =	@DLZ_DRIVER_LIBS@
b7523e
+# Skip building on PKCS11 variant
b7523e
+DLZDRIVER_OBJS =
b7523e
+DLZDRIVER_SRCS =
b7523e
+DLZDRIVER_INCLUDES =
b7523e
+DLZDRIVER_LIBS =
b7523e
 
b7523e
 CINCLUDES =	-I${srcdir}/include -I${srcdir}/unix/include -I. \
b7523e
-		${NS_INCLUDES} ${DNS_INCLUDES} \
b7523e
+		${NS_PKCS11_INCLUDES} ${DNS_PKCS11_INCLUDES} \
b7523e
 		${BIND9_INCLUDES} ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} \
b7523e
 		${ISC_INCLUDES} ${DLZDRIVER_INCLUDES} \
b7523e
 		${DBDRIVER_INCLUDES} \
b7523e
@@ -56,24 +57,24 @@ CINCLUDES =	-I${srcdir}/include -I${srcdir}/unix/include -I. \
b7523e
 		${LIBXML2_CFLAGS} \
b7523e
 		${MAXMINDDB_CFLAGS}
b7523e
 
b7523e
-CDEFINES =      @CONTRIB_DLZ@
b7523e
+CDEFINES =
b7523e
 
b7523e
 CWARNINGS =
b7523e
 
b7523e
-DNSLIBS =	../../lib/dns/libdns.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
+DNSLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
 ISCCFGLIBS =	../../lib/isccfg/libisccfg.@A@
b7523e
 ISCCCLIBS =	../../lib/isccc/libisccc.@A@
b7523e
 ISCLIBS =	../../lib/isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
b7523e
 ISCNOSYMLIBS =	../../lib/isc/libisc-nosymtbl.@A@ @NO_LIBTOOL_ISCLIBS@
b7523e
 BIND9LIBS =	../../lib/bind9/libbind9.@A@
b7523e
-NSLIBS =	../../lib/ns/libns.@A@
b7523e
+NSLIBS =	../../lib/ns-pkcs11/libns-pkcs11.@A@
b7523e
 
b7523e
-DNSDEPLIBS =	../../lib/dns/libdns.@A@
b7523e
+DNSDEPLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@
b7523e
 ISCCFGDEPLIBS =	../../lib/isccfg/libisccfg.@A@
b7523e
 ISCCCDEPLIBS =	../../lib/isccc/libisccc.@A@
b7523e
 ISCDEPLIBS =	../../lib/isc/libisc.@A@
b7523e
 BIND9DEPLIBS =	../../lib/bind9/libbind9.@A@
b7523e
-NSDEPLIBS =	../../lib/ns/libns.@A@
b7523e
+NSDEPLIBS =	../../lib/ns-pkcs11/libns-pkcs11.@A@
b7523e
 
b7523e
 DEPLIBS =	${NSDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
b7523e
 		${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS}
b7523e
@@ -93,7 +94,7 @@ NOSYMLIBS =	${NSLIBS} ${DNSLIBS} ${BIND9LIBS} \
b7523e
 
b7523e
 SUBDIRS =	unix
b7523e
 
b7523e
-TARGETS =	named@EXEEXT@ feature-test@EXEEXT@
b7523e
+TARGETS =	named-pkcs11@EXEEXT@ feature-test-pkcs11@EXEEXT@
b7523e
 
b7523e
 GEOIP2LINKOBJS = geoip.@O@
b7523e
 
b7523e
@@ -151,7 +152,7 @@ server.@O@: server.c
b7523e
 		-DPRODUCT=\"${PRODUCT}\" \
b7523e
 		-DVERSION=\"${VERSION}\" -c ${srcdir}/server.c
b7523e
 
b7523e
-named@EXEEXT@: ${OBJS} ${DEPLIBS}
b7523e
+named-pkcs11@EXEEXT@: ${OBJS} ${DEPLIBS}
b7523e
 	export MAKE_SYMTABLE="yes"; \
b7523e
 	export BASEOBJS="${OBJS} ${UOBJS}"; \
b7523e
 	${FINALBUILDCMD}
b7523e
@@ -161,7 +162,7 @@ feature-test.@O@: ${top_srcdir}/bin/tests/system/feature-test.c
b7523e
 	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
b7523e
 		-c ${top_srcdir}/bin/tests/system/feature-test.c
b7523e
 
b7523e
-feature-test@EXEEXT@: feature-test.@O@
b7523e
+feature-test-pkcs11@EXEEXT@: feature-test.@O@
b7523e
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
b7523e
 		-o $@ feature-test.@O@ ${ISCLIBS} ${LIBS}
b7523e
 
b7523e
@@ -180,11 +181,11 @@ statschannel.@O@: bind9.xsl.h
b7523e
 installdirs:
b7523e
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
b7523e
 
b7523e
-install:: named@EXEEXT@ installdirs
b7523e
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named@EXEEXT@ ${DESTDIR}${sbindir}
b7523e
+install:: named-pkcs11@EXEEXT@ installdirs
b7523e
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-pkcs11@EXEEXT@ ${DESTDIR}${sbindir}
b7523e
 
b7523e
 uninstall::
b7523e
-	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named@EXEEXT@
b7523e
+	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named-pkcs11@EXEEXT@
b7523e
 
b7523e
 @DLZ_DRIVER_RULES@
b7523e
 
b7523e
diff --git a/configure.ac b/configure.ac
b7523e
index 032228b..64e3da0 100644
b7523e
--- a/configure.ac
b7523e
+++ b/configure.ac
b7523e
@@ -1251,12 +1251,14 @@ AC_SUBST(USE_GSSAPI)
b7523e
 AC_SUBST(DST_GSSAPI_INC)
b7523e
 AC_SUBST(DNS_GSSAPI_LIBS)
b7523e
 DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS"
b7523e
+DNS_CRYPTO_PK11_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_PK11_LIBS"
b7523e
 
b7523e
 #
b7523e
 # Applications linking with libdns also need to link with these libraries.
b7523e
 #
b7523e
 
b7523e
 AC_SUBST(DNS_CRYPTO_LIBS)
b7523e
+AC_SUBST(DNS_CRYPTO_PK11_LIBS)
b7523e
 
b7523e
 #
b7523e
 # was --with-lmdb specified?
b7523e
@@ -2327,6 +2329,8 @@ AC_SUBST(BIND9_DNS_BUILDINCLUDE)
b7523e
 AC_SUBST(BIND9_NS_BUILDINCLUDE)
b7523e
 AC_SUBST(BIND9_BIND9_BUILDINCLUDE)
b7523e
 AC_SUBST(BIND9_IRS_BUILDINCLUDE)
b7523e
+AC_SUBST(BIND9_DNS_PKCS11_BUILDINCLUDE)
b7523e
+AC_SUBST(BIND9_NS_PKCS11_BUILDINCLUDE)
b7523e
 if test "X$srcdir" != "X"; then
b7523e
 	BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include"
b7523e
 	BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include"
b7523e
@@ -2335,6 +2339,8 @@ if test "X$srcdir" != "X"; then
b7523e
 	BIND9_NS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/ns/include"
b7523e
 	BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include"
b7523e
 	BIND9_IRS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/irs/include"
b7523e
+	BIND9_DNS_PKCS11_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns-pkcs11/include"
b7523e
+	BIND9_NS_PKCS11_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/ns-pkcs11/include"
b7523e
 else
b7523e
 	BIND9_ISC_BUILDINCLUDE=""
b7523e
 	BIND9_ISCCC_BUILDINCLUDE=""
b7523e
@@ -2343,6 +2349,8 @@ else
b7523e
 	BIND9_NS_BUILDINCLUDE=""
b7523e
 	BIND9_BIND9_BUILDINCLUDE=""
b7523e
 	BIND9_IRS_BUILDINCLUDE=""
b7523e
+	BIND9_DNS_PKCS11_BUILDINCLUDE=""
b7523e
+	BIND9_NS_PKCS11_BUILDINCLUDE=""
b7523e
 fi
b7523e
 
b7523e
 AC_SUBST_FILE(BIND9_MAKE_INCLUDES)
b7523e
@@ -2798,8 +2806,11 @@ AC_CONFIG_FILES([
b7523e
 	bin/delv/Makefile
b7523e
 	bin/dig/Makefile
b7523e
 	bin/dnssec/Makefile
b7523e
+	bin/dnssec-pkcs11/Makefile
b7523e
 	bin/named/Makefile
b7523e
 	bin/named/unix/Makefile
b7523e
+	bin/named-pkcs11/Makefile
b7523e
+	bin/named-pkcs11/unix/Makefile
b7523e
 	bin/nsupdate/Makefile
b7523e
 	bin/pkcs11/Makefile
b7523e
 	bin/plugins/Makefile
b7523e
@@ -2861,6 +2872,10 @@ AC_CONFIG_FILES([
b7523e
 	lib/dns/include/dns/Makefile
b7523e
 	lib/dns/include/dst/Makefile
b7523e
 	lib/dns/tests/Makefile
b7523e
+	lib/dns-pkcs11/Makefile
b7523e
+	lib/dns-pkcs11/include/Makefile
b7523e
+	lib/dns-pkcs11/include/dns/Makefile
b7523e
+	lib/dns-pkcs11/include/dst/Makefile
b7523e
 	lib/irs/Makefile
b7523e
 	lib/irs/include/Makefile
b7523e
 	lib/irs/include/irs/Makefile
b7523e
@@ -2893,6 +2908,10 @@ AC_CONFIG_FILES([
b7523e
 	lib/ns/include/Makefile
b7523e
 	lib/ns/include/ns/Makefile
b7523e
 	lib/ns/tests/Makefile
b7523e
+	lib/ns-pkcs11/Makefile
b7523e
+	lib/ns-pkcs11/include/Makefile
b7523e
+	lib/ns-pkcs11/include/ns/Makefile
b7523e
+	lib/ns-pkcs11/tests/Makefile
b7523e
 	make/Makefile
b7523e
 	make/mkdep
b7523e
 	unit/unittest.sh
b7523e
diff --git a/lib/Makefile.in b/lib/Makefile.in
b7523e
index 833964e..058ba2f 100644
b7523e
--- a/lib/Makefile.in
b7523e
+++ b/lib/Makefile.in
b7523e
@@ -15,7 +15,7 @@ top_srcdir =	@top_srcdir@
b7523e
 # Attempt to disable parallel processing.
b7523e
 .NOTPARALLEL:
b7523e
 .NO_PARALLEL:
b7523e
-SUBDIRS =	isc isccc dns ns isccfg bind9 irs
b7523e
+SUBDIRS =	isc isccc dns dns-pkcs11 ns ns-pkcs11 isccfg bind9 irs
b7523e
 TARGETS =
b7523e
 
b7523e
 @BIND9_MAKE_RULES@
b7523e
diff --git a/lib/dns-pkcs11/Makefile.in b/lib/dns-pkcs11/Makefile.in
b7523e
index 58bda3c..d6a45df 100644
b7523e
--- a/lib/dns-pkcs11/Makefile.in
b7523e
+++ b/lib/dns-pkcs11/Makefile.in
b7523e
@@ -22,7 +22,7 @@ VERSION=@BIND9_VERSION@
b7523e
 
b7523e
 @BIND9_MAKE_INCLUDES@
b7523e
 
b7523e
-CINCLUDES =	-I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} \
b7523e
+CINCLUDES =	-I. -I${top_srcdir}/lib/dns-pkcs11 -Iinclude ${DNS_PKCS11_INCLUDES} \
b7523e
 		${ISC_INCLUDES} \
b7523e
 		${FSTRM_CFLAGS} \
b7523e
 		${OPENSSL_CFLAGS} @DST_GSSAPI_INC@ \
b7523e
@@ -32,7 +32,7 @@ CINCLUDES =	-I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} \
b7523e
 		${LMDB_CFLAGS} \
b7523e
 		${MAXMINDDB_CFLAGS}
b7523e
 
b7523e
-CDEFINES =	@USE_GSSAPI@
b7523e
+CDEFINES =	@USE_GSSAPI@ @USE_PKCS11@
b7523e
 
b7523e
 CWARNINGS =
b7523e
 
b7523e
@@ -135,15 +135,15 @@ version.@O@: version.c
b7523e
 		-DMAPAPI=\"${MAPAPI}\" \
b7523e
 		-c ${srcdir}/version.c
b7523e
 
b7523e
-libdns.@SA@: ${OBJS}
b7523e
+libdns-pkcs11.@SA@: ${OBJS}
b7523e
 	${AR} ${ARFLAGS} $@ ${OBJS}
b7523e
 	${RANLIB} $@
b7523e
 
b7523e
-libdns.la: ${OBJS}
b7523e
+libdns-pkcs11.la: ${OBJS}
b7523e
 	${LIBTOOL_MODE_LINK} \
b7523e
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns.la -rpath ${libdir} \
b7523e
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns-pkcs11.la -rpath ${libdir} \
b7523e
 		-release "${VERSION}" \
b7523e
-		${OBJS} ${ISCLIBS} @DNS_CRYPTO_LIBS@ ${LIBS}
b7523e
+		${OBJS} ${ISCLIBS} @DNS_CRYPTO_PK11_LIBS@ ${LIBS}
b7523e
 
b7523e
 include: gen
b7523e
 	${MAKE} include/dns/enumtype.h
b7523e
@@ -174,22 +174,22 @@ gen: gen.c
b7523e
 	${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c \
b7523e
 	${BUILD_LIBS} ${LFS_LIBS}
b7523e
 
b7523e
-timestamp: include libdns.@A@
b7523e
+timestamp: include libdns-pkcs11.@A@
b7523e
 	touch timestamp
b7523e
 
b7523e
-testdirs: libdns.@A@
b7523e
+testdirs: libdns-pkcs11.@A@
b7523e
 
b7523e
 installdirs:
b7523e
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
b7523e
 
b7523e
 install:: timestamp installdirs
b7523e
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libdns.@A@ ${DESTDIR}${libdir}
b7523e
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libdns-pkcs11.@A@ ${DESTDIR}${libdir}
b7523e
 
b7523e
 uninstall::
b7523e
-	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libdns.@A@
b7523e
+	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libdns-pkcs11.@A@
b7523e
 
b7523e
 clean distclean::
b7523e
-	rm -f libdns.@A@ timestamp
b7523e
+	rm -f libdns-pkcs11.@A@ timestamp
b7523e
 	rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h
b7523e
 	rm -f include/dns/rdatastruct.h
b7523e
 	rm -f dnstap.pb-c.c dnstap.pb-c.h
b7523e
diff --git a/lib/dns-pkcs11/tests/Makefile.in b/lib/dns-pkcs11/tests/Makefile.in
b7523e
index 3bb5e01..c96fe7d 100644
b7523e
--- a/lib/dns-pkcs11/tests/Makefile.in
b7523e
+++ b/lib/dns-pkcs11/tests/Makefile.in
b7523e
@@ -15,15 +15,15 @@ VERSION=@BIND9_VERSION@
b7523e
 
b7523e
 @BIND9_MAKE_INCLUDES@
b7523e
 
b7523e
-CINCLUDES =	-I. -Iinclude ${DNS_INCLUDES} ${ISC_INCLUDES} \
b7523e
+CINCLUDES =	-I. -Iinclude ${DNS_PKCS11_INCLUDES} ${ISC_INCLUDES} \
b7523e
 		${FSTRM_CFLAGS} ${OPENSSL_CFLAGS} \
b7523e
 		${PROTOBUF_C_CFLAGS} ${MAXMINDDB_CFLAGS} @CMOCKA_CFLAGS@
b7523e
-CDEFINES =	-DTESTS="\"${top_builddir}/lib/dns/tests/\""
b7523e
+CDEFINES =	@USE_PKCS11@ -DTESTS="\"${top_builddir}/lib/dns-pkcs11/tests/\""
b7523e
 
b7523e
 ISCLIBS =	../../isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
b7523e
 ISCDEPLIBS =	../../isc/libisc.@A@
b7523e
-DNSLIBS =	../libdns.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
-DNSDEPLIBS =	../libdns.@A@
b7523e
+DNSLIBS =	../libdns-pkcs11.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
+DNSDEPLIBS =	../libdns-pkcs11.@A@
b7523e
 
b7523e
 LIBS =		@LIBS@ @CMOCKA_LIBS@
b7523e
 
b7523e
diff --git a/lib/ns-pkcs11/Makefile.in b/lib/ns-pkcs11/Makefile.in
b7523e
index bc683ce..7a9d2f2 100644
b7523e
--- a/lib/ns-pkcs11/Makefile.in
b7523e
+++ b/lib/ns-pkcs11/Makefile.in
b7523e
@@ -16,12 +16,12 @@ VERSION=@BIND9_VERSION@
b7523e
 
b7523e
 @BIND9_MAKE_INCLUDES@
b7523e
 
b7523e
-CINCLUDES =	-I. -I${top_srcdir}/lib/ns -Iinclude \
b7523e
-		${NS_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \
b7523e
+CINCLUDES =	-I. -I${top_srcdir}/lib/ns-pkcs11 -Iinclude \
b7523e
+		${NS_PKCS11_INCLUDES} ${DNS_PKCS11_INCLUDES} ${ISC_INCLUDES} \
b7523e
 		${OPENSSL_CFLAGS} @DST_GSSAPI_INC@ \
b7523e
 		${FSTRM_CFLAGS}
b7523e
 
b7523e
-CDEFINES =	-DNAMED_PLUGINDIR=\"${plugindir}\"
b7523e
+CDEFINES =	@USE_PKCS11@ -DNAMED_PLUGINDIR=\"${plugindir}\"
b7523e
 
b7523e
 CWARNINGS =
b7523e
 
b7523e
@@ -29,9 +29,9 @@ ISCLIBS =	../../lib/isc/libisc.@A@
b7523e
 
b7523e
 ISCDEPLIBS =	../../lib/isc/libisc.@A@
b7523e
 
b7523e
-DNSLIBS =	../../lib/dns/libdns.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
+DNSLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
 
b7523e
-DNSDEPLIBS =	../../lib/dns/libdns.@A@
b7523e
+DNSDEPLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@
b7523e
 
b7523e
 LIBS =		@LIBS@
b7523e
 
b7523e
@@ -60,28 +60,28 @@ version.@O@: version.c
b7523e
 		-DMAJOR=\"${MAJOR}\" \
b7523e
 		-c ${srcdir}/version.c
b7523e
 
b7523e
-libns.@SA@: ${OBJS}
b7523e
+libns-pkcs11.@SA@: ${OBJS}
b7523e
 	${AR} ${ARFLAGS} $@ ${OBJS}
b7523e
 	${RANLIB} $@
b7523e
 
b7523e
-libns.la: ${OBJS}
b7523e
+libns-pkcs11.la: ${OBJS}
b7523e
 	${LIBTOOL_MODE_LINK} \
b7523e
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libns.la -rpath ${libdir} \
b7523e
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libns-pkcs11.la -rpath ${libdir} \
b7523e
 		-release "${VERSION}" \
b7523e
-		${OBJS} ${ISCLIBS} ${DNSLIBS} @DNS_CRYPTO_LIBS@ ${LIBS}
b7523e
+		${OBJS} ${ISCLIBS} ${DNSLIBS} @DNS_CRYPTO_PK11_LIBS@ ${LIBS}
b7523e
 
b7523e
-timestamp: libns.@A@
b7523e
+timestamp: libns-pkcs11.@A@
b7523e
 	touch timestamp
b7523e
 
b7523e
 installdirs:
b7523e
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
b7523e
 
b7523e
 install:: timestamp installdirs
b7523e
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libns.@A@ \
b7523e
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libns-pkcs11.@A@ \
b7523e
 		${DESTDIR}${libdir}
b7523e
 
b7523e
 uninstall::
b7523e
-	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libns.@A@
b7523e
+	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libns-pkcs11.@A@
b7523e
 
b7523e
 clean distclean::
b7523e
-	rm -f libns.@A@ timestamp
b7523e
+	rm -f libns-pkcs11.@A@ timestamp
b7523e
diff --git a/lib/ns-pkcs11/tests/Makefile.in b/lib/ns-pkcs11/tests/Makefile.in
b7523e
index 4c3e694..c1b6d99 100644
b7523e
--- a/lib/ns-pkcs11/tests/Makefile.in
b7523e
+++ b/lib/ns-pkcs11/tests/Makefile.in
b7523e
@@ -17,17 +17,17 @@ VERSION=@BIND9_VERSION@
b7523e
 
b7523e
 WRAP_OPTIONS =	-Wl,--wrap=isc__nmhandle_detach -Wl,--wrap=isc__nmhandle_attach
b7523e
 
b7523e
-CINCLUDES =	-I. -Iinclude ${NS_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \
b7523e
+CINCLUDES =	-I. -Iinclude ${NS_PKCS11_INCLUDES} ${DNS_PKCS11_INCLUDES} ${ISC_INCLUDES} \
b7523e
 		${OPENSSL_CFLAGS} \
b7523e
 		@CMOCKA_CFLAGS@
b7523e
-CDEFINES =	-DTESTS="\"${top_builddir}/lib/ns/tests/\"" -DNAMED_PLUGINDIR=\"${plugindir}\"
b7523e
+CDEFINES =	-DTESTS="\"${top_builddir}/lib/ns-pkcs11/tests/\"" -DNAMED_PLUGINDIR=\"${plugindir}\" @USE_PKCS11@
b7523e
 
b7523e
 ISCLIBS =	../../isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
b7523e
 ISCDEPLIBS =	../../isc/libisc.@A@
b7523e
-DNSLIBS =	../../dns/libdns.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
-DNSDEPLIBS =	../../dns/libdns.@A@
b7523e
-NSLIBS =	../libns.@A@
b7523e
-NSDEPLIBS =	../libns.@A@
b7523e
+DNSLIBS =	../../dns-pkcs11/libdns-pkcs11.@A@ @NO_LIBTOOL_DNSLIBS@
b7523e
+DNSDEPLIBS =	../../dns-pkcs11/libdns-pkcs11.@A@
b7523e
+NSLIBS =	../libns-pkcs11.@A@
b7523e
+NSDEPLIBS =	../libns-pkcs11.@A@
b7523e
 
b7523e
 LIBS =		@LIBS@ @CMOCKA_LIBS@
b7523e
 
b7523e
diff --git a/make/includes.in b/make/includes.in
b7523e
index b8317d3..b73b0c4 100644
b7523e
--- a/make/includes.in
b7523e
+++ b/make/includes.in
b7523e
@@ -39,3 +39,10 @@ BIND9_INCLUDES = @BIND9_BIND9_BUILDINCLUDE@ \
b7523e
 
b7523e
 TEST_INCLUDES = \
b7523e
 	-I${top_srcdir}/lib/tests/include
b7523e
+
b7523e
+DNS_PKCS11_INCLUDES = @BIND9_DNS_PKCS11_BUILDINCLUDE@ \
b7523e
+	-I${top_srcdir}/lib/dns-pkcs11/include
b7523e
+
b7523e
+NS_PKCS11_INCLUDES = @BIND9_NS_PKCS11_BUILDINCLUDE@ \
b7523e
+	-I${top_srcdir}/lib/ns-pkcs11/include
b7523e
+
b7523e
-- 
b7523e
2.26.3
b7523e