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