opensc/src/libopensc
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
..
Makefile.am Added PKCS#15 emulator for DIN 66291 profile 2017-10-27 19:48:22 +02:00
Makefile.mak win32: don't link static libs into static libs 2017-11-09 12:42:29 +01:00
apdu.c fix typos 2018-04-15 09:34:45 +02:00
asn1.c fixed coverity issues 2018-04-07 12:27:12 +02:00
asn1.h asn1: tagnum size has not exceed 3 bytes 2016-03-10 10:13:27 +01:00
authentic.h libopensc: authentIC: use macros; use common CPLC data type 2011-05-13 12:57:18 +00:00
aux-data.c Fix log messages format and parameter issues flagged by GCC 2017-03-27 11:05:16 +02:00
aux-data.h fix typos 2018-04-15 09:34:45 +02:00
base64.c make casting explicit 2015-11-01 13:18:39 +01:00
card-acos5.c fix typos 2018-04-15 09:34:45 +02:00
card-akis.c honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
card-asepcos.c fix typos 2018-04-15 09:34:45 +02:00
card-atrust-acos.c fix typos 2018-04-15 09:34:45 +02:00
card-authentic.c fix typos 2018-04-15 09:34:45 +02:00
card-belpic.c fix typos 2018-04-15 09:34:45 +02:00
card-cac.c fix typos 2018-04-15 09:34:45 +02:00
card-cardos.c fix typos 2018-04-15 09:34:45 +02:00
card-coolkey.c fix typos 2018-04-15 09:34:45 +02:00
card-default.c honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
card-dnie.c fix typos 2018-04-15 09:34:45 +02:00
card-entersafe.c fix typos 2018-04-15 09:34:45 +02:00
card-epass2003.c fix typos 2018-04-15 09:34:45 +02:00
card-flex.c fix typos 2018-04-15 09:34:45 +02:00
card-gemsafeV1.c Reselect PKI-Applets after card reset 2018-02-07 11:57:48 +01:00
card-gids.c fix typos 2018-04-15 09:34:45 +02:00
card-gids.h First support for GIDS card 2016-02-19 00:12:16 +01:00
card-gpk.c fix typos 2018-04-15 09:34:45 +02:00
card-iasecc.c fix typos 2018-04-15 09:34:45 +02:00
card-incrypto34.c fix typos 2018-04-15 09:34:45 +02:00
card-isoApplet.c fix typos 2018-04-15 09:34:45 +02:00
card-itacns.c fix typos 2018-04-15 09:34:45 +02:00
card-jcop.c fix typos 2018-04-15 09:34:45 +02:00
card-jpki.c Reselect PKI-Applets after card reset 2018-02-07 11:57:48 +01:00
card-masktech.c fix typos 2018-04-15 09:34:45 +02:00
card-mcrd.c fix typos 2018-04-15 09:34:45 +02:00
card-miocos.c Fix log messages format and parameter issues flagged by GCC 2017-03-27 11:05:16 +02:00
card-muscle.c fix typos 2018-04-15 09:34:45 +02:00
card-myeid.c rename SC_SEC_ENV_KEY_REF_ASYMMETRIC to SC_SEC_ENV_KEY_REF_SYMMETRIC 2018-03-09 14:36:55 +01:00
card-npa.c nPA: fixed matching for newer cards 2018-04-26 21:55:54 +02:00
card-npa.h EAC: Clearify naming of functions and data 2018-02-20 22:16:51 +01:00
card-oberthur.c fix typos 2018-04-15 09:34:45 +02:00
card-openpgp.c fix typos 2018-04-15 09:34:45 +02:00
card-piv.c manuals: added missing "Authors" section 2018-05-16 13:43:25 +02:00
card-rtecp.c Fix log messages format and parameter issues flagged by GCC 2017-03-27 11:05:16 +02:00
card-rutoken.c pkcs15init: Fix rutokenS FCP parsing (#1259) 2018-02-13 13:24:28 +01:00
card-sc-hsm.c sc-hsm: fixed accessing version info (#1252) 2018-02-07 12:00:09 +01:00
card-sc-hsm.h Fix maximum CHR length 2017-06-24 15:26:04 +02:00
card-setcos.c fix typos 2018-04-15 09:34:45 +02:00
card-starcos.c fix typos 2018-04-15 09:34:45 +02:00
card-tcos.c fix typos 2018-04-15 09:34:45 +02:00
card-westcos.c fix typos 2018-04-15 09:34:45 +02:00
card.c fix typos 2018-04-15 09:34:45 +02:00
cardctl.h fix typos 2018-04-15 09:34:45 +02:00
cards.h Various PIV changes 2018-04-05 15:23:16 +02:00
ccid-types.h Added support for PIN commands via escape commands 2017-03-20 21:28:48 +01:00
compression.c First support for GIDS card 2016-02-19 00:12:16 +01:00
compression.h First support for GIDS card 2016-02-19 00:12:16 +01:00
ctbcs.c coverity-scan: supplement to #710 2016-03-15 19:10:52 +01:00
ctbcs.h fix typos 2018-04-15 09:34:45 +02:00
ctx.c fix typos 2018-04-15 09:34:45 +02:00
cwa-dnie.c fix typos 2018-04-15 09:34:45 +02:00
cwa-dnie.h Add dnie_free_apdu_buffers into dnie_sm_free_wrapped_apdu. 2017-04-20 11:04:02 +02:00
cwa14890.c fix typos 2018-04-15 09:34:45 +02:00
cwa14890.h fix typos 2018-04-15 09:34:45 +02:00
dir.c fix typos 2018-04-15 09:34:45 +02:00
ef-atr.c Fix log messages format and parameter issues flagged by GCC 2017-03-27 11:05:16 +02:00
ef-gdo.c fixed handling SC_ASN1_TAG_EOC from sc_asn1_read_tag 2018-03-30 08:28:51 +02:00
errors.c honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
errors.h Normalize SC_ERROR_* API and clean up ISO7816-4 errors. 2013-03-15 12:30:38 +02:00
esteid.h
iasecc-sdo.c Address compiler warnings when using --disable-optimization (#1325) 2018-04-15 09:37:43 +02:00
iasecc-sdo.h fix typos 2018-04-15 09:34:45 +02:00
iasecc-sm.c fix typos 2018-04-15 09:34:45 +02:00
iasecc.h removed unused reference to sm_iasecc_rsa_generate 2013-09-29 18:52:38 +02:00
internal-winscard.h fix typos 2018-04-15 09:34:45 +02:00
internal.h Add _sc_card_add_generic for registering secret key algorithms 2017-06-13 10:40:36 +02:00
iso7816.c fix typos 2018-04-15 09:34:45 +02:00
iso7816.h parse Extended Length Information in EF.ATR/INFO 2016-07-19 14:30:38 +02:00
itacns.h
jpki.h login state preservation for JPKI card 2017-02-06 14:22:14 +01:00
libopensc.exports EAC: Clearify naming of functions and data 2018-02-20 22:16:51 +01:00
log.c win32: generate PDB files for releases 2017-11-21 10:54:48 +01:00
log.h dump data with sc_debug_hex and sc_log_hex 2017-11-17 10:03:54 +01:00
muscle-filesystem.c fix typos 2018-04-15 09:34:45 +02:00
muscle-filesystem.h
muscle.c fixed dead assignment 2017-11-09 12:42:29 +01:00
muscle.h use size_t for a length instead of int 2015-10-14 22:56:53 +02:00
opensc.dll.manifest Windows: Added support for notifications 2017-08-02 19:03:16 +02:00
opensc.h fix typos 2018-04-15 09:34:45 +02:00
p15card-helper.c Use OpenSSL versions OpenSSL-0.9.7 to 1.1.0a for OpenSC 2016-10-08 06:15:06 -05:00
p15card-helper.h
pace.h Added (external) card driver for German ID card 2017-03-20 21:28:48 +01:00
padding.c Fix log messages format and parameter issues flagged by GCC 2017-03-27 11:05:16 +02:00
pkcs15-actalis.c Fix missing error handling of memory allocation (#1020) 2017-04-20 21:08:49 +02:00
pkcs15-algo.c Fix log messages format and parameter issues flagged by GCC 2017-03-27 11:05:16 +02:00
pkcs15-atrust-acos.c Initialize PIN logged_in field for cards that do not support PIN info 2016-09-01 02:03:42 +02:00
pkcs15-cac.c Provide more space for card holder name in CAC token label 2018-04-24 14:35:11 +02:00
pkcs15-cache.c fixed Coverity issues 2017-06-13 13:07:52 +02:00
pkcs15-cert.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-coolkey.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-data.c add compatibility implementation for strnlen 2016-01-20 10:47:27 +01:00
pkcs15-din-66291.c Added PKCS#15 emulator for DIN 66291 profile 2017-10-27 19:48:22 +02:00
pkcs15-dnie.c NULL parameter check moved to sc_file_free() 2017-01-10 12:46:44 +01:00
pkcs15-esinit.c fixed dead assignment 2017-11-09 12:42:29 +01:00
pkcs15-esteid.c EstEID ECDH token support (#1185) 2017-11-10 08:58:31 +01:00
pkcs15-gemsafeGPK.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-gemsafeV1.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-gids.c Fix log messages format and parameter issues flagged by GCC 2017-03-27 11:05:16 +02:00
pkcs15-iasecc.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-infocamere.c fixed use after free 2018-03-09 14:36:55 +01:00
pkcs15-itacns.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-jpki.c add public keys 2017-08-02 10:27:06 +02:00
pkcs15-oberthur.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-openpgp.c Address compiler warnings when using --disable-optimization (#1325) 2018-04-15 09:37:43 +02:00
pkcs15-pin.c fixed possible NULL dereference 2017-11-09 12:42:29 +01:00
pkcs15-piv.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-postecert.c Initialize PIN logged_in field for cards that do not support PIN info 2016-09-01 02:03:42 +02:00
pkcs15-prkey.c Fix missing error handling of memory allocation (#1020) 2017-04-20 21:08:49 +02:00
pkcs15-pteid.c pteid: order objects by address (supersede #949) (#954) 2017-02-09 20:54:06 +01:00
pkcs15-pubkey.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-sc-hsm.c sc-hsm: fixed default labels for GoID 2018-04-25 23:27:55 +02:00
pkcs15-sec.c fix typos 2018-04-15 09:34:45 +02:00
pkcs15-skey.c Imporve SKDF decoding and implement encoding 2017-06-13 10:40:36 +02:00
pkcs15-starcert.c fixed dead assignment 2017-11-09 12:42:29 +01:00
pkcs15-syn.c openpgp: don't treat OpenPGP v3 cards special in src/libopensc/pkcs15-syn.c 2018-04-22 21:32:17 +02:00
pkcs15-syn.h Added PKCS#15 emulator for DIN 66291 profile 2017-10-27 19:48:22 +02:00
pkcs15-tccardos.c fixed use after free 2018-03-09 14:36:55 +01:00
pkcs15-tcos.c Initialize PIN logged_in field for cards that do not support PIN info 2016-09-01 02:03:42 +02:00
pkcs15-westcos.c fixed dead assignment 2017-11-09 12:42:29 +01:00
pkcs15.c PKCS#15: prevent use of empty serial number in TokenInfo 2018-03-09 14:36:55 +01:00
pkcs15.h fix typos 2018-04-15 09:34:45 +02:00
reader-cryptotokenkit.m fix typos 2018-04-15 09:34:45 +02:00
reader-ctapi.c fix typos 2018-04-15 09:34:45 +02:00
reader-openct.c fix typos 2018-04-15 09:34:45 +02:00
reader-pcsc.c reader-pcsc: fixed default for disconnect_action 2018-04-26 14:48:54 +02:00
reader-tr03119.c EAC: Clearify naming of functions and data 2018-02-20 22:16:51 +01:00
reader-tr03119.h EAC: Clearify naming of functions and data 2018-02-20 22:16:51 +01:00
sc-ossl-compat.h PKCS#11 testsuite (#1224) 2018-05-18 12:31:55 +02:00
sc.c Linux: Added support for notifications 2017-08-02 19:02:21 +02:00
sec.c fix typos 2018-04-15 09:34:45 +02:00
simpletlv.c SimpleTLV: Skip correctly two bytes after reading 2b size (#1231) 2018-01-17 00:28:05 +01:00
simpletlv.h adding a CAC support into OpenSC (#841) 2017-02-27 11:05:12 +01:00
sm.c Add ECC support and solve wrong Length status codes with SM card 2017-10-16 14:57:52 +02:00
sm.h fix typos 2018-04-15 09:34:45 +02:00
types.h Inform pkcs15 and card drivers of PKCS#11 C_Login(CKU_CONTEXT_SPECIFIC)" 2018-02-22 09:37:46 -06:00