Commit Graph

42 Commits

Author SHA1 Message Date
Frank Morgner 74ec7b04ff sc-hsm: Add support for SoC
- eac: allow CA without EF.CardSecurity
- sc-hsm: implemented CA based on document PKI
- sc-hsm: adds receive limit for SoC card
- introduces dedicated card type for SoC card
- md: integrate card's PIN pad capabilities
- installer: added SC-HSM SoC card to registry
- pkcs15-tool: Added support for PIN entry on card
- change/unblock PIN: add support for PIN entry on card
- added OpenPACE to macOS build
- travis-ci: install gengetopt/help2man via brew
- sc-hsm: Cache EF.C_DevAut
- sc-hsm: Prevent unnecessary applet selection and state resets
- sc-hsm: added support for session pin
- sc-hsm: avoid multiple AID selection
- sc-hsm: Use the information from match_card for all subsequent selections of the applet
- sc-hsm: cache optional files as empty files (Decoding the files will reveal that they were not existing prior caching. This avoids selecting the file though we have already tried to cache the file before.)
- use dedicated directory for CVC trust anchors
- appveyor: added OpenPACE to windows build
2017-05-22 16:25:08 +02:00
Frank Morgner 9d15326de1 fixed more coverity issues 2017-04-20 10:58:54 +02:00
Frank Morgner e7915ec198 replace assert with error handling 2017-04-04 09:11:35 +02:00
Maciej S. Szmigiero 62cbda6cd9 Fix log messages format and parameter issues flagged by GCC
Since "Add GCC format checking attributes to log functions" commit GCC
warns us about problems with format strings and their arguments provided
to OpenSC message logging functions.

This commit fixes all cases where GCC warned about incorrect format on
64-bit Linux, 32-bit and 64-bit mingw builds (with SM and OpenSSL enabled).
Well, almost all since on mingw GCC does not recognize "ll" size specifier
(present at least since Visual Studio 2005, also in mingw own CRT) so these
(few) warnings about it remain.

In most cases format size specifier for size_t type was missing (usually
size was left at default int level, with is different on 64-bit x86).
Some formats had too few / too many arguments.
In some cases pointers were printed as integers.
Some long variables were missing "l" prefix (especially with regard to %x
format).

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 11:05:16 +02:00
Michał Trojnara 645780e6d4 NULL parameter check moved to sc_file_free()
This fixes numerous issues where the check is *not* performed,
and also simplifies the code.
2017-01-10 12:46:44 +01:00
Thomas König a3e7ebec42 Proposed fix for #723 2016-04-17 13:00:37 +02:00
Andreas Schwier b9cf74361c sc-hsm: Fix BCD encoding bug with SO-PIN 2016-02-18 18:25:34 +01:00
Andreas Schwier 06f296b978 sc-hsm: implement logout function
- re-selection of the applet resets the applet's state
- removes path in key object and fixes #631
2015-12-12 02:28:23 +01:00
Andreas Schwier d8d47bb06f sc-hsm: Bind PIN object to applet aid to ensure SELECT before PIN verification 2015-09-23 15:38:57 +02:00
Frank Morgner a906c6d7b8 Merge pull request #530 from NWilson/yubikey-neo-pin
Yubikey NEO pin functions support
2015-09-12 18:51:10 +02:00
Andreas Schwier 72e25db360 sc-hsm: Add status info support for SmartCard-HSM V2.0 2015-09-03 21:49:24 +02:00
Frank Morgner 2d9802308f reactivate handling of `0` for max_recv/send_size
The special value still needs to be handled for commands that are issued
during card initialization. This especially concerns T=0 cards that need
to use iso_get_response.

fixes #533
regression of 85b79a3332
2015-08-26 02:55:35 +02:00
Nicholas Wilson 5a11d0e2fd Add support for C_GetTokenInfo pin status flags for ISO7816 cards
This is already supported for a couple of the card drivers, but
since it's a general feature of ISO7816 it should go in iso7816.c,
rather than the current situation where identical code for this is
copy and pasted in each driver.

However, some cards apparently don't support this feature and count
it as a failed PIN attempt, so I've added a flag for now to indicate
whether the card supports this feature. It future, it could be moved
to blacklist cards rather than whitelist them, subject to more testing.
2015-08-25 15:53:27 +01:00
Frank Morgner 85b79a3332 don't always overwrite max_send_size/max_recv_size
If the reader announces extended length support, but the card driver
leaves max_send_size/max_recv_size at `0`, max_send_size/max_recv_size
previously would have been overwritten with the reader's size though the
card might not have set SC_CARD_CAP_APDU_EXT. This commit fixes this
behavior.

Additionally card->max_send_size/max_recv_size is always initialized to
a value different from 0 after the card initialization. This removes the
need to check for this special value in all subsequent calls.
2015-08-11 23:08:41 +02:00
Andreas Schwier d6774aae40 Fixed wrong APDU case declaration detected after PR #500 2015-08-04 17:51:46 +02:00
Philip Wendland 4142456c74 PIV, sc-hsm, myeid: register ECDH card capabilites
Prior to 066132327c71300188aa66180fde2fb3d90c5140, CKM_ECDH1_DERIVE and
CKM_ECDH1_COFACTOR_DERIVE were always registered for cards that support
SC_ALGORITHM_ECDSA_RAW.
The mentioned commit changed this behavior, so that the ECDH mechanisms
are only registered for cards that set the SC_ALGORITHM_ECDH_CDH_RAW
capability flag.
To keep the existing behavior for the cards, they need to set this flag
in the card driver.
2015-05-08 20:45:37 +02:00
Frank Morgner bcb5fc15e5 honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
Viktor Tarasov fa923831f8 introduce EC curve OID into algorithm info data
needed to store information about EC curve supported by card.
Primary usage is when importing/generating key to get know if particular curve is supported by card.
2015-02-20 13:49:18 +01:00
Frank Morgner a2ba4d3bae Merge pull request #319 from CardContact/add-sec-k-curves
sc-hsm: Add support for Koblitz curves secp192k1 and secp256k1 (Bitcoin)
2014-12-06 23:22:43 +01:00
Andreas Schwier d014056f1d sc-hsm: Add support for Koblitz curves secp192k1 and secp256k1 (Bitcoin) 2014-11-04 17:11:34 +01:00
Andreas Schwier b2dcae34ca Fix Lc byte in VERIFY PIN block for PC/SC PIN PAD reader 2014-11-03 16:11:29 +01:00
Andreas Schwier 9e54756e1b sc-hsm: Added support to unblock PIN using C_InitPIN() 2014-01-08 19:32:53 +01:00
Andreas Schwier d1ba6164ad sc-hsm: Added support for token label to be set via C_InitToken or sc-hsm-tool 2014-01-08 16:07:13 +01:00
Andreas Schwier 4604dac3a7 sc-hsm: Fixed memory checking and removed warning 2013-11-15 11:41:10 +01:00
Frank Morgner d21830344f fixed a ton of compiler warnings 2013-08-03 19:15:55 +02:00
Frank Morgner e3649fb7de fixed even more compiler warnings 2013-08-02 15:43:25 +02:00
Andreas Schwier 962cba98db sc-hsm: Fixed bug when changing SO-PIN with opensc-explorer
sc-hsm-tool: Fixed some warnings
2013-06-11 16:55:47 +02:00
Andreas Schwier ae1b96e5b2 sc-hsm-tool: Fixed a crash on Windows when --wrap-key frees memory allocated in opensc.dll 2013-06-11 16:55:47 +02:00
Andreas Schwier ffb20e5916 sc-hsm: Added sc-hsm-tool with DKEK support and key wrap / unwrap 2012-11-11 12:53:03 +01:00
Andreas Schwier aaedef70b5 sc-hsm: Added ability to initialize SmartCard-HSM using C_Initialize and C_InitPIN on PKCS#11 interface 2012-10-21 15:51:55 +02:00
Andreas Schwier 72786abe1f sc-hsm: Added write support for RSA and ECC keys, certificates and data objects 2012-10-01 13:09:02 +02:00
Andreas Schwier d5ee8a80b5 sc-hsm: Added fallback for readers that do not support extended length. Without extended length, RSA 2048 bit operations will not work. 2012-09-01 21:25:58 +02:00
Andreas Schwier cdfc22be73 sc-hsm: Removed dead code and memory leak if serial number is set more than once 2012-08-24 09:39:45 +02:00
Andreas Schwier d180fc324c sc-hsm: Added basic cvc support to read device identity. Used for token serial number and GUID generation 2012-08-23 22:06:01 +02:00
Andreas Schwier 2e0ef7a0ab sc-hsm: Improved usablity in opensc-explorer 2012-08-20 11:22:02 +02:00
Andreas Schwier 46efb61a2b sc-hsm: Fixed field size constants for 320 bit curve 2012-08-20 11:22:02 +02:00
Andreas Schwier efb4673ec8 Revert change to pkcs11-tool because of upstream changes in RSA signature tests
Fixed a typo that went undetected
2012-08-20 11:22:02 +02:00
Andreas Schwier dc927fbe3c sc-hsm: Undo the change to mechanism.c in commit f24bcd346340d80b552c0859942a49fd5e8feeff
sc-hsm: Change ECDSA signature format from DER to r/s format
2012-08-20 11:22:02 +02:00
Andreas Schwier 03632f336e sc-hsm: Added support for ECDH 2012-08-20 11:22:02 +02:00
Andreas Schwier f678b68650 Activated ECDSA for SmartCard-HSM
Fixed issues in pkcs11-tool/test_signature is card has RSA and ECDSA keys
Fixed bug in sc_pkcs11_signature_size that returns the wrong ECDSA signature size
2012-08-20 11:22:02 +02:00
Frank Thater 4ff917bd25 Added obj files to Makefile.mak for windows build
Fixed WIN32 compiler errors
Adjusted log message calls to short form

modified:   src/libopensc/Makefile.mak
modified:   src/libopensc/card-sc-hsm.c
modified:   src/libopensc/pkcs15-sc-hsm.c
2012-08-20 11:22:02 +02:00
Frank Thater 1a7ca32865 Added support for SmartCard-HSM and ECC keys
modified:   src/libopensc/Makefile.am
new file:   src/libopensc/card-sc-hsm.c
new file:   src/libopensc/card-sc-hsm.h
modified:   src/libopensc/cards.h
modified:   src/libopensc/ctx.c
modified:   src/libopensc/pkcs15-prkey.c
new file:   src/libopensc/pkcs15-sc-hsm.c
modified:   src/libopensc/pkcs15-syn.c
2012-08-20 11:22:01 +02:00