include OpenSC as submodule

This commit is contained in:
Frank Morgner
2012-12-16 04:07:45 +01:00
parent fe155bb002
commit d479420463
11 changed files with 157 additions and 144 deletions

View File

@@ -47,19 +47,25 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
# Checks for libraries.
PKG_CHECK_EXISTS([libopensc],
[PKG_CHECK_MODULES([OPENSC], [libopensc >= 0.12.1 ])],
[AC_MSG_WARN([libopensc >= 0.12.1 not found by pkg-config])])
test -z "$OPENSC_LIBS" && OPENSC_LIBS="-lopensc"
test -z "$OPENSC_CFLAGS" && OPENSC_CFLAGS="-I${PWD}/${srcdir}/src/opensc/src -DENABLE_SM"
saved_CPPFLAGS="$CPPFLAGS"
saved_LIBS="$LIBS"
CPPFLAGS="$OPENSC_CFLAGS $CPPFLAGS"
LIBS="$LDFLAGS $OPENSC_LIBS"
AC_CHECK_HEADERS([libopensc/opensc.h libopensc/sm.h libopensc/pace.h],
[], [AC_MSG_ERROR([OpenSC headers not found])])
AC_MSG_CHECKING([for iasecc_sm_external_authentication])
AC_TRY_LINK_FUNC(iasecc_sm_external_authentication, [ AC_MSG_RESULT([yes]) ],
[ AC_MSG_ERROR([libopensc configured with SM (git clone git://github.com/frankmorgner/OpenSC.git) not found, use ./configure OPENSC_LIBS=...]) ])
AC_TRY_LINK_FUNC(iasecc_sm_external_authentication,
[ AC_MSG_RESULT([yes]) ],
[ AC_MSG_ERROR([Cannot link against libopensc with SM]) ])
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
AC_SUBST([OPENSC_LIBS])
AC_SUBST([OPENSC_CFLAGS])
PKG_CHECK_EXISTS([libcrypto],
@@ -71,16 +77,18 @@ 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 headers not found]) ])
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([Cannot link against libcrypto]) ])
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
PKG_CHECK_EXISTS([libeac],
[PKG_CHECK_MODULES([OPENPACE], [libeac])],
PKG_CHECK_EXISTS([libeac], [PKG_CHECK_MODULES([OPENPACE], [libeac])],
[AC_MSG_WARN([libeac not found by pkg-config])])
saved_CPPFLAGS="$CPPFLAGS"
@@ -88,9 +96,11 @@ saved_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $OPENPACE_CFLAGS"
LIBS="$LDFLAGS $OPENPACE_LIBS"
AC_CHECK_HEADERS(eac/eac.h, [], [ AC_MSG_ERROR([eac/eac.h not found, install OpenPACE or use ./configure OPENSSL_CFLAGS=...]) ])
AC_CHECK_HEADERS(eac/eac.h, [],
[ AC_MSG_ERROR([OpenPACE headers not found]) ])
AC_MSG_CHECKING([for EAC_CTX_init_pace])
AC_TRY_LINK_FUNC(EAC_CTX_init_pace, [ AC_MSG_RESULT([yes]) ], [ AC_MSG_ERROR([OpenPACE not found, use ./configure OPENPACE_LIBS=...]) ])
AC_TRY_LINK_FUNC(EAC_CTX_init_pace, [ AC_MSG_RESULT([yes]) ],
[ AC_MSG_ERROR([Cannot link against libeac]) ])
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
@@ -131,6 +141,7 @@ Preprocessor flags: ${CPPFLAGS}
Linker flags: ${LDFLAGS}
Libraries: ${LIBS}
OPENSC_LIBS: ${OPENSC_LIBS}
OPENSC_CFLAGS: ${OPENSC_CFLAGS}
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
OPENSSL_LIBS: ${OPENSSL_LIBS}
OPENPACE_CFLAGS: ${OPENPACE_CFLAGS}

View File

@@ -1,7 +1,6 @@
.. highlight:: sh
.. _OpenSC: http://www.opensc-project.org
.. _OpenSC with PACE: http://github.com/frankmorgner/OpenSC
.. _OpenSC: https://github.com/OpenSC/OpenSC
.. _OpenSSL: http://www.openssl.org
.. _OpenPACE: http://openpace.sourceforge.net
@@ -30,8 +29,10 @@ The nPA Smart Card Library offers an easy to use API for the new German identity
which could also be used for other cards. The included |npa-tool| can
be used for PIN management or to send APDUs inside a secure channel.
The nPA Smart Card Library is implemented using OpenPACE_. Some fragments of the
source code are based on the source code of the OpenSC_ tools.
The nPA Smart Card Library is implemented using OpenPACE_ and OpenSC_. nPA Smart Card Library
implements and initializes Secure Messaging wrappers of OpenSC to allow a
transparent SM usage in OpenSC. This allows nPA Smart Card Library to be fully
compatible with OpenSC.
.. _npa-install:
@@ -40,61 +41,62 @@ source code are based on the source code of the OpenSC_ tools.
The nPA Smart Card Library has the following dependencies:
- `OpenSC with PACE`_
- OpenSSL_ with OpenPACE_
- OpenSSL_
- OpenPACE_
- OpenSC_
------------------------------
Hints on OpenSSL with OpenPACE
------------------------------
------------------------------------
Installation of OpenPACE and OpenSSL
------------------------------------
The nPA Smart Card Library links against OpenSSL_, which must be patched with
OpenPACE_. Here is an example of how to get the standard installation of
OpenPACE_::
The nPA Smart Card Library links against OpenSSL_, which must be patched for OpenPACE_.
Here is an example of how to get the standard installation of OpenPACE_ (with
the required binaries for OpenSSL)::
PREFIX=/tmp/install
OPENPACE=openpace
svn co https://openpace.svn.sourceforge.net/svnroot/openpace $OPENPACE
git clone git://openpace.git.sourceforge.net/gitroot/openpace $OPENPACE
cd $OPENPACE
make patch_with_openpace
cd openpace
./config experimental-pace --prefix=$PREFIX
make depend
make
make install
autoreconf --verbose --install
# with `--enable-openssl-install` OpenSSL will be downloaded and installed along with OpenPACE
./configure --enable-openssl-install --prefix=$PREFIX
make install && cd -
Building the nPA Smart Card Library with OpenPACE_ is done best using
:command:`pkg-config`. The file :file:`libcrypto.pc` should be located in
``$INSTALL/lib/pkgconfig``. Here is how to configure the nPA Smart Card Library to use
it::
./configure PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
The file :file:`libcrypto.pc` should be located in ``$INSTALL/lib/pkgconfig``.
---------------
Hints on OpenSC
---------------
----------------------
Installation of OpenSC
----------------------
The nPA Smart Card Library links against OpenSC, which is discouraged and hindered
since OpenSC version >= 0.12. However, I extended OpenSC to support smart card
readers with PACE capabilities. You need the OpenSC components to be installed
(especially :file:`libopensc.so`). Here is an example of how to get the
standard installation of `OpenSC with PACE`_::
The nPA Smart Card Library need the OpenSC components to be installed (especially
:file:`libopensc.so`). Here is an example of how to get a suitable installation
of OpenSC_::
PREFIX=/tmp/install
OPENSC=opensc
git clone git://github.com/frankmorgner/OpenSC.git $OPENSC
cd $OPENSC
autoreconf -i
VSMARTCARD=vsmartcard
git clone git://vsmartcard.git.sourceforge.net/gitroot/vsmartcard $VSMARTCARD
cd $VSMARTCARD/npa/src/opensc
autoreconf --verbose --install
# adding PKG_CONFIG_PATH here lets OpenSC use OpenSSL with OpenPACE
./configure --prefix=$PREFIX PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
make
make install
make install && cd -
Now :file:`libopensc.so` should be located in ``$PREFIX/lib``. Here is how to
configure the nPA Smart Card Library to use it::
Now :file:`libopensc.so` should be located in ``$PREFIX/lib``.
--------------------------------------------------------------------------------
Installation of the nPA Smart Card Library
--------------------------------------------------------------------------------
To complete this step-by-step guide, here is how to install nPA Smart Card Library::
cd $VSMARTCARD/npa
autoreconf --verbose --install
# adding PKG_CONFIG_PATH here lets OpenSC use OpenSSL with OpenPACE
./configure --prefix=$PREFIX PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig OPENSC_LIBS="-L$PREFIX/lib -lopensc"
make install && cd -
./configure OPENSC_LIBS="-L$PREFIX/lib -lopensc"
.. _npa-usage:
@@ -119,27 +121,25 @@ be found in :file:`apdus`.
Linking against libnpa
----------------------
Following the section `Installation`_ above, you have installed `OpenSC with
PACE`_, OpenPACE_ and the nPA Smart Card Library to :file:`/tmp/install`. To compile a
program using nPA Smart Card Library you need to get the header files from `OpenSC with
PACE`_ as well. Here is how to compile an external program with these
libraries::
Following the section `Installation`_ above, you have installed OpenSSL_,
OpenPACE_, OpenSC_ and the nPA Smart Card Library to `$PREFIX` which points to
:file:`/tmp/install`. To compile a program using nPA Smart Card Library you also need
the OpenSC header files, which are located in
:file:`$VSMARTCARD/npa/src/opensc` Here is how to compile an external program
with these libraries::
PREFIX=/tmp/install
OPENSC=opensc
git clone git://github.com/frankmorgner/OpenSC.git $OPENSC
cc example.c -I$OPENSC/src \
$(env PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
pkg-config --cflags --libs npa)
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
cc example.c -I$VSMARTCARD/npa/src/opensc \
$(pkg-config --cflags --libs npa)
Alternatively you can specify libraries and flags by hand::
PREFIX=/tmp/install
OPENSC=opensc
git clone git://github.com/frankmorgner/OpenSC.git $OPENSC
cc example.c -I$OPENSC/src \
cc example.c -I$VSMARTCARD/npa/src/opensc \
-I$PREFIX/include \
-L$PREFIX/lib -lcrypto -lnpa -lopensc"
-L$PREFIX/lib -lnpa -lopensc -lcrypto"
The API to libnpa is documented in :ref:`npa-api`. It includes a simple
programming example.
.. include:: questions.rst

View File

@@ -1,7 +1,6 @@
.. highlight:: sh
.. _OpenSC: http://www.opensc-project.org
.. _OpenSC with PACE: http://github.com/frankmorgner/OpenSC
.. _OpenSC: https://github.com/OpenSC/OpenSC
.. _OpenSSL: http://www.openssl.org
.. _OpenPACE: http://openpace.sourceforge.net
@@ -42,61 +41,62 @@ compatible with OpenSC.
The @PACKAGE_NAME@ has the following dependencies:
- `OpenSC with PACE`_
- OpenSSL_ with OpenPACE_
- OpenSSL_
- OpenPACE_
- OpenSC_
------------------------------
Hints on OpenSSL with OpenPACE
------------------------------
------------------------------------
Installation of OpenPACE and OpenSSL
------------------------------------
The @PACKAGE_NAME@ links against OpenSSL_, which must be patched with
OpenPACE_. Here is an example of how to get the standard installation of
OpenPACE_::
The @PACKAGE_NAME@ links against OpenSSL_, which must be patched for OpenPACE_.
Here is an example of how to get the standard installation of OpenPACE_ (with
the required binaries for OpenSSL)::
PREFIX=/tmp/install
OPENPACE=openpace
svn co https://openpace.svn.sourceforge.net/svnroot/openpace $OPENPACE
git clone git://openpace.git.sourceforge.net/gitroot/openpace $OPENPACE
cd $OPENPACE
make patch_with_openpace
cd openpace
./config experimental-pace --prefix=$PREFIX
make depend
make
make install
autoreconf --verbose --install
# with `--enable-openssl-install` OpenSSL will be downloaded and installed along with OpenPACE
./configure --enable-openssl-install --prefix=$PREFIX
make install && cd -
Building the @PACKAGE_NAME@ with OpenPACE_ is done best using
:command:`pkg-config`. The file :file:`libcrypto.pc` should be located in
``$INSTALL/lib/pkgconfig``. Here is how to configure the @PACKAGE_NAME@ to use
it::
./configure PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
The file :file:`libcrypto.pc` should be located in ``$INSTALL/lib/pkgconfig``.
---------------
Hints on OpenSC
---------------
----------------------
Installation of OpenSC
----------------------
The @PACKAGE_NAME@ links against OpenSC, which is discouraged and hindered
since OpenSC version >= 0.12. However, I extended OpenSC to support smart card
readers with PACE capabilities. You need the OpenSC components to be installed
(especially :file:`libopensc.so`). Here is an example of how to get the
standard installation of `OpenSC with PACE`_::
The @PACKAGE_NAME@ need the OpenSC components to be installed (especially
:file:`libopensc.so`). Here is an example of how to get a suitable installation
of OpenSC_::
PREFIX=/tmp/install
OPENSC=opensc
git clone git://github.com/frankmorgner/OpenSC.git $OPENSC
cd $OPENSC
autoreconf -i
VSMARTCARD=vsmartcard
git clone git://vsmartcard.git.sourceforge.net/gitroot/vsmartcard $VSMARTCARD
cd $VSMARTCARD/npa/src/opensc
autoreconf --verbose --install
# adding PKG_CONFIG_PATH here lets OpenSC use OpenSSL with OpenPACE
./configure --prefix=$PREFIX PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
make
make install
make install && cd -
Now :file:`libopensc.so` should be located in ``$PREFIX/lib``. Here is how to
configure the @PACKAGE_NAME@ to use it::
Now :file:`libopensc.so` should be located in ``$PREFIX/lib``.
--------------------------------------------------------------------------------
Installation of the @PACKAGE_NAME@
--------------------------------------------------------------------------------
To complete this step-by-step guide, here is how to install @PACKAGE_NAME@::
cd $VSMARTCARD/npa
autoreconf --verbose --install
# adding PKG_CONFIG_PATH here lets OpenSC use OpenSSL with OpenPACE
./configure --prefix=$PREFIX PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig OPENSC_LIBS="-L$PREFIX/lib -lopensc"
make install && cd -
./configure OPENSC_LIBS="-L$PREFIX/lib -lopensc"
.. _npa-usage:
@@ -121,27 +121,25 @@ be found in :file:`apdus`.
Linking against libnpa
----------------------
Following the section `Installation`_ above, you have installed `OpenSC with
PACE`_, OpenPACE_ and the @PACKAGE_NAME@ to :file:`/tmp/install`. To compile a
program using @PACKAGE_NAME@ you need to get the header files from `OpenSC with
PACE`_ as well. Here is how to compile an external program with these
libraries::
Following the section `Installation`_ above, you have installed OpenSSL_,
OpenPACE_, OpenSC_ and the @PACKAGE_NAME@ to `$PREFIX` which points to
:file:`/tmp/install`. To compile a program using @PACKAGE_NAME@ you also need
the OpenSC header files, which are located in
:file:`$VSMARTCARD/npa/src/opensc` Here is how to compile an external program
with these libraries::
PREFIX=/tmp/install
OPENSC=opensc
git clone git://github.com/frankmorgner/OpenSC.git $OPENSC
cc example.c -I$OPENSC/src \
$(env PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \
pkg-config --cflags --libs npa)
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
cc example.c -I$VSMARTCARD/npa/src/opensc \
$(pkg-config --cflags --libs npa)
Alternatively you can specify libraries and flags by hand::
PREFIX=/tmp/install
OPENSC=opensc
git clone git://github.com/frankmorgner/OpenSC.git $OPENSC
cc example.c -I$OPENSC/src \
cc example.c -I$VSMARTCARD/npa/src/opensc \
-I$PREFIX/include \
-L$PREFIX/lib -lcrypto -lnpa -lopensc"
-L$PREFIX/lib -lnpa -lopensc -lcrypto"
The API to libnpa is documented in :ref:`npa-api`. It includes a simple
programming example.
.. include:: questions.rst

View File

@@ -1,5 +1,7 @@
.. highlight:: c
.. _npa-api:
********************************
Programming with the nPA Library
********************************

View File

@@ -1,8 +1,8 @@
.. highlight:: sh
=============
============
Installation
=============
============
The nPA Smart Card Library uses the GNU Build System to compile and install. If you are
unfamiliar with it, please have a look at :file:`INSTALL`. If you have a look
@@ -10,7 +10,7 @@ around and can not find it, you are probably working bleeding edge in the
repository. Run the following command in :file:`npa` to
get the missing standard auxiliary files::
autoreconf -i
autoreconf --verbose --install
To configure (:command:`configure --help` lists possible options), build and
install the nPA Smart Card Library now do the following::

View File

@@ -14,20 +14,18 @@ MAINTAINERCLEANFILES = $(BUILT_SOURCES) npa-tool.ggo $(dist_man1_MANS)
dist_man1_MANS = npa-tool.1
AM_CPPFLAGS = -I$(top_srcdir)/src/opensc/src -DENABLE_SM
libnpa_la_SOURCES = iso-sm.c scutil.c npa.c
libnpa_la_LIBADD = $(OPENSSL_LIBS) $(OPENPACE_LIBS) $(OPENSC_LIBS)
libnpa_la_CFLAGS = $(OPENSSL_CFLAGS) $(OPENPACE_CFLAGS)
libnpa_la_CFLAGS = $(OPENSSL_CFLAGS) $(OPENPACE_CFLAGS) $(OPENSC_CFLAGS)
libnpa_la_LDFLAGS = -no-undefined
npa_tool_SOURCES = npa-tool.c $(BUILT_SOURCES)
npa_tool_LDADD = $(OPENSSL_LIBS) $(OPENPACE_LIBS) $(OPENSC_LIBS) libnpa.la
npa_tool_CFLAGS = $(OPENSSL_CFLAGS) $(OPENPACE_CFLAGS)
npa_tool_CFLAGS = $(OPENSSL_CFLAGS) $(OPENPACE_CFLAGS) $(OPENSC_CFLAGS)
example_SOURCES = example.c
example_LDADD = $(OPENSSL_LIBS) $(OPENPACE_LIBS) $(OPENSC_LIBS) libnpa.la
example_CFLAGS = $(OPENSSL_CFLAGS) $(OPENPACE_CFLAGS)
example_CFLAGS = $(OPENSSL_CFLAGS) $(OPENPACE_CFLAGS) $(OPENSC_CFLAGS)
npa-tool.c: $(BUILT_SOURCES)

1
npa/src/opensc Submodule

Submodule npa/src/opensc added at f6db9196d2