Commit Graph

958 Commits

Author SHA1 Message Date
Aleksey Samsonov e1a3bf8805 Rutoken ECP: set more universally 'Attempts' for RFS-files 2016-01-24 01:14:21 +03:00
Pawel Boguslawski de42deaae1 Fix smartcard certificate removal and update
This patch fixes bug found in opensc 0.14.0-2 (Debian 8) that blocks
certificate update and removal on Athena ASEPCOS smartcard with error

    Failed to update certificate: Security status not satisfied

OpenSC tries to get the parent's 'DELETE' access before cert removal
and leaves path variable pointing to dir not file to be removed.

Author-Change-Id: IB#1047758
2015-12-15 20:09:03 +01:00
Frank Morgner 21a8e7e5f9 Merge pull request #591 from vletoux/isoApplet
isoApplet: fix card not recognized by minidriver
2015-10-31 02:28:21 +01:00
Frank Morgner 8e7049c2fa removed unused variables 2015-10-30 18:21:40 +01:00
Frank Morgner fa9ffb7b90 fixed uninitialized variable
regression of baab26d871
2015-10-30 18:21:40 +01:00
Frank Morgner 7e29fcd26c pkcs15-authentic.c: fixed potential resource leak 2015-10-30 12:18:04 +01:00
Frank Morgner 9e1a5447d4 profile.c: fixed potential resource leak 2015-10-30 12:15:06 +01:00
Frank Morgner fd904fbcb8 pkcs15-oberthur-awp.c: fixed potential resource leak 2015-10-30 12:15:06 +01:00
Frank Morgner e7316b60e3 pkcs15-myeid.c: fixed potential resource leak 2015-10-30 12:15:06 +01:00
Frank Morgner baab26d871 pkcs15-lib.c: fixed potential resource leak 2015-10-30 12:15:06 +01:00
Frank Morgner 4f4c4aa5ec pkcs15-iasecc.c: fixed potential resource leak 2015-10-30 12:15:06 +01:00
Frank Morgner b96ba14aae added fall through comment 2015-10-30 12:15:06 +01:00
Andreas Schwier 0caf0d1dd6 sc-hsm: Add missing include introduced by #580 2015-10-29 14:09:01 +01:00
vletoux 206eb7124a isoApplet: fix card not recognized by minidriver 2015-10-23 23:03:25 +02:00
vletoux 35175a814c minidriver: fix according to frank's comments 2015-10-15 22:40:36 +02:00
vletoux 75d76f5ce4 Merge branch 'master' of https://github.com/OpenSC/OpenSC into OpenSC-master
Conflicts:
	src/minidriver/minidriver.c
2015-10-14 22:22:19 +02:00
Frank Morgner 851e0a24ff Merge pull request #571 from frankmorgner/label
Fixes accessing fixed size arrays
2015-10-14 18:56:29 +02:00
vletoux b968fcfb1f minidriver: Windows x509 enrollment works
Removed cmap_record in sc_pkcs15_prkey_info (not used by any driver nor code)
Remove cardcf specific code (cardcf neutralized by CP_CACHE_MODE_NO_CACHE and it maintened by the Base CSP/KSP, not the minidriver)
Add conversion code for Windows GUID / OpenSC self computed GUID
2015-10-11 15:20:04 +02:00
Olaf Kirch f42a1c2563 Replace outdated address okir@lst.de -> okir@suse.de
Signed-off-by: Olaf Kirch <okir@suse.de>
2015-10-05 14:07:28 +02:00
Frank Morgner f9cd1fc476 fixed accessing fixed size cvc members 2015-10-04 17:53:51 +02:00
Frank Morgner 7c1feb1b8a pkcs15-oberthur.c: fixed accessing label in sc_pkcs15_object_t 2015-10-04 17:33:14 +02:00
Frank Morgner fa3f4d632c pkcs15-lib.c: fixed accessing label in sc_pkcs15_object_t 2015-10-04 17:33:14 +02:00
vletoux 3edf32ca9c fix: when exporting immediatly an ECC key when the ECC key just has been created
This test case is triggered when requesting a ECC certificate from ADCS:
NCryptCreatePersistedKey followed by NCryptExportKey
2015-10-03 19:41:34 +02:00
Frank Morgner 5e242c5fb2 Merge pull request #560 from CardContact/fix_sc_pkcs15init_finalize_profile
Removed error check to support card with PKCS#15 emulation but no mat…
2015-10-02 15:18:14 +02:00
Frank Morgner 4f4643ee3e Merge pull request #452 from frankmorgner/memory-leaks
Fix some memory leaks
2015-10-02 15:13:34 +02:00
Frank Morgner fb705b6a2d Merge pull request #563 from CardContact/fix_reselect_applet_for_pin_verification
Fix reselect applet for pin verification
2015-09-29 20:09:00 +02:00
Andreas Schwier 7fd4edf7b6 Allow cards without EF.DIR using default application
Removed error check to support card with PKCS#15 emulation but no matching card app
2015-09-25 11:43:01 +02:00
Frank Morgner 7120a9b549 Merge pull request #554 from frankmorgner/fixes
Some more fixes for problems reported by Coverity scan
2015-09-25 11:13:17 +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
Philip Wendland 09fb1e71a9 IsoApplet: add PIN to pincache upon creation 2015-09-18 17:02:45 +02:00
Frank Morgner 2dca6ced06 pkcs15-oberthur: fixed resource leak 2015-09-17 22:32:07 +02:00
Frank Morgner 4e280b4741 pkcs15-lib: fixed resource leak 2015-09-17 22:32:07 +02:00
Frank Morgner 5854aff155 pkcs15-epass2003: fixed resource leak 2015-09-17 22:32:06 +02:00
Frank Morgner 0fe282414f Fixed warning about unused function 2015-09-17 22:24:33 +02:00
Frank Morgner 5902587889 Removed dead code 2015-09-17 22:24:33 +02:00
Frank Morgner c22ffd95bf Fixed warning about unused variable 2015-09-17 22:24:33 +02:00
Frank Morgner e4bce1ca61 Fixes dependency on uninitialized data 2015-09-17 22:24:33 +02:00
Frank Morgner 63a9ad79b6 Assumes that p15card->card are set
The check for NULL was bogus anyway
2015-09-17 22:24:33 +02:00
Frank Morgner 8a225eb42b Avoids potential NULL pointer deref 2015-09-17 22:24:33 +02:00
Nguyễn Hồng Quân 70890a8f61 Merge branch 'master' into gnuk
Conflicts:
	src/libopensc/card-openpgp.c
	src/tools/openpgp-tool.c
2015-08-31 21:55:14 +08:00
Viktor Tarasov e0aec3764a pkcs15init: 'store-or-update' certificate option 2015-05-10 14:35:41 +02:00
Viktor Tarasov 3cf56d8fb7 pkcs15init: fix non-unique-ID control 2015-05-10 14:35:41 +02:00
Frank Morgner 01e573b987 profile: fixed resource leak 2015-05-08 09:11:54 +02:00
Frank Morgner 6cb99be821 pkcs15-setcos: fixed resource leak 2015-05-08 09:11:54 +02:00
Frank Morgner 44253c63d0 pkcs15-rtecp: fixed resource leak 2015-05-08 09:11:54 +02:00
Viktor Tarasov d636338eaf pkcs15-oberthur: fix memory leakage 2015-05-08 09:11:54 +02:00
Viktor Tarasov ac84d282b1 myeid: fixed resource leak
pkcs15-myeid: fix memory leakage
myeid: fix memory leakage
2015-05-08 09:11:40 +02:00
Viktor Tarasov 475ce71453 iasecc: fixed resource leak
pkcs15-iasecc: fix memory leakage
iasecc: fix memory leakage
2015-05-08 09:11:20 +02:00
Frank Morgner 68becc8fc4 pkcs15-gpk: fixed resource leak 2015-05-08 09:11:19 +02:00
Frank Morgner d4fd135e20 pkcs15-cflex: fixed resource leak 2015-05-08 09:11:19 +02:00
Frank Morgner 4af4308d19 authentic: fixed resource leak
pkcs15-authentic: fixed resource leak
card-authentic: fixed resource leak
2015-05-08 09:10:48 +02:00
viktorTarasov c754e3f197 Merge pull request #444 from frankmorgner/pkcs11-error-handling
Improved error handling for PKCS#11 module
2015-04-25 13:04:07 +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 c8a7c8bc7a fixed typo 2015-04-21 01:04:18 +02:00
Thomas Calderon 117f3a74be iasecc: Fix key usage when provisioning card
* Avoids overriding key_usage when creating objects on the card.
2015-03-31 18:25:54 +02:00
Philip Wendland e258cec13e IsoApplet: Add nistp224, secp192k1 and secp256k1 curves
secp*k1 curves are only supported applet version >= 0.6.0 because of an issue
with encoding ECC public keys with small parameters.
2015-03-29 13:34:58 +02:00
Philip Wendland bba6e17aa9 isoApplet: Fix indentation of isoApplet.profile 2015-03-29 13:34:58 +02:00
Hannu Honkanen 2fffbce65c myeid: update EC support for MyEID-v4 card 2015-03-14 17:47:44 +01:00
viktorTarasov 595be37fee Merge pull request #305 from philipWendland/master
Add support for the IsoApplet Java Card applet
2015-03-07 23:36:25 +01:00
Viktor Tarasov 31124ac4f9 pkcs15init: allocate EC parameters 2015-03-04 19:46:21 +01:00
Philip Wendland 74aeb8c923
IsoApplet: register supported EC curve *per curve* 2015-02-22 23:08:18 +01:00
Philip Wendland 59eeacb74b
IsoApplet: react to removal of sc_pkcs15_ec_parameters in fa923831f8 2015-02-20 22:07:49 +01:00
Philip Wendland da05fa2a47
IsoApplet: try to fix EC parameters when importing private keys from file 2015-02-20 21:55:35 +01:00
Philip Wendland 44d724b012
IsoApplet: fix more (comment) alignment issues with tabstop=8 2015-02-20 21:55:35 +01:00
Philip Wendland 5628a06353
IsoApplet: Align comments with spaces instead of tabs
Better view with tabstop=8.
2015-02-20 21:55:35 +01:00
Philip Wendland e3cc851b72
IsoApplet: EC key-gen rework and refactorings
Rework the EC key generation mechanism to send the curve parameters to
the card. In earlier versions, the applet had a copy of the curve
parameters and there was a different algorithm reference for every
curve. This is unfeasible when trying to support a larger number of
curves because of size limitations of the applet.
This commit additionally includes some refactorings that should not
change the functionality.
2015-02-20 21:55:33 +01:00
Philip Wendland 48bd6b0964
Add support for the IsoApplet (Java Card applet)
The IsoApplet can be found here:
https://github.com/philipWendland/IsoApplet
Add read/write support for this applet, including RSA and
ECC support.
2015-02-20 21:55:26 +01:00
Pedro Martelletto ced77ae6c7 cardos: overwrite content of deleted private key
when deleting a private key object, overwrite its contents so the key can no longer be used.

(VTA: original commit touched to use LOG macros and add debug logs)
2015-02-20 18:03:37 +01: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
Viktor Tarasov 96265e6d08 pkcs15init: superpluous 'ec-params' in init data
Pkcs15init data, used to import/generate key objects, includes twice the same EC parameters data:
 - explicit 'params' data
 - part of sc_pkcs15_pubkey/sc_pkcs15_prkey
Explicit 'ec-params' data is removed.
2015-02-07 20:00:41 +01:00
Viktor Tarasov 08eb700b97 revert or partially revert some of recent commits
b94c163 - invalid, non-tested
11881a6 -- src/libopensc/card-iasecc.c -- return from select has to be ignored,
3a92bf7 -- src/pkcs11/slot.c -- SEGFAULT issue #373
3a92bf7 -- src/tools/piv-tool.c -- confirmed by author
6759c04 -- src/pkcs15init/pkcs15-lib.c -- file instantiation error has to be ignored
2015-02-07 19:31:17 +01:00
Frank Morgner 3a92bf7af5 fixed resource leaks 2015-02-05 01:38:41 +01:00
Frank Morgner 11881a61b8 removed/fixed dead code 2015-02-05 01:38:41 +01:00
Frank Morgner a3fc62f79f fixed NULL dereference (or warning thereof) 2015-02-05 01:38:40 +01:00
Frank Morgner 8d902d1ed3 fixed out of bounds read/write/access 2015-02-04 09:24:50 +01:00
Frank Morgner ed9572422f check return values 2015-02-05 01:37:53 +01:00
Frank Morgner 5e3d54186a removed useless check for non-null array 2015-02-05 01:37:53 +01:00
Frank Morgner 6759c04b26 don't ignore errors 2015-01-28 04:45:08 +01:00
Frank Morgner 2e04fa99c1 fixed pointless array comparisons 2015-01-28 07:39:35 +01:00
Frank Morgner 7fb495ac31 fixed self assignment 2015-01-28 07:10:57 +01:00
Frank Morgner 87b2403673 fixed out of bounds access/write 2015-01-28 07:00:02 +01:00
Frank Morgner b1b99ce7e5 fixed integer underflow 2015-01-28 06:03:52 +01:00
Frank Morgner 77752f442d fixed unused value 2015-01-28 05:47:20 +01:00
Frank Morgner fdd38f6e04 fixed copy into fixed size buffer 2015-01-28 04:30:40 +01:00
Frank Morgner 7a34c204c1 fixed dereference before null check
silence warnings reported by coverity-scan
2015-01-22 20:29:33 +01:00
Thomas Calderon bbedd4ef00 IAS-ECC: improve PKCS#11 compliance Issue #336
* Ensure CKA_ALWAYS_SENSITIVE and CKA_NEVER_EXTRACTABLE are only set when
  generating the key on board, not reason to set them when importing a private
  key.
2015-01-05 13:59:37 +01:00
Nguyễn Hồng Quân 7f08983240 Merge branch 'master' into gnuk
Conflicts:
	src/tools/openpgp-tool.c
2014-12-09 02:40:33 +08:00
Andreas Schwier d014056f1d sc-hsm: Add support for Koblitz curves secp192k1 and secp256k1 (Bitcoin) 2014-11-04 17:11:34 +01:00
Philip Wendland 955a339148 Merge PR#288 from philipWendland:upstream-ecc-fix
add the possibility to store public ECC keys encoded according to SPKI
EC pubkey storing: Check if params are available before copying.
pkcs15-lib.c / sc_pkcs15init_store_public_key may be called with keyargs->key.u.ec.params.value == NULL. In this case, allocating and copying the parameters will fail. Add a check to prevent this.
2014-10-01 15:27:26 +02:00
Andreas Schwier 7db99500a0 sc-hsm: Fix certificate delete bug
If a certificate is deleted after the related private key, then the driver
picks the wrong certificate EF, leading to an CKR_GENERAL_ERROR or the wrong
certificate being deleted.
2014-09-07 23:10:48 +02:00
Andreas Schwier f9b8b2c220 sc-hsm: Added error if private key import tried
Private key import is not supported by the SmartCard-HSM. However there is no error code
if it is still tried using pkcs15-init or from within Firefox.
2014-09-07 23:10:48 +02:00
Frank Morgner 5d6c4b391d Merge pull request #253 from github-frankmorgner/remove-deadcode
card-asepcos: removed dead code
card-authentic: removed dead code
card-belpic: removed dead code
card-epass2003: removed dead code
card-flex: removed dead code
card-gpk: removed dead code
card-oberthur: removed dead code
card-piv: removed dead code
card-setcos: removed dead code
ctbcs: removed dead code
cwa14890: removed dead code
muscle: removed dead code
pkcs15-atrust-acos: removed dead code
pkcs15-gemsafeV1: removed dead code
pkcs15-skey: removed dead code
reader-ctapi: removed dead code
framework-pkcs15: removed dead code
pkcs11-object: removed dead code
pkcs15-asepcos: removed dead code
pkcs15-cardos: removed dead code
pkcs15-jcop: removed dead code
pkcs15-lib: removed dead code
pkcs15-oberthur: removed dead code
parse: removed dead code
sclex: removed dead code
sm-card-authentic: removed dead code
sm-card-iasecc: removed dead code
sm-cwa14890: removed dead code
sm-global-platform: removed dead code
sc-test: removed dead code
pkcs11-tool: removed dead code
pkcs15-tool: removed dead code
2014-09-07 21:22:43 +02:00
Nguyễn Hồng Quân bbca9c4827 pkcs15-openpgp: Change to sc_put_data instead of sc_update_binary when writing certificate. 2014-07-14 02:02:07 +08:00
Nguyễn Hồng Quân 9a2a6e6dc0 PKCS15-OpenPGP: Allow to store data to pkcs15 data object.
Only one DO is supported now.
2014-07-14 02:02:07 +08:00
Frank Morgner 35b74f3923 fixed warning unused variable 2014-06-09 16:03:14 +02:00
Henryk Plötz b1b5a39ffa Use sc_pkcs15_find_pin_by_auth_id() in asepcos_create_key() to correctly set the newly created key up for use with the configured PIN. 2014-06-06 18:46:48 +02:00
Frank Morgner e1fd9d2a4c cardos,incrypto34: restored semantics of select_pin_reference 2014-05-03 22:24:06 +02:00
Frank Morgner a64326e768 fixed compiler warnings (partially submitted)
Signed-off-by: Frank Morgner <morgner@informatik.hu-berlin.de>

PR-222: commit 0b567dbaa8
partially submitted by Viktor Tarasov
2014-05-03 21:47:15 +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 343a627c78 pkcs15init: set EC pubkey key params using init arguments 2014-02-09 18:49:58 +01:00
Viktor Tarasov 122c58de85 pkcs15init: do not use 'der-data' of pubkey data 2014-02-09 18:49:58 +01:00
Viktor Tarasov efa6e852c2 myeid: support of EC key is broken,
waiting for specification and card from Aventra (VTA)
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
Viktor Tarasov 72bf7a8593 pkcs15init: NULL 'store-key' hahdle
Card driver can not define 'store-key' init handle
2014-02-09 18:49:58 +01:00
Viktor Tarasov 032a3ece20 pkcs15init: ignore if no TokenInfo file to update 2014-02-09 11:59:26 +01:00
Viktor Tarasov 0efe1ec05e coding style: remove trailing spaces 2014-01-19 19:19:17 +01:00
Viktor Tarasov 085f971f95 pkcs15init: iasecc: fix uncomplete merge
prototype of sc_pkcs15_get_object_guid has been changed
2014-01-19 19:19:17 +01:00
Viktor Tarasov 5437f87d4b pkcs15: encode public key algorithm (issue 202)
coding style: use linux style line break
2014-01-13 13:02:08 +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 9e54756e1b sc-hsm: Added support to unblock PIN using C_InitPIN() 2014-01-08 19:32:53 +01:00
Viktor Tarasov b1a5ebfac7 pkcs15init: introduce 'max-unblocks' PIN init parameter 2013-12-29 22:00:28 +01:00
Viktor Tarasov 784f0b8227 pkcs15init: refactoring -- do not use temporary variable 2013-12-29 22:00:28 +01:00
Viktor Tarasov 01ed00dd66 pkcs15init: warning unused variable 2013-12-29 22:00:28 +01:00
Viktor Tarasov 4d5b80fd3f libopensc: general usage method to allocate generalized time 2013-12-29 22:00:12 +01:00
Viktor Tarasov 13d1b8e9f2 pkcs15init: file 'content' and 'prop-attrs' in the card profile
Now it's possible to describe in the card profile
the 'prop-attr' and 'encoded-content' data of the file to create
2013-12-29 20:05:35 +01:00
Viktor Tarasov 51262f00ac pkcs15init: in profile more AC operations are parsed, ...
new AC-OP 'pin-use'
2013-12-29 20:05:35 +01:00
Viktor Tarasov 024cd3b96a pkcs15init: more of the debug messages and macros 2013-12-29 20:05:35 +01:00
Viktor Tarasov 9251d35635 pkcs15init: set key_info->guid value before calling card specific handlers 2013-12-29 20:04:03 +01:00
Viktor Tarasov 7853d67c12 pkcs15init: no const values in private key create/generate data 2013-12-29 19:47:45 +01:00
Viktor Tarasov 0dc39c1125 pkcs15: use value/length pair to hold the object's GUID
GUID can be presented by non-printable string
2013-12-29 19:47:42 +01:00
Viktor Tarasov 98325ab7f2 pkcs15: export 'sc_pkcs15_serialize_guid' ...
change name of exported 'sc_pkcs15_get_guid' to 'sc_pkcs15_get_object_guid' ;
add more 'CALLED' and 'RETURN' macros ;
2013-12-29 19:46:56 +01:00
Viktor Tarasov efdab893a7 pkcs15init: NULL pointer dereference error 2013-12-29 19:46:56 +01:00
Viktor Tarasov e855ac800e pkcs15: introduce 'cmap-record' data into the private key info
existing  'guid' obejct's data replaced by the one in private-key info
New CMAP record data used by pkcs15init emulator for the cards that have
the MD specific on-card data
2013-12-29 19:46:30 +01:00
Viktor Tarasov 00faad3af6 pkcs15: in 'pkcs15_object' data: new attr. 'md_flags'
also change name of 'guid' attribute for 'md_guid'
These attributes are used to parse and generate the minidriver CMAP records
2013-12-29 17:38:52 +01:00
Viktor Tarasov 04fbf6ad08 pkcs15init: externalize and change name of select_intrinsic_id() 2013-12-29 17:33:36 +01:00
Viktor Tarasov 6a389f3c4b pkcs15init: reselect file to delete 2013-12-29 14:05:23 +01:00
Viktor Tarasov cb6955c0a7 pkcs15init: keep certificate's blob in cert. info data
always do it, not only when creating a new 'direct' certificate
2013-12-29 14:05:23 +01:00
Andreas Schwier d4be8ec747 sc_pkcs15_encode_pubkey_as_spki replaces sc_pkcs15_encode_pubkey_with_param.
The name implies what the format of the returned value, a SPKI.

The support for spki as a pkcs15 format of a pubkey, is extended to
work for any algorithm not just EC pubkeys. PKCS#15 appears to allow this.

sc_pkcs15_decode_pubkey_with_param will look for a SPKI
and attempt to use it for any algorithm, including RSA.
(RSA is the null case, as there are no algorithm parameters.)

sc_pkcs15_encode_pubkey_as_spki is exported from libopensc.

pkcs15-piv.c will use sc_pkcs15_encode_pubkey_as_spki to load public keys
as SPKI for RSA and EC.

The pubkey->data is never a SPKI, it is the DER encoding of the
pubkey without the parameters.  If an spki is needed, use the
sc_pkcs15_encode_pubkey_as_spki to get the DER encoding of the spki.

As in the previous set of patches, pkcs15-tool.c will output both
sc_pkcs15_decode_pubkey_with_param and its internal.
This was left for testing, and the pubkey_pem_encode should be deleted
2013-12-06 09:23:57 +01:00
Andreas Schwier 3a6e7ba959 pkcs15: Changed encoding for EC public keys in PuKDF to SPKI rather than ECPoint, preserving domain parameter 2013-11-15 11:41:10 +01:00
Andreas Schwier 633c98e9ee sc-hsm: Removed compiler warning 2013-11-15 11:41:10 +01:00
Doug Engert 03c196eeaf ECC ecpointQ Fixes
The original ECC code in OpenSC stored the ecpointQ as a DER encoded OCTET STRING.
Shortly before 0.13.0, code changes where made to store the ecpointQ as raw data
without the DER encoding.

Only some of the code was changed to support this but not all, and the comments
that said the ecpointQ was in DER where not changed either.

Some card drivers continued to work, using the original code in all place,
while some cards failed, as they where using a mixture of original code and
0.13.0 code.

This commit fixes these problems.

The ecpointQ is stored in raw format

A new structure type sc_pkcs15_u8 is defined.

The ecpointQ are changed to use the struct sc_pkcs15_u8. This was done to avoid
 the confusion of using struct sc_pkcs15_der to hold non-DER encoded data.
(There may be other uses for this too...)

Comments are change is many places.

sc_pkcs15_decode_pubkey_ec was fixed to store the raw ecpointQ correctly.

sc_pkcs15_pubkey_from_spki was change to get the sc_ec_params from the alg_id
and fix up u.ec.params. Unfortunately the OpenSC code has two places EC parameters
are stored. They can get out of sync, or there may still be code
that looks in the wrng oplace. o(TODO get it to only only place.)

The u.ec.params.field_length is now set in a number of places, as this is need
in many of the PKCS#11 routines.

framework-pkcs15.c will now correctly return the DER encode ecpointQ,
for the CKA_EC_POINT attribute using pubkey->data which has the DER encoding
for the ecpointQ.

framework-pkcs15.c will look for the EC parameters in either the u.ec.params.der,
or in the alg_id->params. (TODO get it to only only place.)

pkcs15-myeid.c has some comments, as it looks like the code is storing a TLV
rather then a DER encoding of the ecpointQ. With the wrong encoding PKCS#11 will
return the wrong attribute for CKA_ECDSA_PARAMS.

pkcs15-piv.c is changed so emulation of a pubkey taken from a certificate will
work correctly.
2013-11-06 16:31:34 -06:00
Viktor Tarasov f641ebd248 fixed errors reported by cppcheck: part 1
partially applied the pull request #182 from Frank Morgner -- updated the common frameworks source files
2013-09-29 20:28:45 +02:00
Frank Morgner d21830344f fixed a ton of compiler warnings 2013-08-03 19:15:55 +02:00
Jean-Pierre Szikora de4dd056bf Onepin profile stopped to work after commit 10e1ad001d
Cards formatted with one-pin profile can not be used (for modification
of the data on the card with pkcs15-init -X for example) after this
commit, which prevent the reading of 5015/4946 (containing the
profile).

The part of the code was simply commented out without comment.
Maybe it was used for testing purposes, and not removed for
the commit ?
2013-08-02 16:06:52 +02:00
Frank Morgner e3649fb7de fixed even more compiler warnings 2013-08-02 15:43:25 +02:00
Ondrej Mikle 4c1cafed7c epass2003: key generation allows stricter privkey/pubkey ACLs 2013-04-28 18:37:29 +02:00
Viktor Tarasov 3b0ac5f8e7 pkcs15init: copy DATA object value to 'pkcs15-data-info'
When creating new DATA object, keep it's value in 'data' member of
'sc-pkcs15-data-info' data.
Used by pkcs15init emulation layer to store DATA value into a proprietary placement.
2013-03-11 18:25:22 +01:00
Viktor Tarasov 8fc679bf40 libopensc: invalid usage of SC_ERROR_MEMORY_FAILURE
Initiated by discussion in https://github.com/OpenSC/OpenSC/pull/134 .

SC_ERROR_MEMORY_FAILURE has to be used as a resulting code of the card related operations,
and not as result of the memory allocation problems.

New 'warning' category of SC_ERRORs introduced -- SC_WARNING_xx .
Error text and SC_ERROR associated with return codes 6300 and 6200 has been changed.
2013-03-02 19:29:14 +01:00
Viktor Tarasov 4b30292585 more macros for the values from ISO specification 2013-02-24 19:37:35 +01: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
Toni Sjöblom 58679a5df1 Fixed file-id in myeid.profile 2013-01-27 18:34:07 +01:00
Viktor Tarasov 250364c060 pkcs15init: fix spurious gcc overflow warning,
thanks to Milan Broz (mbroz@redhat.com)
As discussed in pull request #115 (https://github.com/OpenSC/OpenSC/pull/115),
'if' test of impossible condition is removed in 'cardos' and 'incypto34' card drivers.
2013-01-04 19:03:46 +01:00
Viktor Tarasov 8b07b9c5a7 compile on Windows, minor codding style issues 2012-12-03 15:21:22 +01:00
sjoblomt 457426543d MyEID ECDSA support 2012-12-03 14:37:13 +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 ffb20e5916 sc-hsm: Added sc-hsm-tool with DKEK support and key wrap / unwrap 2012-11-11 12:53:03 +01:00
riham c91f0e84cb entersafe: Disable RSA:512bits that modified in entersafe_generate_key and entersafe_store_key function
1.Added a prompt while initializing ePass2003 \n 2.Modify code to disable 512bit key
2012-10-01 18:52:19 +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
Viktor Tarasov df9a4d0b2c pkcs15: for 'sc_pkcs15_cer's data use the 'der' object type
To hold the raw certificate blob in 'sc_pkcs15_cert' data use the 'sc_pkcs15_der' data type.
also:
; in 'pkcs15-cert.c' use short call of the debug messages;
; in 'destroy-object' pkcs15 framework handler take into account the multi-application cards:
-- when binding card use the application info;
-- when finalizing profile use the application ID.
2012-09-30 22:54:52 +02:00
Ludovic Rousseau ea40e7fe24 Use AM_CPPFLAGS instead of INCLUDES
Fix autoreconf warnings:

$ autoreconf -vis -Wall
[...]
src/common/Makefile.am:12: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/libopensc/Makefile.am:19: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/minidriver/Makefile.am:15: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/pkcs11/Makefile.am:10: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/pkcs15init/Makefile.am:36: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/scconf/Makefile.am:12: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/sm/Makefile.am:8: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/tests/Makefile.am:9: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/tools/Makefile.am:15: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
2012-09-25 23:03:38 +02:00