Commit Graph

5333 Commits

Author SHA1 Message Date
Viktor Tarasov db9e4c9039 build: suppress warning 'unused-parameter' 2013-12-29 17:38:44 +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
Martin Paljak 91e3988ef0 macosx: fix typo in distribution descriptor 2013-12-18 10:40:59 +00:00
Martin Paljak d4a3edac08 macosx: update package building to modern tools
PackageMaker has been deprecated since Xcode 4.6.
pkgbuild and productbuild have been available since 10.6.6
2013-12-18 09:49:44 +00:00
Martin Paljak cfe0e7368d macosx: silence the deprecation warnings about OpenSSL 2013-12-11 10:41:19 +00:00
Doug Engert dff25190d2 Merge pull request #197 from CardContact/master
Changing EC Public Key format in PuKDF from raw to spki
2013-12-09 13:15:51 -08: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 09e5a9fa7f pkcs11: Fixed typo 2013-12-05 14:26:49 +01:00
Martin Paljak 1acb4adc3e Check for NULL before dereferencing.
Reported by STACK

http://css.csail.mit.edu/stack/

Change-Id: Id7959c8217f46313ecf35a271efaf5f703fde2dc
2013-11-25 19:25:43 +02: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
Andreas Schwier 4604dac3a7 sc-hsm: Fixed memory checking and removed warning 2013-11-15 11:41:10 +01:00
Doug Engert f09dae493c Merge pull request #196 from dengert/master
EC parameters not copied correctly
2013-11-14 08:17:05 -08:00
Doug Engert 9ff8bd1c61 EC parameters not copied correctly
As reported in Github, the memcpy was not valid.

	pkcs15-pubkey.c-20131106-09007
2013-11-14 09:38:49 -06:00
Doug Engert 5dd5994492 Merge pull request #194 from dengert/ecpointQ
EcpointQ
2013-11-12 06:56:10 -08:00
Doug Engert 86d5941e4c Merge branch 'ecpointQ' of https://github.com/dengert/OpenSC into ecpointQ 2013-11-06 16:35:09 -06: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
Doug Engert bec6d143f3 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:09:29 -06:00
Ludovic Rousseau a18a7d8ecf Fix typo 2013-11-01 18:00:49 +01:00
Martin Paljak 6e255a9503 osx: target 10.9 (a free upgrade to anyone using 10.6+) from now on. 2013-10-24 13:29:34 +03:00
Raul Metsma 2b45194f4b Add EstEID 3.5 card support
EstEID card has new cold ATR and AID
2013-10-20 20:17:57 +02:00
Ludovic Rousseau 5979e2fed8 Add documentation for --list-token-slots, -T 2013-10-20 13:32:45 +02:00
Viktor Tarasov 80788dfcb2 fix LGPL version
f5814595db (commitcomment-3971686)
2013-09-29 20:55:41 +02: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
Tim Taylor 2dee7baae0 Extract public key from cert if no object on card 2013-09-29 19:32:25 +02:00
Frank Morgner a635d44336 fixed initialization of structure 2013-09-29 19:19:17 +02:00
Frank Morgner 7a87d947e7 don't require ushort to be present 2013-09-29 19:19:17 +02:00
Frank Morgner d5e86752de added getpass implementation for non windows
modifies terminal attributes to emulate _getch
2013-09-29 19:19:17 +02:00
Tim Taylor 2741f23641 Set output buffer len variable if padding removed. 2013-09-29 19:14:01 +02:00
Tim Taylor cd1116ac7c Use reader pin pad if available and allowed 2013-09-29 19:08:51 +02:00
Frank Morgner 6e728a89ee verifying the pin is a valid action 2013-09-29 18:53:04 +02:00
Frank Morgner 3d0064e983 don't expect the card to specify the file length in generic tools
if sc_file_t.size == 0 we try to read 1024 bytes by default.
2013-09-29 18:52:48 +02:00
Frank Morgner c023d20e14 removed unused reference to sm_iasecc_rsa_generate 2013-09-29 18:52:38 +02:00
Tim Taylor b731dac518 Reset return code to success if pubkey read from cert. 2013-09-29 18:31:33 +02:00
Ludovic Rousseau 3afe644c0d Fix integration problem with DNIe
card-dnie.c:1481:2: error: too few arguments to function `sc_pkcs1_strip_01_padding'

The prototype of sc_pkcs1_strip_01_padding() changed between the patch
submission and its integration.
2013-08-27 10:58:20 +02:00
Ludovic Rousseau 02727a1406 Merge pull request #168 from germanblanco/opendnie
Adding support for DNIe.
2013-08-27 01:52:55 -07:00
Charles Bancroft 865900e210 Updated load_cert to use the proper key identifier 2013-08-10 22:30:59 +02:00
Viktor Tarasov 12e0ac1aa6 minidriver: add registers file for feitian cards 2013-08-10 22:25:30 +02:00
Viktor Tarasov f5814595db packaging: debian packaging templates 2013-08-07 10:34:13 +02:00
Viktor Tarasov bdd264936c pkcs15: add 'context' parameter to the strip padding procedures
and add debug messages
2013-08-03 21:53:01 +02:00
Viktor Tarasov daa79054c0 CardOS: more debug messages in 'pin-cmd' handler 2013-08-03 21:46:44 +02:00
Frank Morgner d21830344f fixed a ton of compiler warnings 2013-08-03 19:15:55 +02:00
Frank Morgner 07818329ab made sc_apdu_t.data 'const' (which it used to be)
fixes a lot of warnings which pass a const buffer to the APDU's data

Note that a non-const data member is only required for sc_allocate_apdu
sc_free_apdu. They are currently used with an explicit typecast.
However, sc_allocate_apdu and sc_free_apdu both are not used once in the
entire project. One might also simply throw both functions away.
-- Both are thrown away. (VT)
2013-08-03 18:26:04 +02:00
Viktor Tarasov 2c019485e8 Merge branch 'master' of github.com:szikora/OpenSC 2013-08-03 17:56:45 +02:00
Viktor Tarasov 1a972920f0 By default 'default' card driver is disabled ...
'Default' card driver is explicitely enabled for 'opensc-explorer' and 'opensc-tool' tools.
https://github.com/OpenSC/OpenSC/pull/175
2013-08-02 22:01:51 +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
Frank Morgner f597a7e50a enable compiler warnings by default 2013-08-02 15:21:17 +02:00