dce2d1b
diff --git a/bin/Makefile.in b/bin/Makefile.in
102df25
index f3cbed3..7d21984 100644
dce2d1b
--- a/bin/Makefile.in
dce2d1b
+++ b/bin/Makefile.in
Michal Ruprich d886cd0
@@ -10,7 +10,7 @@ srcdir =	@srcdir@
dce2d1b
 VPATH =		@srcdir@
dce2d1b
 top_srcdir =	@top_srcdir@
dce2d1b
 
4fa9972
-SUBDIRS =	named rndc dig delv dnssec tools tests nsupdate \
4fa9972
+SUBDIRS =	named named-pkcs11 rndc dig delv dnssec dnssec-pkcs11 tools tests nsupdate \
Michal Ruprich d886cd0
 		check confgen @NZD_TOOLS@ @PYTHON_TOOLS@ @PKCS11_TOOLS@
dce2d1b
 TARGETS =
dce2d1b
 
dce2d1b
diff --git a/bin/dnssec-pkcs11/Makefile.in b/bin/dnssec-pkcs11/Makefile.in
102df25
index 8c6627a..0427349 100644
dce2d1b
--- a/bin/dnssec-pkcs11/Makefile.in
dce2d1b
+++ b/bin/dnssec-pkcs11/Makefile.in
102df25
@@ -14,18 +14,18 @@ VERSION=@BIND9_VERSION@
dce2d1b
 
dce2d1b
 @BIND9_MAKE_INCLUDES@
dce2d1b
 
102df25
-CINCLUDES =	${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@
dce2d1b
+CINCLUDES =	${DNS_PKCS11_INCLUDES} ${ISC_PKCS11_INCLUDES}
dce2d1b
 
dce2d1b
 CDEFINES =	-DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \
dce2d1b
-		@CRYPTO@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\"
dce2d1b
+		@CRYPTO_PK11@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\"
dce2d1b
 CWARNINGS =
dce2d1b
 
dce2d1b
-DNSLIBS =	../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
dce2d1b
-ISCLIBS =	../../lib/isc/libisc.@A@
dce2d1b
-ISCNOSYMLIBS =	../../lib/isc/libisc-nosymtbl.@A@
4fa9972
+DNSLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@ @DNS_CRYPTO_LIBS@
dce2d1b
+ISCLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
dce2d1b
+ISCNOSYMLIBS =	../../lib/isc-pkcs11/libisc-pkcs11-nosymtbl.@A@
dce2d1b
 
dce2d1b
-DNSDEPLIBS =	../../lib/dns/libdns.@A@
dce2d1b
-ISCDEPLIBS =	../../lib/isc/libisc.@A@
dce2d1b
+DNSDEPLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@
dce2d1b
+ISCDEPLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
dce2d1b
 
dce2d1b
 DEPLIBS =	${DNSDEPLIBS} ${ISCDEPLIBS}
dce2d1b
 
102df25
@@ -34,10 +34,10 @@ LIBS =		${DNSLIBS} ${ISCLIBS} @LIBS@
dce2d1b
 NOSYMLIBS =	${DNSLIBS} ${ISCNOSYMLIBS} @LIBS@
dce2d1b
 
dce2d1b
 # Alphabetically
dce2d1b
-TARGETS =	dnssec-keygen@EXEEXT@ dnssec-signzone@EXEEXT@ \
dce2d1b
-		dnssec-keyfromlabel@EXEEXT@ dnssec-dsfromkey@EXEEXT@ \
dce2d1b
-		dnssec-revoke@EXEEXT@ dnssec-settime@EXEEXT@ \
dce2d1b
-		dnssec-verify@EXEEXT@ dnssec-importkey@EXEEXT@
dce2d1b
+TARGETS =	dnssec-keygen-pkcs11@EXEEXT@ dnssec-signzone-pkcs11@EXEEXT@ \
dce2d1b
+		dnssec-keyfromlabel-pkcs11@EXEEXT@ dnssec-dsfromkey-pkcs11@EXEEXT@ \
dce2d1b
+		dnssec-revoke-pkcs11@EXEEXT@ dnssec-settime-pkcs11@EXEEXT@ \
dce2d1b
+		dnssec-verify-pkcs11@EXEEXT@ dnssec-importkey-pkcs11@EXEEXT@
dce2d1b
 
dce2d1b
 OBJS =		dnssectool.@O@
dce2d1b
 
102df25
@@ -58,15 +58,15 @@ MANOBJS =	${MANPAGES} ${HTMLPAGES}
dce2d1b
 
dce2d1b
 @BIND9_MAKE_RULES@
dce2d1b
 
dce2d1b
-dnssec-dsfromkey@EXEEXT@: dnssec-dsfromkey.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
+dnssec-dsfromkey-pkcs11@EXEEXT@: dnssec-dsfromkey.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
 	export BASEOBJS="dnssec-dsfromkey.@O@ ${OBJS}"; \
dce2d1b
 	${FINALBUILDCMD}
dce2d1b
 
dce2d1b
-dnssec-keyfromlabel@EXEEXT@: dnssec-keyfromlabel.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
+dnssec-keyfromlabel-pkcs11@EXEEXT@: dnssec-keyfromlabel.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
 	export BASEOBJS="dnssec-keyfromlabel.@O@ ${OBJS}"; \
dce2d1b
 	${FINALBUILDCMD}
dce2d1b
 
dce2d1b
-dnssec-keygen@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
+dnssec-keygen-pkcs11@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
 	export BASEOBJS="dnssec-keygen.@O@ ${OBJS}"; \
dce2d1b
 	${FINALBUILDCMD}
dce2d1b
 
102df25
@@ -74,7 +74,7 @@ dnssec-signzone.@O@: dnssec-signzone.c
dce2d1b
 	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
dce2d1b
 		-c ${srcdir}/dnssec-signzone.c
dce2d1b
 
dce2d1b
-dnssec-signzone@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
+dnssec-signzone-pkcs11@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
 	export BASEOBJS="dnssec-signzone.@O@ ${OBJS}"; \
dce2d1b
 	${FINALBUILDCMD}
dce2d1b
 
102df25
@@ -82,19 +82,19 @@ dnssec-verify.@O@: dnssec-verify.c
dce2d1b
 	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
dce2d1b
 		-c ${srcdir}/dnssec-verify.c
dce2d1b
 
dce2d1b
-dnssec-verify@EXEEXT@: dnssec-verify.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
+dnssec-verify-pkcs11@EXEEXT@: dnssec-verify.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
 	export BASEOBJS="dnssec-verify.@O@ ${OBJS}"; \
dce2d1b
 	${FINALBUILDCMD}
dce2d1b
 
dce2d1b
-dnssec-revoke@EXEEXT@: dnssec-revoke.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
+dnssec-revoke-pkcs11@EXEEXT@: dnssec-revoke.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
dce2d1b
 	dnssec-revoke.@O@ ${OBJS} ${LIBS}
dce2d1b
 
dce2d1b
-dnssec-settime@EXEEXT@: dnssec-settime.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
+dnssec-settime-pkcs11@EXEEXT@: dnssec-settime.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
dce2d1b
 	dnssec-settime.@O@ ${OBJS} ${LIBS}
dce2d1b
 
dce2d1b
-dnssec-importkey@EXEEXT@: dnssec-importkey.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
+dnssec-importkey-pkcs11@EXEEXT@: dnssec-importkey.@O@ ${OBJS} ${DEPLIBS}
dce2d1b
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
dce2d1b
 	dnssec-importkey.@O@ ${OBJS} ${LIBS}
dce2d1b
 
102df25
@@ -105,14 +105,11 @@ docclean manclean maintainer-clean::
dce2d1b
 
dce2d1b
 installdirs:
dce2d1b
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
dce2d1b
-	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
dce2d1b
 
dce2d1b
 install:: ${TARGETS} installdirs
dce2d1b
 	for t in ${TARGETS}; do ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} $$t ${DESTDIR}${sbindir}; done
dce2d1b
-	for m in ${MANPAGES}; do ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man8; done
dce2d1b
 
102df25
 uninstall::
102df25
-	for m in ${MANPAGES}; do rm -f ${DESTDIR}${mandir}/man8/$$m ; done
102df25
 	for t in ${TARGETS}; do ${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/$$t ; done
102df25
 
dce2d1b
 clean distclean::
dce2d1b
diff --git a/bin/dnssec/Makefile.in b/bin/dnssec/Makefile.in
102df25
index 8c6627a..c070881 100644
dce2d1b
--- a/bin/dnssec/Makefile.in
dce2d1b
+++ b/bin/dnssec/Makefile.in
102df25
@@ -16,7 +16,7 @@ VERSION=@BIND9_VERSION@
dce2d1b
 
102df25
 CINCLUDES =	${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@
dce2d1b
 
dce2d1b
-CDEFINES =	-DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \
dce2d1b
+CDEFINES =	-DVERSION=\"${VERSION}\" \
dce2d1b
 		@CRYPTO@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\"
dce2d1b
 CWARNINGS =
dce2d1b
 
dce2d1b
diff --git a/bin/named-pkcs11/Makefile.in b/bin/named-pkcs11/Makefile.in
7334552
index 83bce80..5170f47 100644
dce2d1b
--- a/bin/named-pkcs11/Makefile.in
dce2d1b
+++ b/bin/named-pkcs11/Makefile.in
7334552
@@ -40,26 +40,26 @@ DLZDRIVER_INCLUDES =	@DLZ_DRIVER_INCLUDES@
dce2d1b
 DLZDRIVER_LIBS =	@DLZ_DRIVER_LIBS@
dce2d1b
 
dce2d1b
 CINCLUDES =	-I${srcdir}/include -I${srcdir}/unix/include -I. \
dce2d1b
-		${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
dce2d1b
-		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
Michal Ruprich d886cd0
+        ${LWRES_INCLUDES} ${DNS_PKCS11_INCLUDES} ${BIND9_INCLUDES} \
Michal Ruprich d886cd0
+        ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_PKCS11_INCLUDES} \
dce2d1b
 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
dce2d1b
 
dce2d1b
-CDEFINES =      @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO@
dce2d1b
+CDEFINES =      @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO_PK11@
dce2d1b
 
dce2d1b
 CWARNINGS =
dce2d1b
 
dce2d1b
-DNSLIBS =	../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
Michal Ruprich d886cd0
+DNSLIBS =  ../../lib/dns-pkcs11/libdns-pkcs11.@A@ @DNS_CRYPTO_LIBS@
dce2d1b
 ISCCFGLIBS =	../../lib/isccfg/libisccfg.@A@
dce2d1b
 ISCCCLIBS =	../../lib/isccc/libisccc.@A@
dce2d1b
-ISCLIBS =	../../lib/isc/libisc.@A@
Michal Ruprich d886cd0
+ISCLIBS =  ../../lib/isc-pkcs11/libisc-pkcs11.@A@
dce2d1b
 ISCNOSYMLIBS =	../../lib/isc/libisc-nosymtbl.@A@
dce2d1b
 LWRESLIBS =	../../lib/lwres/liblwres.@A@
dce2d1b
 BIND9LIBS =	../../lib/bind9/libbind9.@A@
dce2d1b
 
dce2d1b
-DNSDEPLIBS =	../../lib/dns/libdns.@A@
Michal Ruprich d886cd0
+DNSDEPLIBS =   ../../lib/dns-pkcs11/libdns-pkcs11.@A@
dce2d1b
 ISCCFGDEPLIBS =	../../lib/isccfg/libisccfg.@A@
dce2d1b
 ISCCCDEPLIBS =	../../lib/isccc/libisccc.@A@
dce2d1b
-ISCDEPLIBS =	../../lib/isc/libisc.@A@
Michal Ruprich d886cd0
+ISCDEPLIBS =   ../../lib/isc-pkcs11/libisc-pkcs11.@A@
dce2d1b
 LWRESDEPLIBS =	../../lib/lwres/liblwres.@A@
dce2d1b
 BIND9DEPLIBS =	../../lib/bind9/libbind9.@A@
dce2d1b
 
7334552
@@ -68,15 +68,15 @@ DEPLIBS =	${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
dce2d1b
 
dce2d1b
 LIBS =		${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
dce2d1b
 		${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \
dce2d1b
-		${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
dce2d1b
+		@LIBS@
dce2d1b
 
dce2d1b
 NOSYMLIBS =	${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
dce2d1b
 		${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \
dce2d1b
-		${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
Michal Ruprich d886cd0
+        @LIBS@
dce2d1b
 
dce2d1b
 SUBDIRS =	unix
dce2d1b
 
dce2d1b
-TARGETS =	named@EXEEXT@ lwresd@EXEEXT@
Michal Ruprich d886cd0
+TARGETS =  named-pkcs11@EXEEXT@
dce2d1b
 
4fa9972
 GEOIPLINKOBJS = geoip.@O@
102df25
 
7334552
@@ -87,8 +87,7 @@ OBJS =		builtin.@O@ client.@O@ config.@O@ control.@O@ \
dce2d1b
 		tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
dce2d1b
 		zoneconf.@O@ \
dce2d1b
 		lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
dce2d1b
-		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
dce2d1b
-		${DLZDRIVER_OBJS} ${DBDRIVER_OBJS}
Michal Ruprich d886cd0
+        lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@
dce2d1b
 
dce2d1b
 UOBJS =		unix/os.@O@ unix/dlz_dlopen_driver.@O@
dce2d1b
 
7334552
@@ -103,8 +102,7 @@ SRCS =		builtin.c client.c config.c control.c \
dce2d1b
 		tkeyconf.c tsigconf.c update.c xfrout.c \
dce2d1b
 		zoneconf.c \
dce2d1b
 		lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
dce2d1b
-		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
dce2d1b
-		${DLZDRIVER_SRCS} ${DBDRIVER_SRCS}
Michal Ruprich d886cd0
+        lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c
dce2d1b
 
dce2d1b
 MANPAGES =	named.8 lwresd.8 named.conf.5
dce2d1b
 
7334552
@@ -143,14 +141,14 @@ server.@O@: server.c
Michal Ruprich d886cd0
 		-DPRODUCT=\"${PRODUCT}\" \
Michal Ruprich d886cd0
 		-DVERSION=\"${VERSION}\" -c ${srcdir}/server.c
dce2d1b
 
7334552
-named@EXEEXT@: ${OBJS} ${DEPLIBS}
7334552
+named-pkcs11@EXEEXT@: ${OBJS} ${DEPLIBS}
dce2d1b
 	export MAKE_SYMTABLE="yes"; \
dce2d1b
 	export BASEOBJS="${OBJS} ${UOBJS}"; \
dce2d1b
 	${FINALBUILDCMD}
7334552
 
7334552
-lwresd@EXEEXT@: named@EXEEXT@
7334552
+lwresd@EXEEXT@: named-pkcs11@EXEEXT@
7334552
 	rm -f lwresd@EXEEXT@
7334552
-	@LN@ named@EXEEXT@ lwresd@EXEEXT@
7334552
+	@LN@ named-pkcs11@EXEEXT@ lwresd@EXEEXT@
7334552
 
7334552
 doc man:: ${MANOBJS}
7334552
 
7334552
@@ -170,22 +168,12 @@ statschannel.@O@: bind9.xsl.h
dce2d1b
 
dce2d1b
 installdirs:
dce2d1b
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
dce2d1b
-	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man5
dce2d1b
-	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
Michal Ruprich d886cd0
 
dce2d1b
-install:: named@EXEEXT@ lwresd@EXEEXT@ installdirs
dce2d1b
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named@EXEEXT@ ${DESTDIR}${sbindir}
dce2d1b
-	(cd ${DESTDIR}${sbindir}; rm -f lwresd@EXEEXT@; @LN@ named@EXEEXT@ lwresd@EXEEXT@)
dce2d1b
-	${INSTALL_DATA} ${srcdir}/named.8 ${DESTDIR}${mandir}/man8
dce2d1b
-	${INSTALL_DATA} ${srcdir}/lwresd.8 ${DESTDIR}${mandir}/man8
dce2d1b
-	${INSTALL_DATA} ${srcdir}/named.conf.5 ${DESTDIR}${mandir}/man5
dce2d1b
+install:: named-pkcs11@EXEEXT@ installdirs
dce2d1b
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-pkcs11@EXEEXT@ ${DESTDIR}${sbindir}
dce2d1b
 
102df25
 uninstall::
102df25
-	rm -f ${DESTDIR}${mandir}/man5/named.conf.5
102df25
-	rm -f ${DESTDIR}${mandir}/man8/lwresd.8
102df25
-	rm -f ${DESTDIR}${mandir}/man8/named.8
102df25
-	rm -f ${DESTDIR}${sbindir}/lwresd@EXEEXT@
102df25
-	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named@EXEEXT@
102df25
+	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${sbindir}/named-pkcs11@EXEEXT@
102df25
 
dce2d1b
 @DLZ_DRIVER_RULES@
dce2d1b
 
dce2d1b
diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in
7334552
index 83bce80..f217965 100644
dce2d1b
--- a/bin/named/Makefile.in
dce2d1b
+++ b/bin/named/Makefile.in
7334552
@@ -44,7 +44,7 @@ CINCLUDES =	-I${srcdir}/include -I${srcdir}/unix/include -I. \
dce2d1b
 		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
dce2d1b
 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
dce2d1b
 
dce2d1b
-CDEFINES =      @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO@
dce2d1b
+CDEFINES =      @CONTRIB_DLZ@ @CRYPTO@
dce2d1b
 
dce2d1b
 CWARNINGS =
dce2d1b
 
dce2d1b
diff --git a/bin/pkcs11/Makefile.in b/bin/pkcs11/Makefile.in
102df25
index d9aa66b..1900e3c 100644
dce2d1b
--- a/bin/pkcs11/Makefile.in
dce2d1b
+++ b/bin/pkcs11/Makefile.in
102df25
@@ -12,13 +12,13 @@ top_srcdir =	@top_srcdir@
dce2d1b
 
dce2d1b
 @BIND9_MAKE_INCLUDES@
dce2d1b
 
dce2d1b
-CINCLUDES =	${ISC_INCLUDES}
dce2d1b
+CINCLUDES =	${ISC_PKCS11_INCLUDES}
dce2d1b
 
dce2d1b
 CDEFINES =
dce2d1b
 
4fa9972
-ISCLIBS =	../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@
4fa9972
+ISCLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@ @ISC_OPENSSL_LIBS@
dce2d1b
 
dce2d1b
-ISCDEPLIBS =	../../lib/isc/libisc.@A@
dce2d1b
+ISCDEPLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
dce2d1b
 
dce2d1b
 DEPLIBS =	${ISCDEPLIBS}
dce2d1b
 
dce2d1b
diff --git a/configure.in b/configure.in
7334552
index 71dadbf..127de9b 100644
dce2d1b
--- a/configure.in
dce2d1b
+++ b/configure.in
7334552
@@ -1152,12 +1152,14 @@ AC_SUBST(USE_GSSAPI)
4fa9972
 AC_SUBST(DST_GSSAPI_INC)
4fa9972
 AC_SUBST(DNS_GSSAPI_LIBS)
4fa9972
 DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
4fa9972
+DNS_CRYPTO_PK11_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_PK11_LIBS"
4fa9972
 
4fa9972
 #
4fa9972
 # Applications linking with libdns also need to link with these libraries.
4fa9972
 #
4fa9972
 
4fa9972
 AC_SUBST(DNS_CRYPTO_LIBS)
4fa9972
+AC_SUBST(DNS_CRYPTO_PK11_LIBS)
4fa9972
 
4fa9972
 #
4fa9972
 # was --with-randomdev specified?
7334552
@@ -1542,11 +1544,11 @@ fi
Michal Ruprich d886cd0
 AC_MSG_CHECKING(for OpenSSL library)
Michal Ruprich d886cd0
 OPENSSL_WARNING=
dce2d1b
 openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
102df25
-if test "yes" = "$want_native_pkcs11"
Michal Ruprich d886cd0
-then
Michal Ruprich d886cd0
-	use_openssl="native_pkcs11"
Michal Ruprich d886cd0
-	AC_MSG_RESULT(use of native PKCS11 instead)
Michal Ruprich d886cd0
-fi
102df25
+# if test "yes" = "$want_native_pkcs11"
102df25
+# then
102df25
+# 	use_openssl="native_pkcs11"
102df25
+# 	AC_MSG_RESULT(use of native PKCS11 instead)
102df25
+# fi
Michal Ruprich d886cd0
 
102df25
 if test "auto" = "$use_openssl"
dce2d1b
 then
7334552
@@ -1559,6 +1561,7 @@ then
Michal Ruprich d886cd0
 		fi
Michal Ruprich d886cd0
 	done
dce2d1b
 fi
4fa9972
+CRYPTO_PK11=""
dce2d1b
 OPENSSL_ECDSA=""
dce2d1b
 OPENSSL_GOST=""
7334552
 OPENSSL_ED25519=""
7334552
@@ -1580,11 +1583,10 @@ case "$with_gost" in
4fa9972
 		;;
4fa9972
 esac
4fa9972
 
4fa9972
-case "$use_openssl" in
4fa9972
-	native_pkcs11)
4fa9972
-		AC_MSG_RESULT(disabled because of native PKCS11)
4fa9972
+if test "$want_native_pkcs11" = "yes"
4fa9972
+then
4fa9972
 		DST_OPENSSL_INC=""
4fa9972
-		CRYPTO="-DPKCS11CRYPTO"
4fa9972
+		CRYPTO_PK11="-DPKCS11CRYPTO"
7334552
 		OPENSSLECDSALINKOBJS=""
7334552
 		OPENSSLECDSALINKSRCS=""
7334552
 		OPENSSLEDDSALINKOBJS=""
7334552
@@ -1593,7 +1595,9 @@ case "$use_openssl" in
7334552
 		OPENSSLGOSTLINKSRCS=""
4fa9972
 		OPENSSLLINKOBJS=""
4fa9972
 		OPENSSLLINKSRCS=""
4fa9972
-		;;
4fa9972
+fi
4fa9972
+
4fa9972
+case "$use_openssl" in
4fa9972
 	no)
4fa9972
 		AC_MSG_RESULT(no)
4fa9972
 		DST_OPENSSL_INC=""
7334552
@@ -1623,11 +1627,11 @@ case "$use_openssl" in
dce2d1b
 If you don't want OpenSSL, use --without-openssl])
dce2d1b
 		;;
dce2d1b
 	*)
102df25
-		if test "yes" = "$want_native_pkcs11"
dce2d1b
-		then
7334552
-			AC_MSG_RESULT()
dce2d1b
-			AC_MSG_ERROR([OpenSSL and native PKCS11 cannot be used together.])
dce2d1b
-		fi
7334552
+		# if test "yes" = "$want_native_pkcs11"
7334552
+		# then
7334552
+		# 	AC_MSG_RESULT()
7334552
+		# 	AC_MSG_ERROR([OpenSSL and native PKCS11 cannot be used together.])
7334552
+		# fi
102df25
 		if test "yes" = "$use_openssl"
dce2d1b
 		then
dce2d1b
 			# User did not specify a path - guess it
7334552
@@ -2085,6 +2089,7 @@ AC_SUBST(OPENSSL_ED25519)
dce2d1b
 AC_SUBST(OPENSSL_GOST)
dce2d1b
 
4fa9972
 DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DST_OPENSSL_LIBS"
dce2d1b
+DNS_CRYPTO_PK11_LIBS="$DNS_CRYPTO_LIBS"
dce2d1b
 
4fa9972
 ISC_PLATFORM_WANTAES="#undef ISC_PLATFORM_WANTAES"
102df25
 if test "yes" = "$with_aes"
7334552
@@ -2404,6 +2409,7 @@ esac
dce2d1b
 AC_SUBST(PKCS11LINKOBJS)
dce2d1b
 AC_SUBST(PKCS11LINKSRCS)
dce2d1b
 AC_SUBST(CRYPTO)
dce2d1b
+AC_SUBST(CRYPTO_PK11)
dce2d1b
 AC_SUBST(PKCS11_ECDSA)
dce2d1b
 AC_SUBST(PKCS11_GOST)
7334552
 AC_SUBST(PKCS11_ED25519)
7334552
@@ -5398,8 +5404,11 @@ AC_CONFIG_FILES([
4fa9972
 	bin/delv/Makefile
dce2d1b
 	bin/dig/Makefile
dce2d1b
 	bin/dnssec/Makefile
4fa9972
+	bin/dnssec-pkcs11/Makefile	
dce2d1b
 	bin/named/Makefile
4fa9972
 	bin/named/unix/Makefile
dce2d1b
+	bin/named-pkcs11/Makefile
dce2d1b
+	bin/named-pkcs11/unix/Makefile
dce2d1b
 	bin/nsupdate/Makefile
dce2d1b
 	bin/pkcs11/Makefile
4fa9972
 	bin/python/Makefile
7334552
@@ -5500,6 +5509,10 @@ AC_CONFIG_FILES([
dce2d1b
 	lib/dns/include/dns/Makefile
dce2d1b
 	lib/dns/include/dst/Makefile
dce2d1b
 	lib/dns/tests/Makefile
dce2d1b
+	lib/dns-pkcs11/Makefile
dce2d1b
+	lib/dns-pkcs11/include/Makefile
dce2d1b
+	lib/dns-pkcs11/include/dns/Makefile
dce2d1b
+	lib/dns-pkcs11/include/dst/Makefile
4fa9972
 	lib/irs/Makefile
4fa9972
 	lib/irs/include/Makefile
4fa9972
 	lib/irs/include/irs/Makefile
7334552
@@ -5524,6 +5537,24 @@ AC_CONFIG_FILES([
dce2d1b
 	lib/isc/unix/include/Makefile
dce2d1b
 	lib/isc/unix/include/isc/Makefile
dce2d1b
 	lib/isc/unix/include/pkcs11/Makefile
dce2d1b
+	lib/isc-pkcs11/$arch/Makefile
dce2d1b
+	lib/isc-pkcs11/$arch/include/Makefile
dce2d1b
+	lib/isc-pkcs11/$arch/include/isc/Makefile
dce2d1b
+	lib/isc-pkcs11/$thread_dir/Makefile
dce2d1b
+	lib/isc-pkcs11/$thread_dir/include/Makefile
dce2d1b
+	lib/isc-pkcs11/$thread_dir/include/isc/Makefile
dce2d1b
+	lib/isc-pkcs11/Makefile
dce2d1b
+	lib/isc-pkcs11/include/Makefile
dce2d1b
+	lib/isc-pkcs11/include/isc/Makefile
dce2d1b
+	lib/isc-pkcs11/include/isc/platform.h
dce2d1b
+	lib/isc-pkcs11/include/pk11/Makefile
dce2d1b
+	lib/isc-pkcs11/include/pkcs11/Makefile
dce2d1b
+	lib/isc-pkcs11/tests/Makefile
dce2d1b
+	lib/isc-pkcs11/nls/Makefile
dce2d1b
+	lib/isc-pkcs11/unix/Makefile
dce2d1b
+	lib/isc-pkcs11/unix/include/Makefile
dce2d1b
+	lib/isc-pkcs11/unix/include/isc/Makefile
dce2d1b
+	lib/isc-pkcs11/unix/include/pkcs11/Makefile
dce2d1b
 	lib/isccc/Makefile
dce2d1b
 	lib/isccc/include/Makefile
dce2d1b
 	lib/isccc/include/isccc/Makefile
dce2d1b
diff --git a/lib/Makefile.in b/lib/Makefile.in
102df25
index 318450c..87cde21 100644
dce2d1b
--- a/lib/Makefile.in
dce2d1b
+++ b/lib/Makefile.in
102df25
@@ -14,7 +14,7 @@ top_srcdir =	@top_srcdir@
dce2d1b
 # Attempt to disable parallel processing.
dce2d1b
 .NOTPARALLEL:
dce2d1b
 .NO_PARALLEL:
4fa9972
-SUBDIRS =	isc isccc dns isccfg bind9 lwres irs tests samples
4fa9972
+SUBDIRS =	isc isc-pkcs11 isccc dns dns-pkcs11 isccfg bind9 lwres irs tests samples
dce2d1b
 TARGETS =
dce2d1b
 
dce2d1b
 @BIND9_MAKE_RULES@
dce2d1b
diff --git a/lib/dns-pkcs11/Makefile.in b/lib/dns-pkcs11/Makefile.in
7334552
index f7556f3..8e29a5c 100644
dce2d1b
--- a/lib/dns-pkcs11/Makefile.in
dce2d1b
+++ b/lib/dns-pkcs11/Makefile.in
102df25
@@ -23,16 +23,16 @@ VERSION=@BIND9_VERSION@
dce2d1b
 
dce2d1b
 USE_ISC_SPNEGO = @USE_ISC_SPNEGO@
dce2d1b
 
4fa9972
-CINCLUDES =	-I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} \
4fa9972
-		${ISC_INCLUDES} @DST_OPENSSL_INC@ @DST_GSSAPI_INC@
4fa9972
+CINCLUDES =	-I. -I${top_srcdir}/lib/dns-pkcs11 -Iinclude ${DNS_PKCS11_INCLUDES} \
4fa9972
+		${ISC_PKCS11_INCLUDES} @DST_OPENSSL_INC@ @DST_GSSAPI_INC@
dce2d1b
 
dce2d1b
-CDEFINES =	-DUSE_MD5 @CRYPTO@ @USE_GSSAPI@ ${USE_ISC_SPNEGO}
dce2d1b
+CDEFINES =	-DUSE_MD5 @CRYPTO_PK11@ @USE_GSSAPI@ ${USE_ISC_SPNEGO}
dce2d1b
 
dce2d1b
 CWARNINGS =
dce2d1b
 
dce2d1b
-ISCLIBS =	../../lib/isc/libisc.@A@
dce2d1b
+ISCLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
dce2d1b
 
dce2d1b
-ISCDEPLIBS =	../../lib/isc/libisc.@A@
dce2d1b
+ISCDEPLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
dce2d1b
 
dce2d1b
 LIBS =		@LIBS@
dce2d1b
 
7334552
@@ -142,15 +142,15 @@ version.@O@: version.c
4fa9972
 		-DLIBAGE=${LIBAGE} \
4fa9972
 		-c ${srcdir}/version.c
dce2d1b
 
dce2d1b
-libdns.@SA@: ${OBJS}
dce2d1b
+libdns-pkcs11.@SA@: ${OBJS}
dce2d1b
 	${AR} ${ARFLAGS} $@ ${OBJS}
dce2d1b
 	${RANLIB} $@
dce2d1b
 
dce2d1b
-libdns.la: ${OBJS}
dce2d1b
+libdns-pkcs11.la: ${OBJS}
dce2d1b
 	${LIBTOOL_MODE_LINK} \
dce2d1b
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns.la -rpath ${libdir} \
dce2d1b
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns-pkcs11.la -rpath ${libdir} \
dce2d1b
 		-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
dce2d1b
-		${OBJS} ${ISCLIBS} @DNS_CRYPTO_LIBS@ ${LIBS}
dce2d1b
+		${OBJS} ${ISCLIBS} @DNS_CRYPTO_PK11_LIBS@ ${LIBS}
102df25
 
699c934
 include: gen
699c934
 	${MAKE} include/dns/enumtype.h
7334552
@@ -176,25 +176,25 @@ code.h:	gen
699c934
 	./gen -s ${srcdir} > code.h || { rm -f $@ ; exit 1; }
699c934
 
699c934
 gen: gen.c
699c934
-	${BUILD_CC} ${BUILD_CFLAGS} -I${top_srcdir}/lib/isc/include \
699c934
+	${BUILD_CC} ${BUILD_CFLAGS} -I${top_srcdir}/lib/isc-pkcs11/include \
699c934
 	${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c ${BUILD_LIBS}
699c934
 
699c934
-timestamp: include libdns.@A@
699c934
+timestamp: include libdns-pkcs11.@A@
dce2d1b
 	touch timestamp
102df25
 
699c934
-testdirs: libdns.@A@
699c934
+testdirs: libdns-pkcs11.@A@
699c934
 
dce2d1b
 installdirs:
dce2d1b
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
102df25
 
dce2d1b
 install:: timestamp installdirs
dce2d1b
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libdns.@A@ ${DESTDIR}${libdir}
dce2d1b
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libdns-pkcs11.@A@ ${DESTDIR}${libdir}
102df25
 
102df25
 uninstall::
102df25
-	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libdns.@A@
102df25
+	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libdns-pkcs11.@A@
102df25
 
dce2d1b
 clean distclean::
dce2d1b
-	rm -f libdns.@A@ timestamp
dce2d1b
+	rm -f libdns-pkcs11.@A@ timestamp
dce2d1b
 	rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h
dce2d1b
 	rm -f include/dns/rdatastruct.h
Michal Ruprich d886cd0
 	rm -f dnstap.pb-c.c dnstap.pb-c.h include/dns/dnstap.pb-c.h
dce2d1b
diff --git a/lib/isc-pkcs11/Makefile.in b/lib/isc-pkcs11/Makefile.in
699c934
index bd8b109..3a6665f 100644
dce2d1b
--- a/lib/isc-pkcs11/Makefile.in
dce2d1b
+++ b/lib/isc-pkcs11/Makefile.in
102df25
@@ -20,8 +20,8 @@ CINCLUDES =	-I${srcdir}/unix/include \
dce2d1b
 		-I${srcdir}/@ISC_THREAD_DIR@/include \
dce2d1b
 		-I${srcdir}/@ISC_ARCH_DIR@/include \
dce2d1b
 		-I./include \
699c934
-		-I${srcdir}/include ${DNS_INCLUDES} @ISC_OPENSSL_INC@
dce2d1b
-CDEFINES =	@CRYPTO@ -DPK11_LIB_LOCATION=\"${PROVIDER}\"
dce2d1b
+		-I${srcdir}/include ${DNS_PKCS11_INCLUDES}
dce2d1b
+CDEFINES =	@CRYPTO_PK11@ -DPK11_LIB_LOCATION=\"${PROVIDER}\"
dce2d1b
 CWARNINGS =
dce2d1b
 
dce2d1b
 # Alphabetically
699c934
@@ -104,40 +104,40 @@ version.@O@: version.c
dce2d1b
 		-DLIBAGE=${LIBAGE} \
dce2d1b
 		-c ${srcdir}/version.c
dce2d1b
 
dce2d1b
-libisc.@SA@: ${OBJS} ${SYMTBLOBJS}
dce2d1b
+libisc-pkcs11.@SA@: ${OBJS} ${SYMTBLOBJS}
dce2d1b
 	${AR} ${ARFLAGS} $@ ${OBJS} ${SYMTBLOBJS}
dce2d1b
 	${RANLIB} $@
dce2d1b
 
dce2d1b
-libisc-nosymtbl.@SA@: ${OBJS}
dce2d1b
+libisc-pkcs11-nosymtbl.@SA@: ${OBJS}
dce2d1b
 	${AR} ${ARFLAGS} $@ ${OBJS}
dce2d1b
 	${RANLIB} $@
dce2d1b
 
dce2d1b
-libisc.la: ${OBJS} ${SYMTBLOBJS}
dce2d1b
+libisc-pkcs11.la: ${OBJS} ${SYMTBLOBJS}
dce2d1b
 	${LIBTOOL_MODE_LINK} \
dce2d1b
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc.la -rpath ${libdir} \
dce2d1b
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-pkcs11.la -rpath ${libdir} \
dce2d1b
 		-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
dce2d1b
 		${OBJS} ${SYMTBLOBJS} ${LIBS}
dce2d1b
 
dce2d1b
-libisc-nosymtbl.la: ${OBJS}
dce2d1b
+libisc-pkcs11-nosymtbl.la: ${OBJS}
dce2d1b
 	${LIBTOOL_MODE_LINK} \
dce2d1b
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-nosymtbl.la -rpath ${libdir} \
dce2d1b
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-pkcs11-nosymtbl.la -rpath ${libdir} \
dce2d1b
 		-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
dce2d1b
 		${OBJS} ${LIBS}
dce2d1b
 
dce2d1b
-timestamp: libisc.@A@ libisc-nosymtbl.@A@
dce2d1b
+timestamp: libisc-pkcs11.@A@ libisc-pkcs11-nosymtbl.@A@
dce2d1b
 	touch timestamp
dce2d1b
 
699c934
-testdirs: libisc.@A@ libisc-nosymtbl.@A@
699c934
+testdirs: libisc-pkcs11.@A@ libisc-pkcs11-nosymtbl.@A@
699c934
 
dce2d1b
 installdirs:
dce2d1b
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
dce2d1b
 
dce2d1b
 install:: timestamp installdirs
dce2d1b
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libisc.@A@ ${DESTDIR}${libdir}
dce2d1b
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libisc-pkcs11.@A@ ${DESTDIR}${libdir}
dce2d1b
 
102df25
 uninstall::
102df25
-	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libisc.@A@
102df25
+	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libisc-pkcs11.@A@
102df25
 
dce2d1b
 clean distclean::
dce2d1b
-	rm -f libisc.@A@ libisc-nosymtbl.@A@ libisc.la \
dce2d1b
-	libisc-nosymtbl.la timestamp
dce2d1b
+	rm -f libisc-pkcs11.@A@ libisc-pkcs11-nosymtbl.@A@ libisc-pkcs11.la \
dce2d1b
+	libisc-pkcs11-nosymtbl.la timestamp
dce2d1b
diff --git a/make/includes.in b/make/includes.in
102df25
index f41e3cd..b97534c 100644
dce2d1b
--- a/make/includes.in
dce2d1b
+++ b/make/includes.in
102df25
@@ -40,3 +40,13 @@ BIND9_INCLUDES = @BIND9_BIND9_BUILDINCLUDE@ \
dce2d1b
 
dce2d1b
 TEST_INCLUDES = \
dce2d1b
 	-I${top_srcdir}/lib/tests/include
dce2d1b
+
dce2d1b
+ISC_PKCS11_INCLUDES = @BIND9_ISC_BUILDINCLUDE@ \
dce2d1b
+	-I${top_srcdir}/lib/isc-pkcs11 \
dce2d1b
+	-I${top_srcdir}/lib/isc-pkcs11/include \
dce2d1b
+	-I${top_srcdir}/lib/isc-pkcs11/unix/include \
dce2d1b
+	-I${top_srcdir}/lib/isc-pkcs11/@ISC_THREAD_DIR@/include \
dce2d1b
+	-I${top_srcdir}/lib/isc-pkcs11/@ISC_ARCH_DIR@/include
dce2d1b
+
dce2d1b
+DNS_PKCS11_INCLUDES = @BIND9_DNS_BUILDINCLUDE@ \
dce2d1b
+	-I${top_srcdir}/lib/dns-pkcs11/include