Use opensc-pkcs11.so for static build of pkcs11-tool
Statically link opensc-pkcs11 into pkcs11-tool with --disable-shared
This commit is contained in:
parent
887340c04d
commit
993f6f5cc6
|
@ -1045,6 +1045,9 @@ AM_CONDITIONAL([ENABLE_NPATOOL], [test "${ENABLE_NPATOOL}" = "yes"])
|
|||
AM_CONDITIONAL([ENABLE_TESTS], [test "${enable_tests}" = "yes"])
|
||||
AM_CONDITIONAL([GIT_CHECKOUT], [test "${GIT_CHECKOUT}" = "yes"])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_SHARED], [test "${enable_shared}" = "yes"])
|
||||
AS_IF([test "${enable_shared}" = "yes"], [AC_DEFINE([ENABLE_SHARED], [1], [Enable shared libraries])])
|
||||
|
||||
if test "${enable_pedantic}" = "yes"; then
|
||||
enable_strict="yes";
|
||||
CFLAGS="${CFLAGS} -pedantic"
|
||||
|
|
|
@ -4,6 +4,10 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/versioninfo-pkcs11.rc $(s
|
|||
EXTRA_DIST = Makefile.mak versioninfo-pkcs11.rc.in versioninfo-pkcs11-spy.rc.in opensc-pkcs11.pc.in opensc-pkcs11.dll.manifest onepin-opensc-pkcs11.dll.manifest
|
||||
|
||||
lib_LTLIBRARIES = opensc-pkcs11.la pkcs11-spy.la onepin-opensc-pkcs11.la
|
||||
if ENABLE_SHARED
|
||||
else
|
||||
noinst_LTLIBRARIES = libopensc-pkcs11.la
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src
|
||||
|
||||
|
@ -31,6 +35,11 @@ opensc_pkcs11_la_LDFLAGS = $(AM_LDFLAGS) \
|
|||
-export-symbols "$(srcdir)/pkcs11.exports" \
|
||||
-module -shared -avoid-version -no-undefined
|
||||
|
||||
libopensc_pkcs11_la_SOURCES = $(OPENSC_PKCS11_SRC) $(OPENSC_PKCS11_INC)
|
||||
libopensc_pkcs11_la_CFLAGS = $(OPENSC_PKCS11_CFLAGS)
|
||||
libopensc_pkcs11_la_LIBADD = $(OPENSC_PKCS11_LIBS)
|
||||
libopensc_pkcs11_la_LDFLAGS = $(AM_LDFLAGS)
|
||||
|
||||
onepin_opensc_pkcs11_la_SOURCES = $(OPENSC_PKCS11_SRC) $(OPENSC_PKCS11_INC)
|
||||
onepin_opensc_pkcs11_la_CFLAGS = -DMODULE_APP_NAME=\"onepin-opensc-pkcs11\" $(OPENSC_PKCS11_CFLAGS)
|
||||
onepin_opensc_pkcs11_la_LIBADD = $(OPENSC_PKCS11_LIBS)
|
||||
|
|
|
@ -61,6 +61,11 @@ pkcs11_tool_SOURCES = pkcs11-tool.c util.c
|
|||
pkcs11_tool_LDADD = \
|
||||
$(top_builddir)/src/common/libpkcs11.la \
|
||||
$(OPTIONAL_OPENSSL_LIBS)
|
||||
if ENABLE_SHARED
|
||||
else
|
||||
pkcs11_tool_LDADD += \
|
||||
$(top_builddir)/src/pkcs11/libopensc-pkcs11.la
|
||||
endif
|
||||
pkcs15_crypt_SOURCES = pkcs15-crypt.c util.c
|
||||
pkcs15_crypt_LDADD = $(OPTIONAL_OPENSSL_LIBS)
|
||||
cryptoflex_tool_SOURCES = cryptoflex-tool.c util.c
|
||||
|
|
|
@ -71,6 +71,9 @@
|
|||
|
||||
extern void *C_LoadModule(const char *name, CK_FUNCTION_LIST_PTR_PTR);
|
||||
extern CK_RV C_UnloadModule(void *module);
|
||||
#ifndef ENABLE_SHARED
|
||||
extern CK_FUNCTION_LIST pkcs11_function_list;
|
||||
#endif
|
||||
|
||||
#define NEED_SESSION_RO 0x01
|
||||
#define NEED_SESSION_RW 0x02
|
||||
|
@ -911,9 +914,16 @@ int main(int argc, char * argv[])
|
|||
opt_module = expanded_val;
|
||||
#endif
|
||||
|
||||
module = C_LoadModule(opt_module, &p11);
|
||||
if (module == NULL)
|
||||
util_fatal("Failed to load pkcs11 module");
|
||||
#ifndef ENABLE_SHARED
|
||||
if (strcmp(opt_module, DEFAULT_PKCS11_PROVIDER) == 0)
|
||||
p11 = &pkcs11_function_list;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
module = C_LoadModule(opt_module, &p11);
|
||||
if (module == NULL)
|
||||
util_fatal("Failed to load pkcs11 module");
|
||||
}
|
||||
|
||||
rv = p11->C_Initialize(NULL);
|
||||
if (rv == CKR_CRYPTOKI_ALREADY_INITIALIZED)
|
||||
|
|
|
@ -53,7 +53,8 @@
|
|||
#define DEFAULT_PCSC_PROVIDER "@DEFAULT_PCSC_PROVIDER@"
|
||||
#endif
|
||||
|
||||
#define ENABLE_NOTIFY
|
||||
#define ENABLE_SHARED 1
|
||||
#define ENABLE_NOTIFY 1
|
||||
|
||||
#define SC_PKCS15_PROFILE_DIRECTORY "C:\\Program Files\\OpenSC Project\\OpenSC\\profiles"
|
||||
|
||||
|
|
Loading…
Reference in New Issue