Commit Graph

41 Commits

Author SHA1 Message Date
Jakub Jelen 9858d05589 PKCS#11 testsuite (#1224)
* Initial version of pkcs11 testsuite

* Refactor test cases to several files, clean up awful and unused stuff

* Static mechanism list based on the actual token offer

* Get rid of magic numbers

* Documentation

* License update based on the original project

* Verbose readme

* Cleanup unused code, long lines and method order

* Typo; More verbose errors

* Use fallback mechanisms

* Refactor object allocation and certificate search

* PKCS11SPY mentioned, more TODO

* add SHA mechanisms

* Do not try to Finalize already finalized cryptoki

* Add more flags and mechanisms

* Do not list table for no results

* Logical order of the tests (regression last)

* read ALWAYS_AUTHENTICATE from correct place

* ALWAYS_AUTHENTICATE for decryption

* Test EC key length signature based on the actual key length

* Shorten CKM_ list output, add keygen types detection

* Skip decrypting on non-supported mechanisms

* Fail hard if the C_Login fails

* Reorganize local FLAGS_ constants

* Test RSA Digest mechanisms

* Correct mechanisms naming, typos

* Do not attempt to do signature using empty keys

* CKM_ECDSA_SHA1 support

* Correct type cast when getting attributes

* Report failures from all mechanisms

* Standardize return values, eliminate complete fails, documentation interface

* Wait for slot event test

* Add switch to allow interaction with a card (WaitForSlotEvent)

* At least try to verify using C_Verify, if it fails, fall back to openssl

* Get rid of function_pointers

* Get rid of additional newline

* Share always_authenticate() function between the test cases

* Refactor Encrypt&decrypt test to functions

* Do not overwrite bits if they are not provided by CKA, indentation

* Cleanup and Break to more functions Sign&Verify test

* CKM_RSA_X_509 sign and verify with openssl padding

* More TODO's

* Proper abstracted padding with RSA_X_509 mechanism

* Add ongoing tasks from different TODO list

* Update instructions. Another todo

* Variables naming

* Increase mechanism list size, use different static buffers for flags and mechanism names

* nonstandard mechanism CKM_SHA224_RSA_PKCS supported by some softotkens

* Get rid of loop initial declarations

* Loop initial declaration, typos, strict warnings

* Move the p11test to the new folder to avoid problems with dynamically linked opensc.so

* Update path in README

* Possibility to validate the testsuite agains software tokens

* Add possibility to select slot ID on command-line (when there are more cards present)

* Clean up readme to reflect current options and TODOs

* Do not attempt to use keys without advertised sign&verify bits to avoid false positives

* Get and present more object attributes in readonly test; refactor table

* New test checking if the set of attributes (usage flags) is reasonable

* Test multipart signatures. There is not reasonable mechanism supporting multipart encryption

* Use PKCS#11 encryption if possible (with openssl fallback)

* Identify few more mechanisms (PSS) in the lest

* Resize table to fit new mechanisms

* Remove initial loop declaration from multipart test

* Use pkcs11-tool instead of p11tool form most of the operations (master have most of the features)

* Preparation for machine readable results

* Refactor log variables out of the main context, try to export generic data

* Do not write to non-existing FD if not logging

* Export missing data into the log file in JSON

* Store database in json

* Sanity check

* Avoid uninitialized structure fields using in state structure

* Dump always_authenticate attribute too

* Manual selection of slots with possibility to use slots without tokens

* Do not free before finalizing

* Proper cleanup of message in all cases

* Proper allocation and deallocation of messages

* Sanitize missing cases (memory leaks)

* Suppressions for testing under valgrind

* Better handling message_lengt during sign&verify (avoid invalid access)

* Suppress another PCSC error

* Do not use default PIN. Fail if none specified

* Sanitize initialization. Skip incomplete key pairs

* Add missing newline in errors

* Fix condition for certificate search

* Avoid several calls for attributes of zero length

* Handle if the private key is not present on the card

* Improve memory handling, silent GCC warning of 'unused' variable

* Fail early with missing private key, cleanup the messages

* Use correct padding for encryption

* Cache if the card supports Verify/Encrypt and avoid trying over and over again

* Loosen the condition for the Usage flags

* OpenSSL 1.1.0 compatibility

* Add missing mechanisms

* Do not require certificates on the card and pass valid data for RSA_PKCS mechanisms

* Add missing PIN argument in runtest.sh

* Add OpenSSL < 1.1 comatible bits

* Add SHA2 ECDSA mechanisms handling

* Use public key from PKCS#11 if the certificate is missing (or compare it with certificate)

* Avoid long definitions in OpenSSL compat layer

* In older OpenSSL, the header file is ecdsa.h

* Add missing config.h to apply compat OpenSSL layer

* ASN1_STRING_get0_data() is also new in 1.1.0

* Return back RSA_X_509 mechanism

* Drop bogus CKM_* in the definitions

* Drop CKM_SHA224_RSA_PKCS as it is already in pkcs11.h

* Update documentation

* Use NDEBUG as intended

* typos, cleanup

* Typos, cleanup, update copyright

* Additional check for OpenCryptoki, generate more key types on soft tokens

* Prepare for RSA-PSS and RSA-OAEP

* Use usage&result flags for the tests, gracefully ignore PSS&OAEP

* pkcs11.h: Add missing definitions for PSS

* PSS and OAEP tests

readonly: Typos, reformat

* Working version, memory leak

* Tweak message lengths for OAEP and PSS

* Skip tests that are not aplicable for tokens

* configure.ac: New switch --enable-tests

Do not attempt to build tests if cmocka is not available or
--enable-tests is provided. It makes also more lightweight release
builds out of the box (or with --disable-tests).

* travis: Install cmocka if not available

* Do not build tests on Windows and make dist pass

* Try to install cmocka from apt and from brew

* Do not require sudo (cmocka from apt and brew works)
2018-05-18 12:31:55 +02:00
Frank Morgner bf828014e5 macOS: Added support for notifications
- adds framework for user defined message strings
- automatically determine the system's language
2017-08-02 19:02:05 +02:00
Frank Morgner a4f64d9439 Added (external) card driver for German ID card
(Imported libcardnpa from https://github.com/frankmorgner/vsmartcard)

- Added generic SM implementation of ISO/IEC 7816-8
- Added implementation of extended access control as defined by
  - BSI TR-03110
  - ICAO Doc 9303
  - ISO/IEC 7501
- Added tool for German ID card (and other EAC tokens)
- renamed folder libsm to sm
2017-03-20 21:28:48 +01:00
Frank Morgner ffd85adae7 Decouples SM from OpenSSL 2015-09-24 14:46:30 +02:00
Viktor Tarasov c4c189fec3 make: change make order of SM components
to respect dependencies
2013-08-02 12:29:55 +02:00
Frank Morgner 9a05414f9a let OpenSC compile without OpenSSL and without SM 2013-07-10 16:22:33 +02:00
Viktor Tarasov 3f30e14087 sm: move SM common crypto procedures to the dedicated library
rename 'sm' source directory
2013-01-04 22:29:59 +01:00
Viktor Tarasov 2249cfde72 sm: loadable 'local' secure-messaging module
With loadable secure-messaging module the SM wrapping of APDUs is performed
by entity external to the running application.
So that the SM keysets

TODO: amend detailed description
2012-06-08 20:17:36 +02:00
martin 44cf3d06ae MiniDriver: rename cardmod to minidriver in source.
Also change some grammar, whitespace (reported by git) and wording (Opensc->OpenSC) issues.
Add some comments here and there.

See http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016261.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5329 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-12 07:40:12 +00:00
aj d22a2483c0 Header file cleanup.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4081 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-04 08:14:36 +00:00
aj 9e64de79e4 Remove openssh/ directory and our patch for openssh,
as they removed the opensc code in favor or new pkcs#11 code.
This new code works out of the box with opensc-pkcs11.so, 
so we don't need the patch any more.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4066 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-24 08:25:13 +00:00
flc 0e03c6d5cf add cardmod a minidrivers for windows
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4001 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-05 13:05:25 +00:00
aj 4b2fe63ac2 build only one shared library instead of many.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3971 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-01 15:12:53 +00:00
martin ca0976ba6f Remove signer and related configure elements
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3840 c6295689-39f2-0310-b995-f0e70906c6a9
2009-11-13 11:48:17 +00:00
alonbl 87db3c96c2 More separate srcdir fixups
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3450 c6295689-39f2-0310-b995-f0e70906c6a9
2008-04-01 19:04:33 +00:00
alonbl 8ac87f1b1e Remove useless comments
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3414 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-09 21:24:24 +00:00
alonbl 0a809dd5cb Complete rewrite of OpenSC build system.
1.  Build system now supports MinGW (Windows) compilation using msys and cross compilation.
2.  Ability to explicitly disable and enable dependencies of the package.
3.  openct, pcsc and nsplugins features are disabled by default.
4.  Modified pcsc driver to use pcsc dynamically, no compile time dependency is required.
5.  --enable-pcsc-lite configuration option renamed to --enable-pcsc.
6.  Install opensc.conf file (as opensc.conf.new if opensc.conf exists).
7.  Add--enable-doc configuration option, allow installing documentation into target.
8.  Add --disable-man configuration option, allow msys mingw32 users to
    build from svn without extra dependencies.
9.  Add export files to each library in order to export only required symbols.
    Windows native build may use these files instead of scanning objects' symbols.
10. Add opensc-tool --info to display some general information about the build.
11. Create compatibility library to be linked against library instread of recompiling the
    same source files in different places.
12. Add different win32 version resource to each class of outputs.
13. Make xsl-stylesheets location selectable.
14. Some win32 fixups.
15. Some warning fixups.
16. Many other autoconf/automake cleanups.

Alon Bar-Lev

svn diff -r 3315:3399 https://www.opensc-project.org/svn/opensc/branches/alonbl/mingw

_M   .
D    configure.in
_M   src
_M   src/openssh
M    src/openssh/Makefile.am
_M   src/tools
M    src/tools/rutoken-tool.c
M    src/tools/opensc-tool.c
M    src/tools/cardos-info.c
M    src/tools/pkcs15-crypt.c
M    src/tools/pkcs15-init.c
M    src/tools/piv-tool.c
M    src/tools/netkey-tool.c
M    src/tools/eidenv.c
M    src/tools/cryptoflex-tool.c
M    src/tools/util.c
M    src/tools/pkcs11-tool.c
M    src/tools/pkcs15-tool.c
M    src/tools/util.h
M    src/tools/opensc-explorer.c
M    src/tools/Makefile.am
_M   src/pkcs11
M    src/pkcs11/pkcs11-global.c
M    src/pkcs11/framework-pkcs15.c
M    src/pkcs11/mechanism.c
M    src/pkcs11/pkcs11-display.c
M    src/pkcs11/pkcs11-object.c
A    src/pkcs11/opensc-pkcs11.exports
M    src/pkcs11/sc-pkcs11.h
M    src/pkcs11/pkcs11-spy.c
M    src/pkcs11/openssl.c
M    src/pkcs11/Makefile.am
A    src/pkcs11/pkcs11-spy.exports
_M   src/tests
_M   src/tests/regression
M    src/tests/regression/Makefile.am
M    src/tests/sc-test.c
M    src/tests/pintest.c
M    src/tests/Makefile.am
_M   src/include
_M   src/include/opensc
M    src/include/opensc/Makefile.am
A    src/include/opensc/svnignore
M    src/include/Makefile.am
_M   src/signer
_M   src/signer/npinclude
M    src/signer/npinclude/Makefile.am
M    src/signer/Makefile.am
A    src/signer/signer.exports
_M   src/common
A    src/common/compat_dummy.c
D    src/common/getopt.txt
D    src/common/strlcpy.c
D    src/common/LICENSE
A    src/common/compat_getopt.txt
A    src/common/compat_strlcpy.c
A    src/common/LICENSE.compat_getopt
A    src/common/compat_getopt.c
D    src/common/strlcpy.h
D    src/common/ChangeLog
D    src/common/getpass.c
D    src/common/my_getopt.c
A    src/common/compat_strlcpy.h
A    src/common/compat_getpass.c
A    src/common/compat_getopt.h
A    src/common/ChangeLog.compat_getopt
D    src/common/README.strlcpy
D    src/common/my_getopt.h
A    src/common/compat_getpass.h
A    src/common/README.compat_strlcpy
D    src/common/strlcpy.3
A    src/common/README.compat_getopt
D    src/common/getopt.3
D    src/common/README.my_getopt
A    src/common/compat_strlcpy.3
A    src/common/compat_getopt.3
M    src/common/Makefile.am
M    src/Makefile.am
_M   src/pkcs15init
M    src/pkcs15init/pkcs15-oberthur.c
M    src/pkcs15init/profile.c
M    src/pkcs15init/pkcs15-lib.c
M    src/pkcs15init/pkcs15-rutoken.c
A    src/pkcs15init/pkcs15init.exports
M    src/pkcs15init/pkcs15-gpk.c
M    src/pkcs15init/Makefile.am
_M   src/scconf
M    src/scconf/Makefile.am
M    src/scconf/parse.c
A    src/scconf/scconf.exports
_M   src/libopensc
M    src/libopensc/card-rutoken.c
M    src/libopensc/compression.c
M    src/libopensc/sc.c
M    src/libopensc/card-piv.c
M    src/libopensc/pkcs15-openpgp.c
M    src/libopensc/pkcs15-postecert.c
M    src/libopensc/pkcs15-tcos.c
M    src/libopensc/opensc-config.in
M    src/libopensc/reader-pcsc.c
A    src/libopensc/internal-winscard.h
M    src/libopensc/ctx.c
A    src/libopensc/libopensc.exports
M    src/libopensc/pkcs15-piv.c
M    src/libopensc/pkcs15-infocamere.c
M    src/libopensc/internal.h
M    src/libopensc/pkcs15-actalis.c
M    src/libopensc/pkcs15-starcert.c
M    src/libopensc/card-oberthur.c
M    src/libopensc/pkcs15-atrust-acos.c
M    src/libopensc/p15card-helper.c
D    src/libopensc/part10.h
M    src/libopensc/ui.c
M    src/libopensc/card-gpk.c
M    src/libopensc/pkcs15-wrap.c
M    src/libopensc/pkcs15-gemsafeGPK.c
M    src/libopensc/log.c
M    src/libopensc/pkcs15-esteid.c
M    src/libopensc/pkcs15-prkey-rutoken.c
M    src/libopensc/log.h
M    src/libopensc/Makefile.am
M    src/libopensc/reader-openct.c
_M   aclocal
M    aclocal/Makefile.am
_M   win32
M    win32/Makefile.am
A    win32/versioninfo.rc.in
A    win32/ltrc.inc
A    configure.ac
_M   doc
_M   doc/tools
M    doc/tools/pkcs15-profile.xml
D    doc/changelog.sh
D    doc/export-wiki.xsl
_M   doc/api
_M   doc/api/file
M    doc/api/man.xsl
_M   doc/api/asn1
_M   doc/api/apps
_M   doc/api/init
_M   doc/api/types
_M   doc/api/card
M    doc/api/html.xsl
_M   doc/api/misc
_M   doc/api/util
M    doc/Makefile.am
D    doc/export-wiki.sh
AM   doc/nonpersistent
A    doc/nonpersistent/export-wiki.xsl
A    doc/nonpersistent/Makefile.am
A    doc/nonpersistent/export-wiki.sh
A    doc/nonpersistent/svn2cl.xsl
D    doc/generate-man.sh
D    doc/svn2cl.xsl
M    Makefile.am
A    svnignore
_M   etc
M    etc/opensc.conf.in
M    etc/Makefile.am
D    man
_M   solaris
M    solaris/Makefile



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3405 c6295689-39f2-0310-b995-f0e70906c6a9
2008-03-06 16:06:59 +00:00
aj ff62b88e1c 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
2005-09-01 14:01:58 +00:00
aj 96519c6b72 stop building libp11 and the ssl engines.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2523 c6295689-39f2-0310-b995-f0e70906c6a9
2005-08-28 20:18:52 +00:00
aj 944904fac5 remove scrandom code. We will implement proper code to get random data
from the card itself.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2418 c6295689-39f2-0310-b995-f0e70906c6a9
2005-07-17 20:10:13 +00:00
aj 7de8272675 pam module obsoleted by pam_pkcs11 and pam_p11.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2416 c6295689-39f2-0310-b995-f0e70906c6a9
2005-07-17 20:08:06 +00:00
aj 4818083938 move p11_* into a new library.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2387 c6295689-39f2-0310-b995-f0e70906c6a9
2005-07-10 17:01:03 +00:00
pisi a702bdbdc8 Removed openscd from automake/distribution as it should be dead code.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2225 c6295689-39f2-0310-b995-f0e70906c6a9
2005-03-02 08:11:47 +00:00
aet d12b21f633 - Remove all references to usbtoken, use OpenCT instead
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1639 c6295689-39f2-0310-b995-f0e70906c6a9
2003-11-25 11:17:02 +00:00
aet bac2b601a9 Move scdl to it's own subdirectory, although it's merely
for internal purposes only.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1403 c6295689-39f2-0310-b995-f0e70906c6a9
2003-09-01 08:43:38 +00:00
aet 3a61c4fe97 - Remove src/assuan, what's the point of having --with-assuan
if we're including our own version? Besides, opensc-signer
  and openscd both are incomplete versions, I don't know if
  they work at all.
- Minor cleanups to openscd.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1299 c6295689-39f2-0310-b995-f0e70906c6a9
2003-07-24 10:00:57 +00:00
aj b1e4c88aec Add sslengines.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1096 c6295689-39f2-0310-b995-f0e70906c6a9
2003-05-12 20:18:31 +00:00
jey 0aea6fcba5 - applied build fixes from Andreas
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1058 c6295689-39f2-0310-b995-f0e70906c6a9
2003-04-21 15:01:55 +00:00
okir 192e140fd3 - merged SSL ENGINE patch from Kevin Stefanik
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1031 c6295689-39f2-0310-b995-f0e70906c6a9
2003-04-16 19:03:11 +00:00
okir 86d486c602 - top_srcdir/top_builddir fixes (aj)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@958 c6295689-39f2-0310-b995-f0e70906c6a9
2003-03-27 10:08:27 +00:00
okir d584e80d71 - build pkcs11 before tools, as pkcs11-tool needs libpkcs11
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@777 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-17 11:51:07 +00:00
jey 9b6074b951 - Added openscd and Assuan
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@763 c6295689-39f2-0310-b995-f0e70906c6a9
2002-12-10 13:43:23 +00:00
aet 1d2c9e4c48 Cleanups for initial win32 port, untested.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@696 c6295689-39f2-0310-b995-f0e70906c6a9
2002-10-19 14:04:52 +00:00
fabled 7635468ed9 - Initial support for win32
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@654 c6295689-39f2-0310-b995-f0e70906c6a9
2002-06-14 12:52:56 +00:00
aet 3938287c71 Add missing directory
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@460 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-05 13:49:52 +00:00
aet 5c3c163862 Merge opensc-signer to opensc/src/signer, part #1
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@438 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-04 10:40:24 +00:00
okir 517f19ca17 - added new subdir pkcs15init
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@418 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-02 13:30:01 +00:00
aet 5a824f3fab Add maintainer-clean patch by Andreas Jellinghaus <aj@dungeon.inka.de>
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@411 c6295689-39f2-0310-b995-f0e70906c6a9
2002-04-02 09:38:06 +00:00
aet b50a0c7bf7 Build fixes
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@359 c6295689-39f2-0310-b995-f0e70906c6a9
2002-03-21 10:43:38 +00:00
aet 9bd6c8f9bb Add getopt/getopt_long sources from GNU C Library.
Use them only if platform lacks support for getopt_long,
like most commercial operating systems do.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@129 c6295689-39f2-0310-b995-f0e70906c6a9
2002-01-02 22:15:31 +00:00
aet 3775b18c81 Autotools update. Add bunch of stuff to configure.in to
make building of libopensc more portable to various
operating systems.

Requires autoconf 2.52 and automake 1.5.

Add all necessary files except Makefile.in, so you still
need to run ./bootstrap though. There's not much point
adding config.guess and friends without them, maybe later.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@94 c6295689-39f2-0310-b995-f0e70906c6a9
2001-12-22 22:27:20 +00:00