Commit Graph

45 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 c5e40127d0 Coverity fixes (#1012)
card-cac.c
 * CLANG_WARNING: The left operand of '<' is a garbage value
card-coolkey.c
 * CLANG_WARNING: overwriting variable
 * CPPCHECK_WARNING: memory leak / overwrite variable
 * CLANG_WARNING: null pointer dereference
 * UNUSED_VALUE: unused return value
card-gids.c
 * CLANG_WARNING: Branch condition evaluates to a garbage value
 * SIZEOF_MISMATCH: suspicious_sizeof
card-myeid.c
 * RESOURCE_LEAK: Variable "buf" going out of scope leaks the storage it points to.
 * CLANG_WARNING: overwriting variable
 * (rewrite not to confuse coverity)
pkcs15-cac.c
 * RESOURCE_LEAK: Variable "cert_out" going out of scope leaks the storage it points to.
pkcs15-coolkey.c
 * UNUSED_VALUE: unused return value
pkcs15-piv.c
 * RESOURCE_LEAK: Variable "cert_out" going out of scope leaks the storage it points to.
pkcs15-sc-hsm.c
 * DEADCODE
pkcs11/framework-pkcs15.c
 * RESOURCE_LEAK: Variable "p15_cert" going out of scope leaks the storage it points to.
pkcs15init/pkcs15-lib.c
 * CLANG_WARNING: Assigned value is garbage or undefined
pkcs15init/pkcs15-myeid.c
 * UNREACHABLE: Probably wrong placement of code block
tests/p15dump.c
 * IDENTICAL_BRANCHES
pkcs15-init.c
 * CLANG_WARNING: Potential leak of memory pointed to by 'args.der_encoded.value'
pkcs15-tool.c
 * RESOURCE_LEAK: Variable "cert" going out of scope leaks the storage it points to.
 * MISSING_BREAK: The above case falls through to this one.
sc-hsm-tool.c
 * CLANG_WARNING: Potential leak of memory pointed to by 'sp'
westcos-tool.c
 * FORWARD_NULL: Passing null pointer "pin" to "unlock_pin", which dereferences it.
 * (rewrite not to confuse coverity)
card-cac.c
* Avoid malloc with 0 argument
gids-tool.c
* FORWARD_NULL -- copy&paste error
scconf.c
* CLANG_WARNING: Call to 'malloc' has an allocation size of 0 bytes

closes #982
2017-04-03 13:43:30 +02:00
Maciej S. Szmigiero 1168ca00f3 Set PIN-PUK association for cards that don't have it set
sc_pkcs15_unblock_pin() in libopensc/pkcs15-pin.c wants to associate PIN
to be unblocked with its PUK to check, for example, whether provided PUK
conforms to its policy.

When this function is not able to find a relevant PUK is uses policy for
PIN to be unblocked instead to check provided PUK which causes problems if
PIN and PUK policies differ.

Set PIN-PUK association for cards where it was unset and where this
association was either obvious, described in code or specs or provided
by the community.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
2017-03-27 10:57:21 +02:00
Frank Morgner 73ed21aeb7 sc-hsm: fixed parsing EF.TokenInfo (#865)
fixes https://github.com/OpenSC/OpenSC/issues/862
2016-09-01 21:43:06 +02:00
Frank Morgner ff335fe87f sc-hsm: cache certificates 2016-08-03 23:08:12 +02:00
Frank Morgner c5a95d4a5a sc-hsm: use PKCS#15 file cache
fix invalid certificate path
2016-07-24 17:19:18 +02:00
Andreas Schwier 41f34fdbcf sc-hsm: Fix public key usage for keys extracted from CVC 2016-04-17 13:06:46 +02:00
Viktor Tarasov 9ac4120594 pkcs15: 'aid' argument for emulator init
Allows to PKCS#15 emulator to bind more then one application
2016-04-08 10:48:58 +02:00
Frank Morgner 89f9d9e85d add compatibility implementation for strnlen
fixes https://github.com/OpenSC/OpenSC/issues/660
2016-01-20 10:47:27 +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
Frank Morgner f9a73c0b20 pkcs15-sc-hsm.c: fixed potential resource leak 2015-10-30 12:18:04 +01:00
Frank Morgner decd5ab987 Merge pull request #580 from frankmorgner/select
Fix issues related to selecting a file
2015-10-29 13:30:37 +01:00
Frank Morgner 0bf1f3755c removed unused variable 2015-10-14 22:48:45 +02:00
Frank Morgner 0258c91f30 removed unused variable 2015-10-14 22:43:12 +02:00
Frank Morgner f9cd1fc476 fixed accessing fixed size cvc members 2015-10-04 17:53:51 +02: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
Doug Engert ee23d28654 EC field_length changes for non-multiple of 8 bits curves
In OpenSC the EC field_length is the number of bits in the field.
Most curves have a field_length which is a multiple of 8 bits
but there are many that are not.

The X and Y points and privateD are stored in octetstrings
so there may need to be an extra byte in the octetstring.

An OpenSSL BIGNUM will drop leading zero bytes, so its size can not be used
to determine the field_length.

fix #440
fix #433
2015-04-25 12:21:39 +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 a3fc62f79f fixed NULL dereference (or warning thereof) 2015-02-05 01:38:40 +01:00
Frank Morgner 6759c04b26 don't ignore errors 2015-01-28 04:45:08 +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 5279bfa2d1 sc-hsm: Prevent double-free crash if key generation fails
Fixes #262 (SEGV when reader does not support extended length ADPU)
2014-07-09 14:27:08 +02:00
Andreas Schwier 440289a091 sc-hsm: reduce indicated maximum PIN length to 15
Fix bogus minimum PIN length to support more PIN pad readers
2014-06-26 17:57:26 +02:00
Viktor Tarasov dd5115bc02 pkcs15: use 'direct' public key value
pkcs15: in pubkey-info data
 * introduced new 'direct' 'raw' and 'spki' members
 * removed 'encoded der data' member
 * in 'read-public-key' try firstly SPKI direct value

pkcs11:
'direct' data used when getting CKA_VALUE attribute of public key

pkcs15init:
 * initialize 'raw' and 'spki' direct public key value
2014-02-09 18:49:58 +01:00
Viktor Tarasov 2f8fc498ae sc-hsm: emu: initialize EC key params
;fix EC parameters for the emulated public keys
;add 'sc-context' argument in some function prototypes
2014-02-09 18:49:58 +01:00
Andreas Schwier 67dc60f707 sc-hsm: Added support for persistent EC public keys generated from certificate signing requests 2014-01-09 21:41:12 +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
Frank Morgner a635d44336 fixed initialization of structure 2013-09-29 19:19:17 +02:00
Frank Morgner d21830344f fixed a ton of compiler warnings 2013-08-03 19:15:55 +02:00
Andreas Schwier b34d916e60 sc-hsm: Fixed problem deleting CA certificates
sc-hsm: Fixed public key format returned when generating ECC keys
2013-02-15 15:02:28 +01:00
Andreas Schwier 99af6cd8ee sc-hsm: Fixed a bug that prevents a newly generated 2048 key to show up at the PKCS#11 interface 2013-01-27 18:42:33 +01:00
Andreas Schwier 0adec1bddd sc-hsm: Fixed bug with memory released to early 2012-11-20 08:46:27 +01:00
Andreas Schwier bbbfae4bf0 sc-hsm: Now saving the internal CSR in place of the certificate and decoding the public key at initialization (RSA only) 2012-11-20 08:46:27 +01:00
Andreas Schwier 7c714860a2 sc-hsm: Fixed bug decoding CVCs without domain parameter 2012-11-11 12:53:03 +01:00
Andreas Schwier 33da14c459 sc-hsm: Added code to prevent CV certificates being listed as X.509 certificates 2012-11-11 12:53:03 +01:00
Viktor Tarasov 4cf3a3b204 move CK_VERSION data from 'pkcs15' to 'sc-card'
CK_VERSION is included into PKCS#11 data but is not specified by PKCS#15.

CK_VERSION can be provided by card's pkcs15 emulator or by the card's driver,
including the cards with the native support of pkcs#15 (and thus without pkcs15 emulator).

That's why the more general solution is to have these data included into 'sc-card' data type.
2012-10-21 16:24:11 +02: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 fba298c6f4 pksc11: Added ability to indicate hardware and firmware version information at 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 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 e0f9edb121 sc-hsm: fixed to be compiled with Microsoft VC 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