diff --git a/ChangeLog b/ChangeLog index 42fe782af..d83d94cde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ Released 1.9.10. + * configure.ac: Define AM conditional HAVE_OPENSC. + 2004-07-21 Werner Koch * configure.ac: Don't set DIE to no after it might has been set to diff --git a/configure.ac b/configure.ac index 87c015033..94760f529 100644 --- a/configure.ac +++ b/configure.ac @@ -471,6 +471,7 @@ if test $have_opensc = yes; then AC_DEFINE(HAVE_OPENSC,1, [defined if the OpenSC library is available]) fi +AM_CONDITIONAL(HAVE_OPENSC, test "$have_opensc" = "yes") # # Check whether the (highly desirable) GNU Pth library is available diff --git a/scd/ChangeLog b/scd/ChangeLog index 3a634b92b..cb759c0b2 100644 --- a/scd/ChangeLog +++ b/scd/ChangeLog @@ -1,5 +1,10 @@ 2004-07-22 Werner Koch + * Makefile.am: Make OpenSC lib link after libgcrypt. Do not link + to pth. + * apdu.c: Don't use Pth if we use OpenSC. + * sc-investigate.c, scdaemon.c: Disable use of pth if OpenSC is used. + * scdaemon.c (main): Bumbed thread stack size up to 512k. 2004-07-16 Werner Koch diff --git a/scd/Makefile.am b/scd/Makefile.am index c3c603d28..e3dfbf0b6 100644 --- a/scd/Makefile.am +++ b/scd/Makefile.am @@ -25,6 +25,13 @@ AM_CPPFLAGS = -I$(top_srcdir)/intl -I$(top_srcdir)/common include $(top_srcdir)/am/cmacros.am +# avoid linking against Pth if we are using OpenSC. +if HAVE_OPENSC +pth_libs = +else +pth_libs = $(PTH_LIBS) +endif + AM_CFLAGS = $(OPENSC_CFLAGS) $(LIBGCRYPT_CFLAGS) \ $(KSBA_CFLAGS) $(LIBASSUAN_CFLAGS) $(PTH_CFLAGS) @@ -44,9 +51,9 @@ scdaemon_SOURCES = \ scdaemon_LDADD = ../jnlib/libjnlib.a ../common/libcommon.a \ - $(OPENSC_LIBS) $(LIBGCRYPT_LIBS) $(PTH_LIBS) \ + $(LIBGCRYPT_LIBS) $(pth_libs) \ $(KSBA_LIBS) $(LIBASSUAN_LIBS) \ - $(LIBUSB_LIBS) -lgpg-error @INTLLIBS@ -ldl + $(LIBUSB_LIBS) $(OPENSC_LIBS) -lgpg-error @INTLLIBS@ -ldl sc_investigate_SOURCES = \ sc-investigate.c scdaemon.h \ @@ -59,8 +66,8 @@ sc_investigate_SOURCES = \ sc_investigate_LDADD = \ ../jnlib/libjnlib.a ../common/libcommon.a \ - $(OPENSC_LIBS) $(LIBGCRYPT_LIBS) $(PTH_LIBS) \ - $(KSBA_LIBS) $(LIBUSB_LIBS) \ + $(LIBGCRYPT_LIBS) $(pth_libs) \ + $(KSBA_LIBS) $(LIBUSB_LIBS) $(OPENSC_LIBS) \ @INTLLIBS@ -lgpg-error -ldl @@ -76,10 +83,10 @@ sc_copykeys_SOURCES = \ sc_copykeys_LDADD = \ ../jnlib/libjnlib.a ../common/libcommon.a \ ../common/libsimple-pwquery.a \ - $(OPENSC_LIBS) $(LIBGCRYPT_LIBS) $(PTH_LIBS) \ - $(KSBA_LIBS) $(LIBUSB_LIBS) \ + $(LIBGCRYPT_LIBS) $(pth_libs) \ + $(KSBA_LIBS) $(LIBUSB_LIBS) $(OPENSC_LIBS) \ -lgpg-error @INTLLIBS@ -ldl pcsc_wrapper_SOURCES = pcsc-wrapper.c pcsc_wrapper_LDADD = -ldl -pcsc_wrapper_CFLAGS = \ No newline at end of file +pcsc_wrapper_CFLAGS = diff --git a/scd/apdu.c b/scd/apdu.c index cc9b213fb..28d32ad2c 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -19,6 +19,7 @@ */ #include + #include #include #include @@ -31,6 +32,9 @@ #endif #ifdef HAVE_OPENSC # include +# ifdef USE_GNU_PTH +# undef USE_GNU_PTH +# endif #endif /* If requested include the definitions for the remote APDU protocol diff --git a/scd/sc-investigate.c b/scd/sc-investigate.c index be985533c..8d34ab77e 100644 --- a/scd/sc-investigate.c +++ b/scd/sc-investigate.c @@ -90,12 +90,12 @@ static ARGPARSE_OPTS opts[] = { {0} }; - +#ifndef HAVE_OPENSC #ifdef USE_GNU_PTH /* Pth wrapper function definitions. */ GCRY_THREAD_OPTION_PTH_IMPL; #endif /*USE_GNU_PTH*/ - +#endif /*!HAVE_OPENSC*/ static void interactive_shell (int slot); static void dump_other_cards (int slot); @@ -160,8 +160,10 @@ main (int argc, char **argv ) /* Try to auto set the character set. */ set_native_charset (NULL); - /* Libgcrypt requires us to register the threading model first. - Note that this will also do the pth_init. */ + /* Libgcrypt requires us to register the threading model first. We + can't use pth at all if we are using OpenSC becuase OpenSC uses + ptreads. Note that this will also do the pth_init. */ +#ifndef HAVE_OPENSC #ifdef USE_GNU_PTH rc = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth); if (rc) @@ -170,6 +172,7 @@ main (int argc, char **argv ) gpg_strerror (rc)); } #endif /*USE_GNU_PTH*/ +#endif /*!HAVE_OPENSC*/ /* Check that the libraries are suitable. Do it here because the option parsing may need services of the library */ diff --git a/scd/scdaemon.c b/scd/scdaemon.c index b0038de16..f647aecc2 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -144,13 +144,14 @@ static int maybe_setuid = 1; static char socket_name[128]; +#ifndef HAVE_OPENSC #ifdef USE_GNU_PTH /* Pth wrapper function definitions. */ GCRY_THREAD_OPTION_PTH_IMPL; static void *ticker_thread (void *arg); #endif /*USE_GNU_PTH*/ - +#endif /*!HAVE_OPENSC*/ static const char * my_strusage (int level) @@ -336,6 +337,7 @@ main (int argc, char **argv ) /* Libgcrypt requires us to register the threading model first. Note that this will also do the pth_init. */ +#ifndef HAVE_OPENSC #ifdef USE_GNU_PTH err = gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pth); if (err) @@ -344,6 +346,7 @@ main (int argc, char **argv ) gpg_strerror (err)); } #endif /*USE_GNU_PTH*/ +#endif /*!HAVE_OPENSC*/ /* Check that the libraries are suitable. Do it here because the option parsing may need services of the library */ @@ -598,6 +601,7 @@ main (int argc, char **argv ) if (pipe_server) { /* This is the simple pipe based server */ +#ifndef HAVE_OPENSC #ifdef USE_GNU_PTH pth_attr_t tattr; @@ -612,6 +616,7 @@ main (int argc, char **argv ) scd_exit (2); } #endif /*USE_GNU_PTH*/ +#endif /*!HAVE_OPENSC*/ scd_command_handler (-1); } else if (!is_daemon) @@ -827,6 +832,7 @@ scd_init_default_ctrl (CTRL ctrl) } +#ifndef HAVE_OPENSC #ifdef USE_GNU_PTH static void @@ -931,3 +937,4 @@ ticker_thread (void *dummy_arg) pth_event_free (sigs_ev, PTH_FREE_ALL); } #endif /*USE_GNU_PTH*/ +#endif /*!HAVE_OPENSC*/