big configure update.
use pkg-config for openct, openssl, pcsc. do not compilke libp11. do not compile sslengines. remove scdl. use libltdl instead. use libassuan.m4 macro for m4 detection. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2528 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
7770e89115
commit
ff62b88e1c
|
@ -16,3 +16,7 @@ MAINTAINERCLEANFILES = \
|
|||
DEPCLEANFILES = config.log configure
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign 1.5
|
||||
|
||||
dist-hook:
|
||||
sh $(srcdir)/doc/export-wiki.sh $(srcdir)/doc
|
||||
sh $(srcdir)/doc/old/generate.sh $(srcdir)/doc/old
|
||||
|
|
|
@ -5,7 +5,7 @@ set -x
|
|||
if test -f Makefile; then
|
||||
make distclean
|
||||
fi
|
||||
rm -rf *.cache *.m4 config.guess config.log \
|
||||
config.status config.sub depcomp ltmain.sh
|
||||
rm -rf *~ *.cache *.m4 config.guess config.log \
|
||||
config.status config.sub depcomp ltmain.sh
|
||||
(cat aclocal/*.m4 > acinclude.m4 2> /dev/null)
|
||||
autoreconf --verbose --install
|
||||
|
|
514
configure.in
514
configure.in
|
@ -59,42 +59,6 @@ case "$host" in
|
|||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(common-dir,
|
||||
AC_HELP_STRING([--with-common-dir=PATH], [Specify path for common installation libraries]),
|
||||
[
|
||||
if test "x$withval" != "xno" ; then
|
||||
trycommondir=$withval
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
AC_CACHE_CHECK([for common directory], ac_cv_commondir, [
|
||||
for commondir in $trycommondir "" /usr/local /usr/pkg /opt ; do
|
||||
# Skip directories if they don't exist
|
||||
if test ! -z "$commondir" -a ! -d "$commondir/" ; then
|
||||
continue;
|
||||
fi
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
|
||||
if test ! -z "$commondir" -a "x$commondir" != "x/usr"; then
|
||||
LDFLAGS="-L$commondir/lib $saved_LDFLAGS"
|
||||
if test ! -z "$need_dash_r" ; then
|
||||
LDFLAGS="-R$commondir/lib $LDFLAGS"
|
||||
fi
|
||||
CPPFLAGS="-I$commondir/include $saved_CPPFLAGS"
|
||||
fi
|
||||
break;
|
||||
done
|
||||
|
||||
if test -z "$commondir" ; then
|
||||
commondir="(system)"
|
||||
fi
|
||||
ac_cv_commondir=$commondir
|
||||
])
|
||||
|
||||
dnl Options
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
|
@ -108,30 +72,20 @@ AC_PATH_PROG(TEST_MINUS_S_SH, bash)
|
|||
AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
|
||||
AC_PATH_PROG(TEST_MINUS_S_SH, sh)
|
||||
|
||||
dnl Special check for pthread support.
|
||||
ACX_PTHREAD(
|
||||
[
|
||||
AC_DEFINE(HAVE_PTHREAD,1,
|
||||
[Define if you have POSIX threads libraries and header files.])
|
||||
], [
|
||||
AC_MSG_ERROR([POSIX thread support required])
|
||||
])
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
CC="$PTHREAD_CC"
|
||||
|
||||
dnl Add libtool support.
|
||||
AM_PROG_LIBTOOL
|
||||
dnl Automatically update the libtool script if it becomes out-of-date.
|
||||
#AC_SUBST(LIBTOOL_DEPS)
|
||||
|
||||
dnl C Compiler features
|
||||
AC_C_INLINE
|
||||
if test "$GCC" = "yes"; then
|
||||
CFLAGS="-Wall -fno-strict-aliasing $CFLAGS"
|
||||
fi
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS([errno.h fcntl.h malloc.h stdlib.h inttypes.h string.h strings.h sys/time.h unistd.h locale.h getopt.h dlfcn.h utmp.h])
|
||||
|
||||
AC_CHECK_HEADERS([zlib.h],[LIBS="$LIBS -lz"])
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_TYPE_UID_T
|
||||
|
@ -144,14 +98,19 @@ AC_FUNC_STAT
|
|||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS([getpass gettimeofday memset mkdir strdup strerror setutent vsyslog setlocale])
|
||||
|
||||
dnl C Compiler features
|
||||
AC_C_INLINE
|
||||
if test "$GCC" = "yes"; then
|
||||
CFLAGS="-Wall -fno-strict-aliasing $CFLAGS"
|
||||
fi
|
||||
AC_CHECK_HEADERS([zlib.h],[LIBS="$LIBS -lz"])
|
||||
|
||||
AC_SUBST(LIBDL)
|
||||
AC_CHECK_LIB(dl, dlopen, [LIBDL="$LIBDL -ldl" ac_cv_func_dlopen_ldl=yes], ac_cv_func_dlopen_ldl=no)
|
||||
dnl Special check for pthread support.
|
||||
ACX_PTHREAD(
|
||||
[
|
||||
AC_DEFINE(HAVE_PTHREAD,1,
|
||||
[Define if you have POSIX threads libraries and header files.])
|
||||
], [
|
||||
AC_MSG_ERROR([POSIX thread support required])
|
||||
])
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
CC="$PTHREAD_CC"
|
||||
|
||||
dnl See if socket() is found from libsocket
|
||||
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket" ac_cv_func_socket_in_lsocket=yes], ac_cv_func_socket_in_lsocket=no)
|
||||
|
@ -226,318 +185,54 @@ AC_CACHE_CHECK([for flex directory], ac_cv_flexdir, [
|
|||
ac_cv_flexdir=$flexdir
|
||||
])
|
||||
|
||||
dnl use ltdl
|
||||
AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR([libltdl not found])])
|
||||
|
||||
dnl The big mess with OpenSSL
|
||||
saved_LIBS="$LIBS"
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
|
||||
SSL_MSG="no"
|
||||
ssldir=""
|
||||
|
||||
AC_ARG_WITH(openssl,
|
||||
AC_HELP_STRING([--with-openssl=PATH], [use OpenSSL in PATH]),
|
||||
[
|
||||
# Disable OpenSSL support
|
||||
if test "x$withval" = "xno" ; then
|
||||
SSL_MSG="no (disabled)"
|
||||
break;
|
||||
fi
|
||||
|
||||
# ok we got a directory, so only check in that dir.
|
||||
LIBCRYPTO="-lcrypto"
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
LIBS="$LIBCRYPTO $saved_LIBS"
|
||||
LDFLAGS="-L$withval/lib $saved_LDFLAGS"
|
||||
if test ! -z "$need_dash_r" ; then
|
||||
LDFLAGS="-R$withval/lib $LDFLAGS"
|
||||
fi
|
||||
CPPFLAGS="-I$withval/include $saved_CPPFLAGS"
|
||||
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <string.h>
|
||||
#include <openssl/rand.h>
|
||||
int main(void)
|
||||
{
|
||||
char a[2048];
|
||||
memset(a, 0, sizeof(a));
|
||||
RAND_add(a, sizeof(a), sizeof(a));
|
||||
return(RAND_status() <= 0);
|
||||
}
|
||||
],
|
||||
[
|
||||
SSL_MSG="yes"
|
||||
ssldir="$withval"
|
||||
break
|
||||
])
|
||||
],[
|
||||
|
||||
# we didn't get a directory, so we start searching for openssl
|
||||
for tryssldir in $commondir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl; do
|
||||
# Skip directories if they don't exist
|
||||
if test ! -d "$tryssldir/" ; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
LIBCRYPTO="-lcrypto"
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
LIBS="$saved_LIBS $LIBCRYPTO"
|
||||
|
||||
if test "x$tryssldir" != "x/usr"; then
|
||||
LDFLAGS="-L$tryssldir/lib $saved_LDFLAGS"
|
||||
if test ! -z "$need_dash_r" ; then
|
||||
LDFLAGS="-R$tryssldir/lib $LDFLAGS"
|
||||
fi
|
||||
CPPFLAGS="-I$tryssldir/include $saved_CPPFLAGS"
|
||||
fi
|
||||
|
||||
# Basic test to check for compatible version and correct linking
|
||||
# *does not* test for RSA - that comes later.
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <string.h>
|
||||
#include <openssl/rand.h>
|
||||
int main(void)
|
||||
{
|
||||
char a[2048];
|
||||
memset(a, 0, sizeof(a));
|
||||
RAND_add(a, sizeof(a), sizeof(a));
|
||||
return(RAND_status() <= 0);
|
||||
}
|
||||
],
|
||||
[
|
||||
SSL_MSG="yes"
|
||||
ssldir=$tryssldir
|
||||
break;
|
||||
],
|
||||
[
|
||||
SSL_MSG="no"
|
||||
LIBS="$saved_LIBS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
])
|
||||
done
|
||||
PKG_CHECK_MODULES(OPENCT, [openct], [
|
||||
OPENCT_MSG=yes
|
||||
AC_DEFINE(HAVE_OPENCT, 1, [Have OpenCT libraries and header files])
|
||||
], [
|
||||
OPENCT_MSG=no
|
||||
])
|
||||
LIBS="$saved_LIBS"
|
||||
AC_SUBST(LIBCRYPTO)
|
||||
AM_CONDITIONAL(HAVE_SSL, test "x$SSL_MSG" = "xyes")
|
||||
AC_SUBST(OPENCT_CFLAGS)
|
||||
AC_SUBST(OPENCT_LIBS)
|
||||
|
||||
if test "x$SSL_MSG" = "xyes" ; then
|
||||
AC_DEFINE(HAVE_OPENSSL, 1, [Have OpenSSL libraries])
|
||||
else
|
||||
LIBCRYPTO=""
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_OPENCT, test "x$OPENCT_MSG" = "xyes")
|
||||
|
||||
# ok, we checked for basic ssl support.
|
||||
# if it is not available, we can skip the rest of
|
||||
# the test. also we have $ssldir set to the location
|
||||
# of the openssl libs.
|
||||
PKG_CHECK_MODULES(OPENSSL, [openssl], [
|
||||
OPENSSL_MSG=yes
|
||||
AC_DEFINE(HAVE_OPENSSL, 1, [Have OpenSSL libraries and header files])
|
||||
], [
|
||||
OPENSSL_MSG=no
|
||||
])
|
||||
AC_SUBST(OPENSSL_CFLAGS)
|
||||
AC_SUBST(OPENSSL_LIBS)
|
||||
|
||||
ENGINE_MSG="no"
|
||||
if test "x$SSL_MSG" = "xyes"; then
|
||||
# engine has to be there and working
|
||||
LIBS="$saved_LIBS $LIBCRYPTO $LIBDL"
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <string.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/rand.h>
|
||||
int main(void)
|
||||
{
|
||||
char a[2048];
|
||||
ENGINE *e;
|
||||
|
||||
e = ENGINE_new();
|
||||
ENGINE_load_dynamic();
|
||||
if (!e) return 1;
|
||||
memset(a, 0, sizeof(a));
|
||||
RAND_add(a, sizeof(a), sizeof(a));
|
||||
return(RAND_status() <= 0);
|
||||
}
|
||||
],
|
||||
[
|
||||
ENGINE_MSG=yes
|
||||
ENGINE_LINK="$LIBCRYPTO"
|
||||
],
|
||||
[
|
||||
ENGINE_MSG=no
|
||||
]);
|
||||
fi
|
||||
LIBS="$saved_LIBS"
|
||||
AC_SUBST(ENGINE_LINK)
|
||||
AM_CONDITIONAL(HAVE_ENGINE, test "x$ENGINE_MSG" = "xyes")
|
||||
|
||||
# ok, now we might (or not) have ssl and an engine.
|
||||
# still room for "improvements", i.e. hacks to work
|
||||
# with old engines.
|
||||
|
||||
SSLHACK_MSG=no
|
||||
if test "x$SSL_MSG" = "xyes" -a "x$ENGINE_MSG" = "xyes"; then
|
||||
# latest openssl version with engine
|
||||
# properly integrated?
|
||||
AC_MSG_CHECKING([for openssl version])
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
if(OPENSSL_VERSION_NUMBER >= 0x0090704fL) {
|
||||
exit(0);
|
||||
} else {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([good, 0.9.7d or later])
|
||||
OLD_OPENSSL=no
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([not so good, 0.9.7d or later would be better])
|
||||
OLD_OPENSSL=yes
|
||||
])
|
||||
|
||||
if test "x$OLD_OPENSSL" = "xyes"; then
|
||||
# openssl found, but version less than 0.9.7d
|
||||
# linking libcrypto.a statically possible?
|
||||
|
||||
LIBS="$saved_LIBS $ssldir/lib/libcrypto.a $LIBDL"
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
#include <string.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/rand.h>
|
||||
int main(void)
|
||||
{
|
||||
char a[2048];
|
||||
ENGINE *e;
|
||||
|
||||
e = ENGINE_new();
|
||||
ENGINE_load_dynamic();
|
||||
if (!e) return 1;
|
||||
memset(a, 0, sizeof(a));
|
||||
RAND_add(a, sizeof(a), sizeof(a));
|
||||
return(RAND_status() <= 0);
|
||||
}
|
||||
],
|
||||
[
|
||||
SSLHACK_MSG=yes
|
||||
ENGINE_LINK="$ssldir/lib/libcrypto.a"
|
||||
])
|
||||
LIBS="$saved_LIBS"
|
||||
fi
|
||||
fi
|
||||
|
||||
# now - last part to do: check if we gain anything from
|
||||
# funny parameters to link openssl with.
|
||||
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
if test "x$ENGINE_MSG" = "xyes" ; then
|
||||
for openssl_ldflag in "-Wl,-Bsymbolic" "-G -Wl,-Bsymbolic" "-shared -G -Wl,-Bsymbolic" "-Wl,-all_load"; do
|
||||
AC_MSG_CHECKING([whether we can use $openssl_ldflag])
|
||||
LDFLAGS="$saved_LDFLAGS $openssl_ldflag"
|
||||
AC_TRY_LINK(,[return 1],ac_cv_use_openssl_flag="yes",ac_cv_use_openssl_flag="no")
|
||||
AC_MSG_RESULT($ac_cv_use_openssl_flag)
|
||||
if test "$ac_cv_use_openssl_flag" = "yes"; then
|
||||
OPENSSL_LDFLAGS="$openssl_ldflag"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
AC_SUBST(OPENSSL_LDFLAGS)
|
||||
|
||||
PCSC_MSG=no
|
||||
pcsc_path=/usr
|
||||
AC_SUBST(PCSC_CFLAGS)
|
||||
AC_SUBST(PCSC_LIBS)
|
||||
AM_CONDITIONAL(HAVE_OPENSSL, test "x$OPENSSL_MSG" = "xyes")
|
||||
|
||||
case "$host" in
|
||||
*-*-darwin*)
|
||||
PCSC_MSG=yes
|
||||
PCSC_CFLAGS=""
|
||||
PCSC_LIBS="-Wl,-framework,PCSC"
|
||||
if test -n "$PCSC_LIBS" -a -n "$PCSC_LIBS"
|
||||
then
|
||||
PCSC_MSG=yes
|
||||
PCSC_CFLAGS=""
|
||||
PCSC_LIBS="-Wl,-framework,PCSC"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
saved_LIBS="$LIBS"
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
AC_ARG_WITH(pcsclite,
|
||||
AC_HELP_STRING([--with-pcsclite=PATH], [use PC/SC Lite in PATH]),
|
||||
[pcsc_path=$withval])
|
||||
if test "x$pcsc_path" = "xno"; then
|
||||
PCSC_MSG="no"
|
||||
fi
|
||||
if test "x$pcsc_path" != "xno" -a "x$PCSC_MSG" != "xyes"; then
|
||||
PKG_CHECK_MODULES(PCSC, libpcsclite, [
|
||||
PCSC_MSG="yes"
|
||||
AC_MSG_RESULT($PCSC_MSG)
|
||||
],[
|
||||
AC_MSG_CHECKING(for PC/SC Lite support (old style))
|
||||
for pcscdir in "" /pcsc /PCSC; do
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
LIBS="-lpcsclite $saved_LIBS"
|
||||
PCSC_CFLAGS=""
|
||||
|
||||
for pcsc_libdir in $pcsc_path/lib$pcscdir \
|
||||
$pcsc_path$pcscdir/lib \
|
||||
$pcsc_path$pcscdir; do
|
||||
if test -d $pcsc_libdir; then
|
||||
if test -n "${need_dash_r}"; then
|
||||
LDFLAGS="-R${pcsc_libdir}/ ${LDFLAGS}"
|
||||
fi
|
||||
LDFLAGS="-L${pcsc_libdir} ${LDFLAGS}"
|
||||
fi
|
||||
done
|
||||
|
||||
for pcsc_incdir in $pcsc_path/include$pcscdir \
|
||||
$pcsc_path$pcscdir/include \
|
||||
$pcsc_path$pcscdir; do
|
||||
if test -d $pcsc_incdir; then
|
||||
PCSC_CFLAGS="-I${pcsc_incdir}"
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
CPPFLAGS="${PCSC_CFLAGS} ${CPPFLAGS}"
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <winscard.h>],[SCardEstablishContext(0, NULL, NULL, NULL);], ac_cv_lib_pcsclite_SCardEstablishContext=yes)
|
||||
if test "x$ac_cv_lib_pcsclite_SCardEstablishContext" = "xyes"; then
|
||||
PCSC_MSG=yes
|
||||
break;
|
||||
fi
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
LIBS="$saved_LIBS"
|
||||
PCSC_CFLAGS=""
|
||||
done
|
||||
AC_MSG_RESULT($PCSC_MSG)
|
||||
if test "x$PCSC_MSG" = "xyes" ; then
|
||||
PCSC_LIBS="-lpcsclite"
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
LIBS="$saved_LIBS"
|
||||
fi
|
||||
])
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_PCSC, test "x$PCSC_MSG" = "xyes")
|
||||
if test "x$PCSC_MSG" = "xyes"; then
|
||||
PKG_CHECK_MODULES(PCSC, [libpcsclite], [
|
||||
PCSC_MSG=yes
|
||||
AC_DEFINE(HAVE_PCSC, 1, [Have PC/SC implementation])
|
||||
else
|
||||
PCSC_LIBS=""
|
||||
PCSC_CFLAGS=""
|
||||
fi
|
||||
], [
|
||||
PCSC_MSG=no
|
||||
])
|
||||
AC_SUBST(PCSC_CFLAGS)
|
||||
AC_SUBST(PCSC_LIBS)
|
||||
|
||||
AM_CONDITIONAL(HAVE_PCSC, test "x$PCSC_MSG" = "xyes")
|
||||
|
||||
saved_LIBS="$LIBS"
|
||||
if test "x$PCSC_MSG" = "xyes"; then
|
||||
CPPFLAGS="${PCSC_CFLAGS} $saved_CPPFLAGS"
|
||||
CFLAGS="$PCSC_CFLAGS $saved_CFLAGS"
|
||||
|
@ -569,93 +264,22 @@ AC_CHECK_HEADER(reader.h,
|
|||
[ #include <reader.h>])
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
|
||||
OPENCT_MSG=no
|
||||
openct_path=/usr
|
||||
AC_SUBST(OPENCT_CFLAGS)
|
||||
AC_SUBST(OPENCT_LDFLAGS)
|
||||
AC_SUBST(OPENCT_LIBS)
|
||||
|
||||
saved_LIBS="$LIBS"
|
||||
saved_CFLAGS="$CFLAGS"
|
||||
saved_LDFLAGS="$LDFLAGS"
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
AC_ARG_WITH(openct,
|
||||
AC_HELP_STRING([--with-openct=PATH], [use OpenCT in PATH]),
|
||||
[openct_path=$withval])
|
||||
if test "x$openct_path" = "xno"; then
|
||||
OPENCT_MSG="no"
|
||||
fi
|
||||
if test "x$openct_path" != "xno" -a "x$OPENCT_MSG" != "xyes"; then
|
||||
PKG_CHECK_MODULES(OPENCT, libopenct, [
|
||||
OPENCT_MSG="yes"
|
||||
AC_MSG_RESULT($OPENCT_MSG)
|
||||
],[
|
||||
AC_MSG_CHECKING(for OpenCT support (old style))
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
LIBS="$saved_LIBS"
|
||||
|
||||
OPENCT_CFLAGS="-I${openct_path}/include"
|
||||
OPENCT_LIBS="-lopenct"
|
||||
OPENCT_LDFLAGS=""
|
||||
if test -n "${need_dash_r}"; then
|
||||
OPENCT_LDFLAGS="-R${openct_path}/lib"
|
||||
fi
|
||||
OPENCT_LDFLAGS="-L${openct_path}/lib $OPENCT_LDFLAGS"
|
||||
|
||||
LIBS="$OPENCT_LIBS $saved_LIBS"
|
||||
LDFLAGS="$OPENCT_LDFLAGS $saved_LDFLAGS"
|
||||
CFLAGS="$OPENCT_CFLAGS $saved_CFLAGS"
|
||||
|
||||
AC_TRY_LINK([#include <openct/openct.h>],[ct_reader_connect(0);],OPENCT_MSG=yes,OPENCT_MSG=no)
|
||||
AC_MSG_RESULT($OPENCT_MSG)
|
||||
|
||||
CFLAGS="$saved_CFLAGS"
|
||||
LDFLAGS="$saved_LDFLAGS"
|
||||
LIBS="$saved_LIBS"
|
||||
dnl AM_PATH_LIBASSUAN([MINIMUM-VERSION,
|
||||
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
|
||||
dnl Test for libassuan and define LIBASSUAN_CFLAGS and LIBASSUAN_LIBS
|
||||
AM_PATH_LIBASSUAN( , [
|
||||
AM_CONDITIONAL(HAVE_ASSUAN, true)
|
||||
],
|
||||
[
|
||||
])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(HAVE_OPENCT, test "x$OPENCT_MSG" = "xyes")
|
||||
if test "x$OPENCT_MSG" = "xyes"; then
|
||||
AC_DEFINE(HAVE_OPENCT, 1, [Have OpenCT libraries and header files])
|
||||
else
|
||||
OPENCT_LDFLAGS=""
|
||||
OPENCT_LIBS=""
|
||||
OPENCT_CFLAGS=""
|
||||
fi
|
||||
AC_SUBST(ASSUAN_CFLAGS)
|
||||
AC_SUBST(ASSUAN_LIBS)
|
||||
|
||||
dnl enable/disable logging of sensitive apdu data
|
||||
AC_ARG_ENABLE(sensitive-logging,
|
||||
AC_HELP_STRING([--disable-sensitive-logging], [disable logging of sensitive APDU data [default=no]]),
|
||||
AC_DEFINE(OPENSC_DONT_LOG_SENSITIVE,1,[Disable logging of sensitive APDU data]))
|
||||
|
||||
### BEGIN ASSUAN SPECIFIC OPTIONS
|
||||
ASSUAN_MSG="no"
|
||||
AC_SUBST(CFLAGS_ASSUAN)
|
||||
AC_SUBST(LIBASSUAN)
|
||||
LIBASSUAN="-lassuan"
|
||||
AC_ARG_WITH(assuan,
|
||||
AC_HELP_STRING([--with-assuan=PATH], [use Assuan libraries in PATH]),
|
||||
[
|
||||
if test -n "${need_dash_r}"; then
|
||||
LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
|
||||
else
|
||||
LDFLAGS="-L${withval}/lib ${LDFLAGS}"
|
||||
fi
|
||||
CFLAGS_ASSUAN="-I${withval}/include ${CFLAGS_ASSUAN}"
|
||||
]
|
||||
)
|
||||
|
||||
AC_CHECK_LIB(assuan, assuan_pipe_connect, ASSUAN_MSG="yes", ASSUAN_MSG="no")
|
||||
if test "x$ASSUAN_MSG" != "xno" ; then
|
||||
saved_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CFLAGS_ASSUAN $CPPFLAGS"
|
||||
AC_CHECK_HEADER(assuan.h, ASSUAN_MSG="yes", ASSUAN_MSG="no")
|
||||
CPPFLAGS="$saved_CPPFLAGS"
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_ASSUAN, test "x$ASSUAN_MSG" = "xyes")
|
||||
### END ASSUAN SPECIFIC OPTIONS
|
||||
|
||||
PLUGINDIR="/usr/lib/mozilla/plugins"
|
||||
AC_ARG_WITH(plugin-dir,
|
||||
|
@ -687,19 +311,6 @@ AC_ARG_WITH(pin-entry,
|
|||
)
|
||||
AC_DEFINE_UNQUOTED(PIN_ENTRY, "$PIN_ENTRY", [PIN-entry program for OpenSC Signer])
|
||||
|
||||
dnl Check for SGML processor
|
||||
AC_ARG_WITH(docbook,
|
||||
AC_HELP_STRING([--without-docbook], [do no generate html manual (needs docbook)]),
|
||||
with_docbook=$withval)
|
||||
AC_CHECK_PROG(XSLTPROC, xsltproc, xsltproc)
|
||||
if test "x$XSLTPROC" = "x"; then
|
||||
if test "x$with_docbook" = "xyes"; then
|
||||
AC_MSG_ERROR([Docbook support requested, but cannot find xsltproc])
|
||||
fi
|
||||
with_docbook=no
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_DOCBOOK, test "x$with_docbook" = "xyes")
|
||||
|
||||
if test "x$prefix" = xNONE; then
|
||||
prefix=$ac_default_prefix
|
||||
fi
|
||||
|
@ -760,7 +371,6 @@ src/pkcs11/Makefile
|
|||
src/pkcs11/rsaref/Makefile
|
||||
src/pkcs15init/Makefile
|
||||
src/scconf/Makefile
|
||||
src/scdl/Makefile
|
||||
src/signer/Makefile
|
||||
src/signer/npinclude/Makefile
|
||||
src/tests/Makefile
|
||||
|
|
|
@ -5,5 +5,5 @@ MAINTAINERCLEANFILES = Makefile.in
|
|||
EXTRA_DIST = Makefile.mak
|
||||
|
||||
# Order IS important
|
||||
SUBDIRS = common include scconf scdl libopensc pkcs15init pkcs11 \
|
||||
SUBDIRS = common include scconf libopensc pkcs15init pkcs11 \
|
||||
tests tools openssh signer
|
||||
|
|
|
@ -19,8 +19,7 @@ DISTCLEANFILES = \
|
|||
pkcs11.h \
|
||||
keycache.h \
|
||||
pkcs15-init.h \
|
||||
scconf.h \
|
||||
scdl.h
|
||||
scconf.h
|
||||
|
||||
all-local:
|
||||
@$(RM) *.h
|
||||
|
@ -38,4 +37,3 @@ all-local:
|
|||
@$(LN_S) ${top_srcdir}/src/pkcs15init/keycache.h keycache.h
|
||||
@$(LN_S) ${top_srcdir}/src/pkcs15init/pkcs15-init.h pkcs15-init.h
|
||||
@$(LN_S) ${top_srcdir}/src/scconf/scconf.h scconf.h
|
||||
@$(LN_S) ${top_srcdir}/src/scdl/scdl.h scdl.h
|
||||
|
|
|
@ -6,8 +6,8 @@ MAINTAINERCLEANFILES = Makefile.in
|
|||
|
||||
EXTRA_DIST = Makefile.mak libopensc.pc.in libpkcs15init.pc.in libscconf.pc.in
|
||||
|
||||
INCLUDES = @CPPFLAGS@ @OPENCT_CFLAGS@ @PCSC_CFLAGS@
|
||||
AM_LDFLAGS = @OPENCT_LDFLAGS@
|
||||
INCLUDES = @CPPFLAGS@ @OPENSSL_CFLAGS@ @OPENCT_CFLAGS@ @PCSC_CFLAGS@
|
||||
AM_LDFLAGS =
|
||||
|
||||
bin_SCRIPTS = opensc-config
|
||||
|
||||
|
@ -33,7 +33,7 @@ libopensc_la_SOURCES = \
|
|||
pkcs15-netkey.c pkcs15-esteid.c pkcs15-postecert.c pkcs15-gemsafe.c \
|
||||
pkcs15-actalis.c pkcs15-atrust-acos.c
|
||||
libopensc_la_LDFLAGS = -version-info @OPENSC_LT_CURRENT@:@OPENSC_LT_REVISION@:@OPENSC_LT_AGE@
|
||||
libopensc_la_LIBADD = @LIBSCCONF@ ../scdl/libscdl.la @LIBDL@ @LIBCRYPTO@ @OPENCT_LIBS@ @PCSC_LIBS@
|
||||
libopensc_la_LIBADD = @LIBSCCONF@ @OPENSSL_LIBS@ @OPENCT_LIBS@ @PCSC_LIBS@
|
||||
|
||||
include_HEADERS = \
|
||||
opensc.h pkcs15.h emv.h \
|
||||
|
|
|
@ -37,6 +37,6 @@ all: install-headers $(TARGET)
|
|||
|
||||
!INCLUDE $(TOPDIR)\win32\Make.rules.mak
|
||||
|
||||
$(TARGET): $(OBJECTS) ..\scconf\scconf.lib ..\scdl\scdl.lib ..\common\common.lib
|
||||
$(TARGET): $(OBJECTS) ..\scconf\scconf.lib ..\common\common.lib
|
||||
perl $(TOPDIR)\win32\makedef.pl $*.def $* $(OBJECTS)
|
||||
link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET) $(OBJECTS) ..\scconf\scconf.lib ..\scdl\scdl.lib ..\common\common.lib winscard.lib $(OPENSSL_LIB) gdi32.lib
|
||||
link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET) $(OBJECTS) ..\scconf\scconf.lib ..\common\common.lib winscard.lib $(OPENSSL_LIB) gdi32.lib
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
#include <opensc/scdl.h>
|
||||
#include <ltdl.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winreg.h>
|
||||
|
@ -337,7 +337,7 @@ static void *load_dynamic_driver(sc_context_t *ctx, void **dll,
|
|||
const char *name, int type)
|
||||
{
|
||||
const char *version, *libname;
|
||||
void *handler;
|
||||
lt_dlhandle handle;
|
||||
void *(*modinit)(const char *) = NULL;
|
||||
const char *(*modversion)(void) = NULL;
|
||||
|
||||
|
@ -348,28 +348,28 @@ static void *load_dynamic_driver(sc_context_t *ctx, void **dll,
|
|||
libname = find_library(ctx, name, type);
|
||||
if (libname == NULL)
|
||||
return NULL;
|
||||
handler = scdl_open(libname);
|
||||
if (handler == NULL) {
|
||||
handle = lt_dlopen(libname);
|
||||
if (handle == NULL) {
|
||||
sc_error(ctx, "Module %s: cannot load %s library\n",name,libname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* verify correctness of module */
|
||||
modinit = (void *(*)(const char *)) scdl_get_address(handler, "sc_module_init");
|
||||
modversion = (const char *(*)(void)) scdl_get_address(handler, "sc_driver_version");
|
||||
modinit = (void *(*)(const char *)) lt_dlsym(handle, "sc_module_init");
|
||||
modversion = (const char *(*)(void)) lt_dlsym(handle, "sc_driver_version");
|
||||
if (modinit == NULL || modversion == NULL) {
|
||||
sc_error(ctx, "dynamic library '%s' is not a OpenSC module\n",libname);
|
||||
scdl_close(handler);
|
||||
lt_dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
/* verify module version */
|
||||
version = modversion();
|
||||
if (version == NULL || strncmp(version, "0.9.", strlen("0.9.")) > 0) {
|
||||
sc_error(ctx,"dynamic library '%s': invalid module version\n",libname);
|
||||
scdl_close(handler);
|
||||
lt_dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
*dll = handler;
|
||||
*dll = handle;
|
||||
sc_debug(ctx, "successfully loaded %s driver '%s'\n",
|
||||
type ? "card" : "reader", name);
|
||||
return modinit(name);
|
||||
|
@ -660,6 +660,14 @@ int sc_establish_context(sc_context_t **ctx_out, const char *app_name)
|
|||
ctx->mutex = sc_mutex_new();
|
||||
sc_debug(ctx, "===================================\n"); /* first thing in the log */
|
||||
sc_debug(ctx, "opensc version: %s\n", sc_get_version());
|
||||
|
||||
/* initialize ltdl */
|
||||
if (lt_dlinit() != 0) {
|
||||
sc_debug(ctx, "lt_dlinit failed\n");
|
||||
sc_release_context(ctx);
|
||||
return SC_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
load_reader_drivers(ctx, &opts);
|
||||
load_card_drivers(ctx, &opts);
|
||||
load_card_atrs(ctx, &opts);
|
||||
|
@ -697,12 +705,12 @@ int sc_release_context(sc_context_t *ctx)
|
|||
if (drv->ops->finish != NULL)
|
||||
drv->ops->finish(ctx, ctx->reader_drv_data[i]);
|
||||
if (drv->dll)
|
||||
scdl_close(drv->dll);
|
||||
lt_dlclose(drv->dll);
|
||||
}
|
||||
for (i = 0; ctx->card_drivers[i]; i++) {
|
||||
struct sc_card_driver *drv = ctx->card_drivers[i];
|
||||
if (drv->dll)
|
||||
scdl_close(drv->dll);
|
||||
lt_dlclose(drv->dll);
|
||||
if (drv->atr_map)
|
||||
_sc_free_atr(ctx, drv);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <opensc/scdl.h>
|
||||
#include <ltdl.h>
|
||||
|
||||
extern int sc_pkcs15emu_openpgp_init_ex(sc_pkcs15_card_t *,
|
||||
sc_pkcs15emu_opt_t *);
|
||||
|
@ -169,7 +169,7 @@ static int parse_emu_block(sc_pkcs15_card_t *p15card, scconf_block *conf)
|
|||
sc_card_t *card = p15card->card;
|
||||
sc_context_t *ctx = card->ctx;
|
||||
sc_pkcs15emu_opt_t opts;
|
||||
void *dll = NULL;
|
||||
lt_dlhandle handle = NULL;
|
||||
int (*init_func)(sc_pkcs15_card_t *);
|
||||
int (*init_func_ex)(sc_pkcs15_card_t *, sc_pkcs15emu_opt_t *);
|
||||
int r, force = 0;
|
||||
|
@ -210,14 +210,14 @@ static int parse_emu_block(sc_pkcs15_card_t *p15card, scconf_block *conf)
|
|||
sc_debug(ctx, "Loading %s\n", module_name);
|
||||
|
||||
/* try to open dynamic library */
|
||||
dll = scdl_open(module_name);
|
||||
if (!dll) {
|
||||
handle = lt_dlopen(module_name);
|
||||
if (!handle) {
|
||||
sc_debug(ctx, "unable to open dynamic library '%s'\n",
|
||||
module_name);
|
||||
return SC_ERROR_INTERNAL;
|
||||
}
|
||||
/* try to get version of the driver/api */
|
||||
get_version = (const char *(*)(void)) scdl_get_address(dll, "sc_driver_version");
|
||||
get_version = (const char *(*)(void)) lt_dlsym(handle, "sc_driver_version");
|
||||
if (!get_version || strcmp(get_version(), "0.9.3") < 0) {
|
||||
/* no sc_driver_version function => assume old style
|
||||
* init function (note: this should later give an error
|
||||
|
@ -225,13 +225,13 @@ static int parse_emu_block(sc_pkcs15_card_t *p15card, scconf_block *conf)
|
|||
/* get the init function name */
|
||||
name = scconf_get_str(conf, "function", func_name);
|
||||
|
||||
address = scdl_get_address(dll, name);
|
||||
address = lt_dlsym(handle, name);
|
||||
if (address)
|
||||
init_func = (int (*)(sc_pkcs15_card_t *)) address;
|
||||
} else {
|
||||
name = scconf_get_str(conf, "function", exfunc_name);
|
||||
|
||||
address = scdl_get_address(dll, name);
|
||||
address = lt_dlsym(handle, name);
|
||||
if (address)
|
||||
init_func_ex = (int (*)(sc_pkcs15_card_t *, sc_pkcs15emu_opt_t *)) address;
|
||||
}
|
||||
|
@ -247,14 +247,14 @@ static int parse_emu_block(sc_pkcs15_card_t *p15card, scconf_block *conf)
|
|||
if (r >= 0) {
|
||||
sc_debug(card->ctx, "%s succeeded, card bound\n",
|
||||
module_name);
|
||||
p15card->dll_handle = dll;
|
||||
p15card->dll_handle = handle;
|
||||
} else if (ctx->debug >= 4) {
|
||||
sc_debug(card->ctx, "%s failed: %s\n",
|
||||
module_name, sc_strerror(r));
|
||||
/* clear pkcs15 card */
|
||||
sc_pkcs15_card_clear(p15card);
|
||||
if (dll)
|
||||
scdl_close(dll);
|
||||
if (handle)
|
||||
lt_dlclose(handle);
|
||||
}
|
||||
|
||||
return r;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <opensc/scdl.h>
|
||||
#include <ltdl.h>
|
||||
|
||||
|
||||
static const struct sc_asn1_entry c_asn1_toki[] = {
|
||||
|
@ -678,7 +678,7 @@ int sc_pkcs15_unbind(struct sc_pkcs15_card *p15card)
|
|||
assert(p15card != NULL && p15card->magic == SC_PKCS15_CARD_MAGIC);
|
||||
SC_FUNC_CALLED(p15card->card->ctx, 1);
|
||||
if (p15card->dll_handle)
|
||||
scdl_close(p15card->dll_handle);
|
||||
lt_dlclose(p15card->dll_handle);
|
||||
sc_pkcs15_card_free(p15card);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <opensc/scdl.h>
|
||||
#include <ltdl.h>
|
||||
|
||||
#define GET_SLOT_PTR(s, i) (&(s)->slot[(i)])
|
||||
#define GET_PRIV_DATA(r) ((struct ctapi_private_data *) (r)->drv_data)
|
||||
|
@ -446,19 +446,19 @@ static int ctapi_load_module(sc_context_t *ctx,
|
|||
}
|
||||
|
||||
val = conf->name->data;
|
||||
dlh = scdl_open(val);
|
||||
dlh = lt_dlopen(val);
|
||||
if (!dlh) {
|
||||
sc_error(ctx, "Unable to open shared library '%s'\n", val);
|
||||
return -1;
|
||||
}
|
||||
|
||||
funcs.CT_init = (CT_INIT_TYPE *) scdl_get_address(dlh, "CT_init");
|
||||
funcs.CT_init = (CT_INIT_TYPE *) lt_dlsym(dlh, "CT_init");
|
||||
if (!funcs.CT_init)
|
||||
goto symerr;
|
||||
funcs.CT_close = (CT_CLOSE_TYPE *) scdl_get_address(dlh, "CT_close");
|
||||
funcs.CT_close = (CT_CLOSE_TYPE *) lt_dlsym(dlh, "CT_close");
|
||||
if (!funcs.CT_close)
|
||||
goto symerr;
|
||||
funcs.CT_data = (CT_DATA_TYPE *) scdl_get_address(dlh, "CT_data");
|
||||
funcs.CT_data = (CT_DATA_TYPE *) lt_dlsym(dlh, "CT_data");
|
||||
if (!funcs.CT_data)
|
||||
goto symerr;
|
||||
|
||||
|
@ -510,7 +510,7 @@ static int ctapi_load_module(sc_context_t *ctx,
|
|||
return 0;
|
||||
symerr:
|
||||
sc_error(ctx, "Unable to resolve CT-API symbols.\n");
|
||||
scdl_close(dlh);
|
||||
lt_dlclose(dlh);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ static int ctapi_finish(sc_context_t *ctx, void *prv_data)
|
|||
struct ctapi_module *mod = &priv->modules[i];
|
||||
|
||||
free(mod->name);
|
||||
scdl_close(mod->dlhandle);
|
||||
lt_dlclose(mod->dlhandle);
|
||||
}
|
||||
if (priv->module_count)
|
||||
free(priv->modules);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
#include <opensc/scdl.h>
|
||||
#include <ltdl.h>
|
||||
|
||||
/*
|
||||
* We keep a global shared library handle here.
|
||||
|
@ -180,7 +180,7 @@ sc_ui_get_func(sc_context_t *ctx, const char *name, void **ret)
|
|||
if (!lib_name)
|
||||
return 0;
|
||||
|
||||
sc_ui_lib_handle = scdl_open(lib_name);
|
||||
sc_ui_lib_handle = lt_dlopen(lib_name);
|
||||
if (!sc_ui_lib_handle) {
|
||||
sc_error(ctx,
|
||||
"Unable to open user interface library %s\n",
|
||||
|
@ -192,7 +192,7 @@ sc_ui_get_func(sc_context_t *ctx, const char *name, void **ret)
|
|||
if (sc_ui_lib_handle == NULL)
|
||||
return 0;
|
||||
|
||||
*ret = scdl_get_address(sc_ui_lib_handle, name);
|
||||
*ret = lt_dlsym(sc_ui_lib_handle, name);
|
||||
|
||||
return *ret ? SC_SUCCESS : SC_ERROR_UNKNOWN;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ EXTRA_DIST = Makefile.mak opensc_pkcs11_install.js
|
|||
|
||||
SUBDIRS = . rsaref
|
||||
|
||||
INCLUDES = @CPPFLAGS@ -I${top_srcdir}/src/pkcs15init
|
||||
INCLUDES = @CPPFLAGS@ -I${top_srcdir}/src/pkcs15init @OPENSSL_CFLAGS@
|
||||
|
||||
SRC = pkcs11-global.c pkcs11-session.c pkcs11-object.c misc.c slot.c \
|
||||
mechanism.c openssl.c secretkey.c framework-pkcs15.c \
|
||||
|
@ -22,16 +22,16 @@ noinst_LTLIBRARIES = libpkcs11.la
|
|||
|
||||
opensc_pkcs11_la_SOURCES = $(SRC) $(INC)
|
||||
opensc_pkcs11_la_LDFLAGS = -module -avoid-version
|
||||
opensc_pkcs11_la_LIBADD = @LIBOPENSC@ @LIBCRYPTO@ \
|
||||
opensc_pkcs11_la_LIBADD = @LIBOPENSC@ @OPENSSL_LIBS@ \
|
||||
../pkcs15init/libpkcs15init.la
|
||||
|
||||
libpkcs11_la_SOURCES = libpkcs11.c
|
||||
libpkcs11_la_LDFLAGS = -version-info @OPENSC_LT_CURRENT@:@OPENSC_LT_REVISION@:@OPENSC_LT_AGE@
|
||||
libpkcs11_la_LIBADD = ../scdl/libscdl.la @LIBDL@
|
||||
libpkcs11_la_LIBADD =
|
||||
|
||||
pkcs11_spy_la_SOURCES = pkcs11-spy.c pkcs11-display.c pkcs11-display.h
|
||||
pkcs11_spy_la_LDFLAGS = -module -avoid-version
|
||||
pkcs11_spy_la_LIBADD = @LIBOPENSC@ @LIBCRYPTO@ libpkcs11.la
|
||||
pkcs11_spy_la_LIBADD = @LIBOPENSC@ @OPENSSL_LIBS@ libpkcs11.la
|
||||
|
||||
include_HEADERS = pkcs11.h
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ all: install-headers install-headers-dir $(TARGET) $(TARGET2) $(TARGET3)
|
|||
|
||||
!INCLUDE $(TOPDIR)\win32\Make.rules.mak
|
||||
|
||||
$(TARGET): $(OBJECTS) ..\libopensc\opensc.lib ..\scconf\scconf.lib ..\pkcs15init\pkcs15init.lib ..\scdl\scdl.lib
|
||||
$(TARGET): $(OBJECTS) ..\libopensc\opensc.lib ..\scconf\scconf.lib ..\pkcs15init\pkcs15init.lib
|
||||
link $(LINKFLAGS) /dll /out:$(TARGET) $(OBJECTS) ..\libopensc\opensc.lib ..\scconf\scconf.lib ..\pkcs15init\pkcs15init.lib winscard.lib ..\scdl\scdl.lib $(OPENSSL_LIB) gdi32.lib
|
||||
|
||||
$(TARGET2): $(OBJECTS2) ..\scdl\scdl.lib
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <opensc/scdl.h>
|
||||
#include <ltdl.h>
|
||||
|
||||
#define MAGIC 0xd00bed00
|
||||
|
||||
struct sc_pkcs11_module {
|
||||
unsigned int _magic;
|
||||
void *handle;
|
||||
lt_dlhandle handle;
|
||||
};
|
||||
typedef struct sc_pkcs11_module sc_pkcs11_module_t;
|
||||
|
||||
|
@ -38,13 +38,13 @@ C_LoadModule(const char *mspec, CK_FUNCTION_LIST_PTR_PTR funcs)
|
|||
|
||||
if (mspec == NULL)
|
||||
mspec = PKCS11_DEFAULT_MODULE_NAME;
|
||||
mod->handle = scdl_open(mspec);
|
||||
mod->handle = lt_dlopen(mspec);
|
||||
if (mod->handle == NULL)
|
||||
goto failed;
|
||||
|
||||
/* Get the list of function pointers */
|
||||
c_get_function_list = (CK_RV (*)(CK_FUNCTION_LIST_PTR_PTR))
|
||||
scdl_get_address(mod->handle, "C_GetFunctionList");
|
||||
lt_dlsym(mod->handle, "C_GetFunctionList");
|
||||
if (!c_get_function_list)
|
||||
goto failed;
|
||||
rv = c_get_function_list(funcs);
|
||||
|
@ -69,7 +69,7 @@ C_UnloadModule(void *module)
|
|||
if (!mod || mod->_magic != MAGIC)
|
||||
return CKR_ARGUMENTS_BAD;
|
||||
|
||||
if (scdl_close(mod->handle) < 0)
|
||||
if (lt_dlclose(mod->handle) < 0)
|
||||
return CKR_FUNCTION_FAILED;
|
||||
|
||||
memset(mod, 0, sizeof(*mod));
|
||||
|
|
|
@ -16,4 +16,4 @@ all: install-headers $(TARGET)
|
|||
|
||||
$(TARGET): $(OBJECTS)
|
||||
perl $(TOPDIR)\win32\makedef.pl $*.def $* $(OBJECTS)
|
||||
link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET) $(OBJECTS) ..\scconf\scconf.lib ..\scdl\scdl.lib ..\common\common.lib ..\libopensc\opensc.lib winscard.lib $(OPENSSL_LIB) gdi32.lib
|
||||
link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET) $(OBJECTS) ..\scconf\scconf.lib ..\common\common.lib ..\libopensc\opensc.lib winscard.lib $(OPENSSL_LIB) gdi32.lib
|
||||
|
|
|
@ -55,12 +55,12 @@
|
|||
#include <openssl/rsa.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#endif
|
||||
#include <ltdl.h>
|
||||
#include <opensc/pkcs15.h>
|
||||
#include "profile.h"
|
||||
#include "pkcs15-init.h"
|
||||
#include <opensc/cardctl.h>
|
||||
#include <opensc/log.h>
|
||||
#include <opensc/scdl.h>
|
||||
|
||||
#define OPENSC_INFO_FILEPATH "3F0050154946"
|
||||
#define OPENSC_INFO_FILEID 0x4946
|
||||
|
@ -230,35 +230,35 @@ static void *load_dynamic_driver(sc_context_t *ctx, void **dll,
|
|||
const char *name)
|
||||
{
|
||||
const char *version, *libname;
|
||||
void *handler;
|
||||
lt_dlhandle handle;
|
||||
void *(*modinit)(const char *) = NULL;
|
||||
const char *(*modversion)(void) = NULL;
|
||||
|
||||
libname = find_library(ctx, name);
|
||||
if (!libname)
|
||||
return NULL;
|
||||
handler = scdl_open(libname);
|
||||
if (handler == NULL) {
|
||||
handle = lt_dlopen(libname);
|
||||
if (handle == NULL) {
|
||||
sc_error(ctx, "Module %s: cannot load %s library\n",name,libname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* verify correctness of module */
|
||||
modinit = (void *(*)(const char *)) scdl_get_address(handler, "sc_module_init");
|
||||
modversion = (const char *(*)(void)) scdl_get_address(handler, "sc_driver_version");
|
||||
modinit = (void *(*)(const char *)) lt_dlsym(handle, "sc_module_init");
|
||||
modversion = (const char *(*)(void)) lt_dlsym(handle, "sc_driver_version");
|
||||
if (modinit == NULL || modversion == NULL) {
|
||||
sc_error(ctx, "dynamic library '%s' is not a OpenSC module\n",libname);
|
||||
scdl_close(handler);
|
||||
lt_dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
/* verify module version */
|
||||
version = modversion();
|
||||
if (version == NULL || strncmp(version, "0.9.", strlen("0.9.")) > 0) {
|
||||
sc_error(ctx,"dynamic library '%s': invalid module version\n",libname);
|
||||
scdl_close(handler);
|
||||
lt_dlclose(handle);
|
||||
return NULL;
|
||||
}
|
||||
*dll = handler;
|
||||
*dll = handle;
|
||||
sc_debug(ctx, "successfully loaded pkcs15init driver '%s'\n", name);
|
||||
|
||||
return modinit(name);
|
||||
|
@ -360,7 +360,7 @@ sc_pkcs15init_unbind(struct sc_profile *profile)
|
|||
sc_error(ctx, "Failed to update TokenInfo: %s\n", sc_strerror(r));
|
||||
}
|
||||
if (profile->dll)
|
||||
scdl_close(profile->dll);
|
||||
lt_dlclose(profile->dll);
|
||||
sc_profile_free(profile);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,16 +9,16 @@ SUBDIRS = . npinclude
|
|||
|
||||
EXTRA_DIST = testprog.c
|
||||
|
||||
INCLUDES = @CPPFLAGS@ @CFLAGS_ASSUAN@ -I$(top_srcdir)/src/signer/npinclude
|
||||
INCLUDES = @CPPFLAGS@ @OPENSSL_CFLAGS@ @ASSUAN_CFLAGS@ -I$(srcdir)/npinclude
|
||||
|
||||
if HAVE_SSL
|
||||
if HAVE_OPENSSL
|
||||
if HAVE_ASSUAN
|
||||
lib_LTLIBRARIES = opensc-signer.la
|
||||
endif
|
||||
endif
|
||||
|
||||
opensc_signer_la_LDFLAGS = -module -avoid-version
|
||||
opensc_signer_la_LIBADD = @LIBOPENSC@ @LIBCRYPTO@ @LIBASSUAN@
|
||||
opensc_signer_la_LIBADD = @LIBOPENSC@ @OPENSSL_LIBS@ @ASSUAN_LIBS@
|
||||
opensc_signer_la_CFLAGS = $(AM_CFLAGS) -DXP_UNIX
|
||||
opensc_signer_la_SOURCES = \
|
||||
opensc-crypto.c opensc-support.c signer.c stubs.c dialog.c
|
||||
|
@ -26,7 +26,7 @@ noinst_HEADERS = \
|
|||
opensc-crypto.h opensc-support.h signer.h
|
||||
|
||||
install-exec-local: install-libLTLIBRARIES
|
||||
if HAVE_SSL
|
||||
if HAVE_OPENSSL
|
||||
if HAVE_ASSUAN
|
||||
-$(LN_S) -f $(libdir)/opensc-signer.so $(DESTDIR)$(plugindir)/
|
||||
endif
|
||||
|
|
|
@ -6,13 +6,13 @@ EXTRA_DIST = Makefile.mak
|
|||
|
||||
AM_LDFLAGS = @LIBOPENSC@
|
||||
|
||||
if HAVE_SSL
|
||||
PROGRAMS_SSL = cryptoflex-tool pkcs15-init netkey-tool
|
||||
if HAVE_OPENSSL
|
||||
PROGRAMS_OPENSSL = cryptoflex-tool pkcs15-init netkey-tool
|
||||
endif
|
||||
|
||||
bin_PROGRAMS = opensc-tool opensc-explorer pkcs15-tool pkcs15-crypt \
|
||||
pkcs11-tool cardos-info eidenv \
|
||||
$(PROGRAMS_SSL)
|
||||
$(PROGRAMS_OPENSSL)
|
||||
|
||||
opensc_tool_SOURCES = opensc-tool.c util.c
|
||||
opensc_tool_LDADD = @GETOPTSRC@
|
||||
|
@ -21,18 +21,18 @@ opensc_explorer_LDADD = @GETOPTSRC@ @LIBREADLINE@
|
|||
pkcs15_tool_SOURCES = pkcs15-tool.c util.c
|
||||
pkcs15_tool_LDADD = @GETOPTSRC@
|
||||
pkcs11_tool_SOURCES = pkcs11-tool.c util.c
|
||||
pkcs11_tool_LDADD = @GETOPTSRC@ ../pkcs11/libpkcs11.la @LIBCRYPTO@
|
||||
pkcs11_tool_LDADD = @GETOPTSRC@ ../pkcs11/libpkcs11.la @OPENSSL_LIBS@
|
||||
pkcs15_crypt_SOURCES = pkcs15-crypt.c util.c
|
||||
pkcs15_crypt_LDADD = @GETOPTSRC@ @LIBCRYPTO@
|
||||
pkcs15_crypt_LDADD = @GETOPTSRC@ @OPENSSL_LIBS@
|
||||
cryptoflex_tool_SOURCES = cryptoflex-tool.c util.c
|
||||
cryptoflex_tool_LDADD = @GETOPTSRC@ @LIBCRYPTO@
|
||||
cryptoflex_tool_LDADD = @GETOPTSRC@ @OPENSSL_LIBS@
|
||||
pkcs15_init_SOURCES = pkcs15-init.c util.c
|
||||
pkcs15_init_LDADD = @GETOPTSRC@ @LIBCRYPTO@ ../pkcs15init/libpkcs15init.la
|
||||
pkcs15_init_LDADD = @GETOPTSRC@ @OPENSSL_LIBS@ ../pkcs15init/libpkcs15init.la
|
||||
cardos_info_SOURCES = cardos-info.c util.c
|
||||
cardos_info_LDADD = @GETOPTSRC@
|
||||
eidenv_SOURCES = eidenv.c
|
||||
eidenv_LDADD = @GETOPTSRC@
|
||||
netkey_tool_SOURCES = netkey-tool.c
|
||||
netkey_tool_LDADD = @GETOPTSRC@ @LIBCRYPTO@
|
||||
netkey_tool_LDADD = @GETOPTSRC@ @OPENSSL_LIBS@
|
||||
|
||||
noinst_HEADERS = util.h
|
||||
|
|
Loading…
Reference in New Issue