use OpenSC as default PKCS#11 provider

closes #229
This commit is contained in:
Frank Morgner 2014-12-19 22:12:25 +01:00
parent 1197fbea36
commit 291e9dab9e
2 changed files with 29 additions and 5 deletions

View File

@ -218,6 +218,13 @@ AC_ARG_WITH(
,
[with_pcsc_provider="detect"]
)
AC_ARG_WITH(
[pkcs11-provider],
[AS_HELP_STRING([--with-pkcs11-provider=PATH],[Path to the default PKCS11 provider @<:@default=OpenSC@:>@])],
,
[with_pkcs11_provider="detect"]
)
dnl ./configure check
reader_count=""
for rdriver in "${enable_pcsc}" "${enable_openct}" "${enable_ctapi}"; do
@ -568,6 +575,24 @@ if test "${enable_pcsc}" = "yes"; then
AC_DEFINE([ENABLE_PCSC], [1], [Define if PC/SC is to be enabled])
fi
if test "${with_pkcs11_provider}" = "detect"; then
case "${host}" in
*-*-darwin*)
DEFAULT_PKCS11_PROVIDER="opensc-pkcs11.dylib"
;;
*-mingw*|*-winnt*|*-cygwin*)
DEFAULT_PKCS11_PROVIDER="opensc-pkcs11.dll"
;;
*)
DEFAULT_PKCS11_PROVIDER="opensc-pkcs11.so"
;;
esac
else
DEFAULT_PKCS11_PROVIDER="${with_pkcs11_provider}"
fi
AC_DEFINE_UNQUOTED([DEFAULT_PKCS11_PROVIDER], ["${DEFAULT_PKCS11_PROVIDER}"], [Default PKCS11 provider])
if test "${enable_man}" = "detect"; then
if test "${WIN32}" = "yes"; then
enable_man="no"
@ -643,6 +668,7 @@ AC_SUBST([OPENSC_LT_AGE])
AC_SUBST([OPENSC_LT_OLDEST])
AC_SUBST([WIN_LIBPREFIX])
AC_SUBST([DEFAULT_PCSC_PROVIDER])
AC_SUBST([DEFAULT_PKCS11_PROVIDER])
AC_SUBST([OPTIONAL_ZLIB_CFLAGS])
AC_SUBST([OPTIONAL_ZLIB_LIBS])
AC_SUBST([OPTIONAL_READLINE_CFLAGS])
@ -752,6 +778,7 @@ DNIe UI support: ${enable_dnie_ui}
Debug file: ${DEBUG_FILE}
PC/SC default provider: ${DEFAULT_PCSC_PROVIDER}
PKCS11 default provider: ${DEFAULT_PKCS11_PROVIDER}
Host: ${host}
Compiler: ${CC}

View File

@ -166,7 +166,7 @@ static const struct option options[] = {
};
static const char *option_help[] = {
"Specify the module to load (mandatory)",
"Specify the module to load (default:" DEFAULT_PKCS11_PROVIDER ")",
"Show global token information",
"List available slots",
"List slots with tokens",
@ -225,7 +225,7 @@ static const char * app_name = "pkcs11-tool"; /* for utils.c */
static int verbose = 0;
static const char * opt_input = NULL;
static const char * opt_output = NULL;
static const char * opt_module = NULL;
static const char * opt_module = DEFAULT_PKCS11_PROVIDER;
static int opt_slot_set = 0;
static CK_SLOT_ID opt_slot = 0;
static const char * opt_slot_description = NULL;
@ -653,9 +653,6 @@ int main(int argc, char * argv[])
}
}
if (opt_module == NULL)
util_print_usage_and_die(app_name, options, option_help, NULL);
if (action_count == 0)
util_print_usage_and_die(app_name, options, option_help, NULL);