Hi all,

p11-kit [1] has now has stabilized and is used by gnutls, gnome-keyring,
and soon glib. Among other things, it helps by setting up a standard
PkCS#11 configuration format.

I'd like to suggest that OpenSC installs a config file in the right
place so that it works with p11-kit. The config format is described here:

http://p11-glue.freedesktop.org/doc/p11-kit/config.html

Thanks for looking over this change. Let me know if I've sent this patch
to the wrong place.

Cheers,

Stef

[1] http://p11-glue.freedesktop.org/p11-kit.html
>From 3f4d94ed9acbf69079c670f9acb8e8bc4cb043ed Mon Sep 17 00:00:00 2001
From: Stef Walter <st...@collabora.co.uk>
Date: Mon, 1 Aug 2011 12:18:50 +0200
Subject: [PATCH] Install a config file so that opensc works with p11-kit
 config format.

 * Install a config file to /etc/pkcs11/modules to load the opensc
   module in p11-kit based systems like: gnutls, glib, gnome-keyring
---
 .gitignore                  |    1 +
 configure.ac                |   11 ++++++++++-
 src/pkcs11/Makefile.am      |    5 +++++
 src/pkcs11/opensc-module.in |    5 +++++
 4 files changed, 21 insertions(+), 1 deletions(-)
 create mode 100644 src/pkcs11/opensc-module.in

diff --git a/.gitignore b/.gitignore
index 2903289..ac7dd80 100644
--- a/.gitignore
+++ b/.gitignore
@@ -64,6 +64,7 @@ piv-tool
 eidenv
 opensc-explorer
 opensc-tool
+opensc-module
 rutoken-tool
 cardos-info
 cryptoflex-tool
diff --git a/configure.ac b/configure.ac
index cf373c9..37861e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -532,7 +532,15 @@ AC_DEFINE_UNQUOTED([OPENSC_VERSION_MINOR], [${OPENSC_VERSION_MINOR}], [OpenSC ve
 AC_DEFINE_UNQUOTED([OPENSC_VERSION_FIX], [${OPENSC_VERSION_FIX}], [OpenSC version fix component])
 AC_DEFINE_UNQUOTED([OPENSC_FEATURES], ["${OPENSC_FEATURES}"], [Enabled OpenSC features])
 
-pkcs11dir="\$(libdir)/pkcs11"
+AC_MSG_CHECKING([where to put pkcs11 module configuration])
+P11_SYSTEM_MODULES=`$PKG_CONFIG p11-kit-1 --variable=p11_system_modules`
+if test -z "$P11_SYSTEM_MODULES"; then
+	P11_SYSTEM_MODULES=`eval echo ${sysconfdir}/pkcs11/modules`
+fi
+AC_MSG_RESULT($P11_SYSTEM_MODULES)
+AC_SUBST(P11_SYSTEM_MODULES)
+
+pkcs11dir=`eval echo ${libdir}/pkcs11`
 
 AC_SUBST([pkcs11dir])
 AC_SUBST([xslstylesheetsdir])
@@ -587,6 +595,7 @@ AC_CONFIG_FILES([
 	src/libopensc/Makefile
 	src/libopensc/libopensc.pc
 	src/pkcs11/Makefile
+	src/pkcs11/opensc-module
 	src/pkcs15init/Makefile
 	src/scconf/Makefile
 	src/tests/Makefile
diff --git a/src/pkcs11/Makefile.am b/src/pkcs11/Makefile.am
index ba5e70d..908b04a 100644
--- a/src/pkcs11/Makefile.am
+++ b/src/pkcs11/Makefile.am
@@ -71,3 +71,8 @@ install-exec-hook:	install-pkcs11DATA
 	done
 
 endif
+
+# This is the configuration file that p11-kit uses to load the module
+configdir = $(P11_SYSTEM_MODULES)
+config_DATA = \
+	opensc-module
diff --git a/src/pkcs11/opensc-module.in b/src/pkcs11/opensc-module.in
new file mode 100644
index 0000000..bc11d7d
--- /dev/null
+++ b/src/pkcs11/opensc-module.in
@@ -0,0 +1,5 @@
+
+# This file describes how to load the opensc module
+# See: http://p11-glue.freedesktop.org/doc/p11-kit/config.html
+
+module: @pkcs11dir@/opensc-pkcs11.so
-- 
1.7.6

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to