- added customization via OPENSC_CONFIGURE

- changed information regarding opensc
- fixed pkg-config file


git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@389 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2011-01-15 10:43:52 +00:00
parent 9985ee7e60
commit 0a4782842b
7 changed files with 48 additions and 54 deletions

View File

@@ -1,15 +1,16 @@
/** @mainpage
Welcome to ccid. The purpose of ccid is to forward a PCSC smartcard reader
as a standard USB CCID reader. If the host system is in USB device mode, ccid
forwards the local reader via USB to an other device. If in USB host mode,
ccid virtually plugges in a USB CCID reader to the host system. ccid has
support for Password Authenticated Connection Establishment (PACE) using
OpenPACE (http://sourceforge.net/projects/openpace/).
Welcome to ccid-emulator. The purpose of ccid-emulator is to forward a PCSC
smartcard reader as a standard USB CCID reader. If the host system is in USB
device mode, ccid-emulator forwards the local reader via USB to an other
device. If in USB host mode, ccid-emulator virtually plugges in a USB CCID
reader to the host system. ccid-emulator has support for Password
Authenticated Connection Establishment (PACE) using OpenPACE
(http://sourceforge.net/projects/openpace/).
ccid is implemented using GadgetFS. Some fragments of the source code is based
on the GadgetFS example at http://www.linux-usb.org/gadget/ and on the source
code of the OpenSC tools.
ccid-emulator is implemented using GadgetFS. Some fragments of the source code
is based on the GadgetFS example at http://www.linux-usb.org/gadget/ and on the
source code of the OpenSC tools.
@section i INSTALLATION
@@ -32,27 +33,20 @@ https://docs.openmoko.org/trac/ticket/2240).
@subsection o HINTS ON OPENSC
ccid links against libopensc, which is discouraged and hindered since
opensc>=0.12. We really need to get rid of this dependency. But since this is a
lot of work, you will have to use older versions of opensc.
OpenSC older than r4244 will yield something like this error:
[default] apdu.c:341:sc_check_apdu: Invalid Case 4 short APDU:
cse=04 cla=10 ins=86 p1=00 p2=00 lc=2 le=0
resp=0x10353c0 resplen=256 data=0x1034a30 datalen=2
[default] pace.c:1110:EstablishPACEChannel: Could not get encrypted nonce from card (General Authenticate step 1 failed).
This requires the following patch:
http://www.opensc-project.org/opensc/raw-attachment/ticket/209/le0.patch
The following patch makes the hex dumped output more readable:
http://www.opensc-project.org/opensc/raw-attachment/ticket/263/hex_dump_align.2.patch
ccid-emulator links against libopensc, which is discouraged and hindered since
opensc>=0.12. We really need to get rid of this dependency. But so far we
manually build it to have libopensc for linking. The good thing is that you
don't need any opensc components to be installed. The bad thing is, that
ccid-emulator configures and builds opensc on its own. So you might need to
pass some extra configure options to opensc. So if you need to pass options to
opensc, use something like the following command:
./configure \
OPENSC_CONFIGURE="options"
@subsection o HINTS ON LIBPACE
@subsection l HINTS ON LIBPACE
If you have a local build of OpenSSL with OpenPACE, that you want to link
If you have a local build of libpace and OpenPACE, that you want to link
against use something like the following command:
./configure \
OPENSSL_CFLAGS="-I/path/to/openssl-1.0.0c_with_openpace-0.4/include" \

View File

@@ -46,26 +46,22 @@ if test "x$enable_ccid" != xno ; then
enable_ccid=yes
fi
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
AM_CONDITIONAL(WITH_CCID, test "${enable_ccid}" != "no")
PKG_CHECK_EXISTS([libssl],
[PKG_CHECK_MODULES([OPENSSL], [libssl])],
[PKG_CHECK_MODULES([OPENSSL], [libssl >= 1.0.0])],
[AC_MSG_WARN([libssl not found by pkg-config])])
saved_CPPFLAGS="$CPPFLAGS"
saved_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $OPENSSL_CFLAGS"
LIBS="$LDFLAGS $OPENSSL_LIBS"
AC_CHECK_HEADERS(openssl/evp.h, [], [ AC_MSG_ERROR([openssl/evp.h not found, install OpenSSL or use ./configure OPENSSL_CFLAGS=...]) ])
AC_CHECK_HEADERS(openssl/evp.h, [], [ AC_MSG_ERROR([openssl/evp.h not found, install OpenSSL >= 1.0.0 or use ./configure OPENSSL_CFLAGS=...]) ])
AC_MSG_CHECKING([for EVP_read_pw_string_min])
AC_TRY_LINK_FUNC(EVP_read_pw_string_min, [ AC_MSG_RESULT([yes]) ], [ AC_MSG_ERROR([OpenSSL not found, use ./configure OPENSSL_LIBS=...]) ])
AC_TRY_LINK_FUNC(EVP_read_pw_string_min, [ AC_MSG_RESULT([yes]) ], [ AC_MSG_ERROR([OpenSSL >= 1.0.0 not found, use ./configure OPENSSL_LIBS=...]) ])
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LIBS)
# --enable-pace
AC_ARG_ENABLE(pace,
@@ -138,6 +134,9 @@ fi
AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
AC_SUBST(OPENSC_CONFIGURE)
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h memory.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h])
@@ -179,6 +178,7 @@ LIBPACE_CFLAGS: ${LIBPACE_CFLAGS}
LIBPACE_LIBS: ${LIBPACE_LIBS}
PCSC_CFLAGS: ${PCSC_CFLAGS}
PCSC_LIBS: ${PCSC_LIBS}
OPENSC_CONFIGURE: ${OPENSC_CONFIGURE}
CCID emulator: ${enable_ccid}
PACE support: ${enable_pace}

View File

@@ -25,7 +25,7 @@ opensc: opensc-$(OPENSCVERSION)
cd $(top_builddir)/src && cp -r opensc-$(OPENSCVERSION) opensc
libopensc.la: opensc
cd $(top_builddir)/src/opensc && ./configure
cd $(top_builddir)/src/opensc && ./configure $(OPENSC_CONFIGURE)
$(MAKE) -C opensc
cp $(top_builddir)/src/opensc/src/libopensc/.libs/libopensc* $(top_builddir)/src

View File

@@ -19,22 +19,20 @@ See file INSTALL.
@subsection o HINTS ON OPENSC
npa links against libopensc, which is discouraged and hindered since
opensc>=0.12. We really need to get rid of this dependency. But since this is a
lot of work, you will have to use older versions of opensc.
libnpa links against libopensc, which is discouraged and hindered since
opensc>=0.12. We really need to get rid of this dependency. But so far we
manually build it to have libopensc for linking. The good thing is that you
don't need any opensc components to be installed. The bad thing is, that libnpa
configures and builds opensc on its own. So you might need to pass some extra
configure options to opensc. So if you need to pass options to opensc, use
something like the following command:
./configure \
OPENSC_CONFIGURE="options"
OpenSC older than r4244 will yield something like this error:
[default] apdu.c:341:sc_check_apdu: Invalid Case 4 short APDU:
cse=04 cla=10 ins=86 p1=00 p2=00 lc=2 le=0
resp=0x10353c0 resplen=256 data=0x1034a30 datalen=2
[default] pace.c:1110:EstablishPACEChannel: Could not get encrypted nonce from card (General Authenticate step 1 failed).
This requires the following patch:
http://www.opensc-project.org/opensc/raw-attachment/ticket/209/le0.patch
The following patch makes the hex dumped output more readable:
http://www.opensc-project.org/opensc/raw-attachment/ticket/263/hex_dump_align.2.patch
Worse gets the situation if you need to link against libnpa and some opensc
library at the same time. This will yield conflicts since functionality of
libopensc is linked into both libraries. This is possible (see ccid-emulator),
but not recommended. Only do this if you know what you are doing.
@subsection o HINTS ON OPENSSL

View File

@@ -39,8 +39,6 @@ AC_TRY_LINK_FUNC(parse_ef_card_access, [ AC_MSG_RESULT([yes]) ], [ AC_MSG_ERROR(
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
AC_SUBST(OPENSSL_CFLAGS)
AC_SUBST(OPENSSL_LIBS)
AC_DEFINE(BUERGERCLIENT_WORKAROUND, 1, [Always get EF.CardAccess, when connecting to a smart card. This is a workaround for the recent Buergerclient])
@@ -58,6 +56,9 @@ fi
AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
AC_SUBST(OPENSC_CONFIGURE)
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h memory.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h])
@@ -93,6 +94,7 @@ Linker flags: ${LDFLAGS}
Libraries: ${LIBS}
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
OPENSSL_LIBS: ${OPENSSL_LIBS}
OPENSC_CONFIGURE: ${OPENSC_CONFIGURE}
Documentation: ${enable_doc}

View File

@@ -6,6 +6,6 @@ includedir=@includedir@
Name: libpace
Description: Password Authenticated Connection Establishment (PACE) library
Version: @VERSION@
Requires: libopensc libssl
Requires: libssl
Libs: -L${libdir} -lpace
Cflags: -I${includedir}

View File

@@ -18,7 +18,7 @@ opensc: opensc-$(OPENSCVERSION)
cd $(top_builddir)/src && cp -r opensc-$(OPENSCVERSION) opensc
libopensc.la: opensc
cd $(top_builddir)/src/opensc && ./configure
cd $(top_builddir)/src/opensc && ./configure $(OPENSC_CONFIGURE)
$(MAKE) -C opensc
cp $(top_builddir)/src/opensc/src/libopensc/.libs/libopensc* $(top_builddir)/src