Commit Graph

958 Commits

Author SHA1 Message Date
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
Viktor Tarasov ceef4c0be3 iasecc: remove ostentatious TODO messages 2012-09-24 11:50:56 +02:00
Viktor Tarasov 58b4304957 libopensc: 'init', 'format', 'compare', 'is-valid' OID procedures
In a reason of number of bugs(*) that concern the OID management,
the general usage OID procedures 'init', 'format', 'compare', 'is-valid' are introduced.
These procedures should be used by all actors: libopensc, pkcs15, pkcs11, tools, ....

(*)
This bug reported by Andreas Schwier :
8e75d971cb (commitcomment-1792477)

In pkcs15-algo sc_asn1_get_algorithm_info() can return the OID without ending '-1's:
https://github.com/OpenSC/OpenSC/blob/staging/src/libopensc/pkcs15-algo.c#L452
https://github.com/OpenSC/OpenSC/blob/staging/src/libopensc/pkcs15-algo.c#L459
2012-09-06 10:47:29 +02:00
Andreas Schwier ee94020919 pkcs15-init: Fixed bugs and improved isolation between framework and emulation layer
select_object_path: Fixed misplaced return and wrong return code. This bug is the cause why a profile
must include a template even for fully emulated cards.

sc_pkcs15init_store_certificate: Added a call to the emulation layer when the private key
description requires an update after storing a certificate. Should not break existing code.

sc_pkcs15init_delete_object: Now calling the emulation layer before the frameworks tries to delete
files itself. An emulation that deletes object explicitly and leaves the deletion of some objects
to the framework will now need to completely handle deleting objects (by calling the methods of the
framework).

sc_pkcs15init_update_certificate: Missing call to the emulation layer added.
2012-09-01 21:01:51 +02:00
Ludovic Rousseau 7c39aeefb9 Fix potential NULL pointer dereference
Coverity: Dereference before null check (REVERSE_INULL)
Directly dereferencing pointer "pin_obj".
2012-08-25 19:15:27 +02:00
Viktor Tarasov 16b4cb6a3f MyEID: always select in mode 'return FCI template'
According to ch.4.2 of MyEID reference manual v1.7.6 the only possible value of P2 of 'SELECT' APDU is '00'.
For this reason, when caller do not request to return 'sc_file' data,
use the non-null dummy 'sc_file' pointer in the call of iso->select_file,
and thus avoid the P2 different from '00'.

Also log calls are replaced by its short forms,
and resolved the 'trailing spaces' issues.
2012-08-14 15:52:39 +02:00
Nguyễn Hồng Quân e34866f188 OpenPGP: Accept authentication key for S/MIME decrypting.
The card contains only 1 certificate, which can be used for encrypting.
But this certificate is bound with authentication key, so when decrypting,
the authentication key will be presented to check.
This commit allows to bypass the check in driver. However, it is not enough.
The users have to import the same key to "Encryption key" to help the card find
right key to work.

OpenPGP: Add log and comments.

OpenPGP: Pretend to select dummy files.
Some files are needed by pkcs15init, but not exist in OpenPGP card.
We pretend to know these dummy files to make pkcs15init successful.

Compilation error on windows:
when declaring array use explicit size, add pkcs15-openpgp.obj in Makefile.mak
2012-07-29 14:04:08 +02:00
Nguyễn Hồng Quân 241bfded4d OpenPGP-pkcs15init: Support generating key via pkcs15-init tool.
OpenPGP-pkcs15int: Add more debug log.

OpenPGP-pkcs15init: Add more checks in key generation.
Check for key ID. Set default key.
Check for result of key generation from driver.
2012-07-29 13:09:08 +02:00
Nguyễn Hồng Quân b67063dcd8 pkcs15init-openpgp: Support for private key import in pkcs15init.
Example command:
pkcs15-init --delete-objects privkey,pubkey --id 3 --store-private-key quan-key.pem  --auth-id 3 --verify-pin --extractable --id 3

pkcs15init-OpenPGP: Some parts in openpgp.profile are not used.
2012-07-29 13:09:08 +02:00
Nguyễn Hồng Quân 70b7b4aa54 pkcs15init-OpenPGP: Add store_data functions.
We need this function to use OpenPGP's specific action flow instead pkcs15init's default.
This will help to avoid redundant steps which may make the overall process fail.
2012-07-29 13:09:08 +02:00
Nguyễn Hồng Quân ed0e2be305 Add pkcs15init-binding for OpenPGP 2012-07-29 12:09:56 +02:00
Nguyễn Hồng Quân cf6b5e7903 pkcs15init: Add more debug log. 2012-07-07 18:42:36 +02:00
Viktor Tarasov c64a5f34d3 pkcs15init: application path selection in bind procedure
Application path can contain non-zero length path value and AID.
In this case select AID as DF_NAME only if length of path value is zero.

Segfault: dereferencing NULL pointer, thanks to Magosányi Árpád
2012-06-13 08:31:46 +02:00
Viktor Tarasov 78fe16654e pkcs15init: iasecc: create objects for minidriver support
- Create/delete the PKCS#15 'DATA' objects destinated to supply support of minidriver. For a while only 'Gemalto' style of such support is implemented.
- Declare epass2003 pkcs15init operations.
- include into OpenSC configuration the SM related sections
2012-06-08 20:17:36 +02:00
Viktor Tarasov 00b069a08e epass2003: support for ePass2003 card in read/write modes 2012-06-08 20:17:36 +02:00
Viktor Tarasov 635be92a0c pkcs15init: call sc_profile_finish() with 'app-info' data ...
call sc_profile_finish() with application info data as an argument;
in delete-by-path procedure, when getting authorization to delete file, make distinction between 'DELETE' and 'DELETE-SELF';
call card specific 'store' handler updating PrKDF and PubKDF files;
deduce the private key pkcs#15 attributes (like subject) from the friend certificate;
ignore SM authentication type when getting authorisation for operation;
copy GUID from the object create data to the pkcs#15 object attributes.
2012-05-31 18:33:50 +02:00
Viktor Tarasov 6337149ef7 pkcs15: decode 'seInfo', 'profileIndication', 'lastUpdate'
Encode,decode  'lastUpdate', 'seInfo', 'profileIndication' of TokenInfo (CIAInfo).
Trailing whitespaces.
2012-05-30 09:03:27 +02:00
Viktor Tarasov 9c5dbea883 pkcs11: ECHD and secret keys support from Douglas
This support were initially proposed by Douglas (https://github.com/dengert/OpenSC/commits/ecdh) and
then merged into SM branch (https://github.com/viktorTarasov/OpenSC-SM/tree/secure-messaging).
2012-05-28 20:06:23 +02:00
Viktor Tarasov 363e374664 pkcs15init: syntax changed for the ias(ecc) profiles 2012-05-26 09:36:49 +02:00
Viktor Tarasov b432e9767f pkcs15init: add 'minidriver-style' profile option
The on-card support of minidriver could need some MD specific pkcs#15 (DATA) objects.
There is no standard for these objects.
New option will allow to choose one of the possible implementations.
2012-05-26 09:36:49 +02:00
Viktor Tarasov 10e1ad001d pkcs15init: change sc_pkcs15init_bind() prototype
Add new argument 'application-info',
that will allow to select the on-card application to by binded with.

pkcs11: use sc_pkcs15init_bind with 'AID' argument

Prototype of sc_pkcs15init_bind() has been changed to add argument with
AID of the on-card application to be binded with.
2012-05-26 09:36:25 +02:00
Viktor Tarasov e57d443e86 pkcd15init: remove trailing whitespaces
inspired by
http://www.opensc-project.org/pipermail/opensc-devel/2012-March/017883.html

Change-Id: I817f903e67965942d9cc0c30931dbaea0c5f736e
2012-04-02 23:40:05 +02:00
Viktor Tarasov af559fbffd Merge branch 'master' into staging 2012-02-22 11:20:17 +01:00
Stef Walter 6ed52a06b8 libopensc: Don't fail to allocate memory when mlock fails
* Print out warning when mlock fails, and continue.
 * The warning required a ctx to be passed in, so that means
   changing a few function signatures.

https://www.opensc-project.org/opensc/ticket/389
2012-02-17 10:02:55 +01:00
Robbert Müller 61ea63304b Changing default usage from sign to verify, because verify is the public key opposite of sign for the private key 2012-01-08 15:17:33 +01:00
Ludovic Rousseau 40cb1c9e35 Merge remote branch 'upstream/master' 2011-06-14 14:00:18 +02:00
jps 93cc9bef1a For CardOS 4.3B and 4.4, the Verify Retry Counter Package
can be loaded at ADMINISTRATION life cycle phase to change
the behavior of the VERIFY command in regard to return codes.
When that package is loaded, the return code of the VERIFY 
will be ISO7816-4 compliant (63Cx with x being the value of 
the remaining retry counter when required verification has failed).


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5565 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-10 09:14:02 +00:00
jps c5c2366a0b Revert 5558
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5562 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-08 07:58:51 +00:00
jps b422872813 For CardOS 4.3B and 4.4, the Verify Retry Counter Package
can be loaded at ADMINISTRATION life cycle phase to change
the behavior of the VERIFY command in regard to return codes.
When that package is loaded, the PIN can be created with this
"verifyRC" flag in cardos.profile if the return code must be 
ISO7816-4 compliant (63Cx with x being the value of the remaining 
retry counter when required verification has failed).



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5558 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-07 12:44:53 +00:00
Ludovic Rousseau 90272799f0 Fix compiler warning
Declare the function static to fix:
pkcs15-lib.c:1069: warning: no previous prototype for 'sc_pkcs15init_encode_prvkey_content'
2011-06-07 10:23:56 +02:00
vtarasov d5b8a6cd5f RuToken: 'use uninitialized variable' warning
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5553 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-05 16:53:07 +00:00
vtarasov d888b3fd55 pkcs15: use general 'AuthenticationObject' instead of 'PinObject'
now the attributes of the previous 'pin-info' data type are included
as the sub-type attributes of the general 'auth-info' data .
It will allow to include support of the 'biometricTemplate' and 'authKey' authentication types.

http://www.opensc-project.org/pipermail/opensc-devel/2011-May/016655.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5550 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-05 15:46:25 +00:00
vtarasov 438cf4b2d4 RuToken-ECP: profile option to allow the reset of User PIN with SoPIN
http://www.opensc-project.org/pipermail/opensc-devel/2011-May/016716.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5542 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-02 19:06:43 +00:00
vtarasov f026db6f84 compile warnings: resolve 'comparison between signed and unsigned' compiler warnings
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5534 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-02 16:59:39 +00:00
vtarasov 9ac55871fb pkcs15init: oberthur: cleanup compiler warnings
http://www.opensc-project.org/pipermail/opensc-devel/2011-May/016724.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5532 c6295689-39f2-0310-b995-f0e70906c6a9
2011-06-01 17:15:31 +00:00
vtarasov ee4f346b07 pkcs15init oberthur: avoid warnings 'signed/unsigned mismatch'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5512 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-28 22:47:05 +00:00
martin 2d43c601e9 Remove unused code: sc_pkcs15init_get_label()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5511 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-28 22:14:14 +00:00
martin 215c133ba0 libopensc: remove more traces of software token/non-native private key related code.
pkcs15-wrap.c can be removed. Clarified/changed the meaning of "insecure" flag to pkcs15-init tool,
which will be needed to explicitly enforce the creation of a key which does not require a PIN.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5510 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-28 22:14:07 +00:00
vtarasov d139c2281b pkcs15init: move the key type specific code to the dedicated procedure
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5467 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-22 11:42:53 +00:00
ludovic.rousseau 0dfe6331fa Fix compiler warning
pkcs15-lib.c:167: warning: no previous prototype for 'sc_pkcs15init_empty_callback'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5459 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-22 10:00:12 +00:00
vtarasov 1f892af9eb pkcs15init: non-unique ID is forbidden for the public key objects
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5432 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-08 15:53:39 +00:00
vtarasov fc07974be8 iasecc: pkcs15init: test for the wrong error code was used ...
in 'Delete SDO' procedure to ignore the 'SDO don not exist' error.
Thanks to Gilles Blanc.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5422 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-04 11:41:13 +00:00
vtarasov 822fdc7f38 pkcs15init: pkcs15init emulator for PIV card will not be commited
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5420 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-03 07:55:38 +00:00
vtarasov 0783ffd4c7 iasecc: pkcs15init: when deleting SDO, do not try to overwrite 'non-updateable' SDO attribut
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5419 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-03 07:54:13 +00:00
vtarasov 2aa4673577 iasecc: obsolete syntax of the 'Adele Common' card profile
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5418 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-03 07:50:26 +00:00
vtarasov ab225db83d pkcs15init: more of debug messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5415 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-01 20:21:31 +00:00
vtarasov 1e59a09dbd pkcs15init: for the EC key put the EC specific data into the 'params' member of 'key-info' data ...
; more of debug messages;


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5414 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-01 20:14:06 +00:00
vtarasov 5e50a14b3f libopensc: introduce 'key-params' data type that contains pointer, size and 'free' handler ...
http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016441.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5413 c6295689-39f2-0310-b995-f0e70906c6a9
2011-05-01 19:18:14 +00:00
vtarasov 49fb08f923 pkcs15init: use macro for the maximal number of linked ACL for one operation ...
Thanks to NdK. 
http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016448.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5406 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 14:45:23 +00:00
vtarasov 06347f3a44 iasecc pkcs15init: when creating key slot, there is no needs to write zero value components
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5400 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-27 13:45:27 +00:00
vtarasov 81e1676122 iasecc pkcs15init: create/delete SDO private/public RSA key
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5399 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 17:32:34 +00:00
vtarasov 5e6d310491 iasecc: pkcs15init profiles: add 'CREATE' acl for the Oberthur's application DF ...
Obertbur's card do not returns FCP for selected application DF.
Newly introduced option will supply the missing ACL when creating new objects or files.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5395 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-26 16:27:42 +00:00
vtarasov 54f3e8c423 pkcs15init: little correction of r5386
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5390 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-22 14:02:45 +00:00
vtarasov 6b04ab7650 pkcs15init: in 'change-attribute' procedure use card specific 'update DF' handler ...
... when it's available. 
'Change-attribute' is used by pkcs15 framework for PKCS#11.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5389 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-22 14:00:47 +00:00
vtarasov 4fa9679463 pkcs15init: use dedicated function to fix the EC parameters ...
; use pointQ data to calculate intrinsic ID for the EC keys/certs


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5388 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-22 13:50:01 +00:00
vtarasov 78d90c4765 EC support: introduce data type dedicated to EC parameters ...
EC parameters can be presented in a three forms: namedCurve, OID and implicit data.
This new data type will facilitate manipulation of ec-parameters in the OpenSC tools and library.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5386 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-22 13:08:45 +00:00
vtarasov 3e9b88d6d6 pkcs15init iasecc: old syntax in the profile of the Oberthur's generic application
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5385 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-21 17:20:39 +00:00
andre ff7bb8fbf4 profile.c: Avoid warning:
profile.c:1212: warning: comparison between signed and unsigned

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5373 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 12:59:23 +00:00
andre 261d5269e5 pkcs15-init.h: Avoid warning:
pkcs15-init.c:1473: warning: assignment discards qualifiers from pointer target type

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5362 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-19 09:12:17 +00:00
vtarasov 8de6b57882 pkcs15init: different possible kinds of EC generate key parameters ...
named curve, oid and der


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5357 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-17 18:48:12 +00:00
vtarasov 2202614fdc pkcs15init setcos: no need of card specific 'delete-object' callback ...
there is nothing specific inside and it's never called by pkcs15init


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5349 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-16 17:57:49 +00:00
vtarasov d673e5f109 pkcs15init myEID: in profile increase size of xDF files, also ...
during initialization add the all xxDF to the ODF


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5344 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-15 17:11:38 +00:00
vtarasov 614e9fa566 pkcs15init: sipmlify the 'delete-object' callaback prototype ...
now it takes 'sc_pkcs15_object' argument instead of two arguments - object's type and object's data.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5343 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-15 16:50:04 +00:00
vtarasov 49da421ac0 pkcs15init: prepare pkcs15-lib for the EC key type ...
use keygen consistency procedure to return the EC key size;


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5337 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-12 18:08:18 +00:00
vtarasov 7b6cf4219e pkcs15init: when deleting object, do not try to select object file without valid path
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5336 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-12 17:59:59 +00:00
vtarasov 6705e2506b pkcs15init: remove useless function, use OpenSC standard convention for return value
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5333 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-12 13:23:05 +00:00
vtarasov 2fecaa73bd pkcs15init: introduce EC key generation parameters
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5332 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-12 11:36:40 +00:00
andre 3169f14b32 libopensc: Removes useless attribute 'file' in 'struct sc_pkcs15_df'
There is no need to carry around that attribute, because it's easy to look up the 'file' as needed. This is done by issuing a single sc_select_file command in sc_pkcs15init_update_any_df (pkcs15-lib.c).

The parameter 'file' of sc_pkcs15_add_df (pkcs15.c) became useless too and was removed in turn.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5316 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-10 04:09:33 +00:00
andre b21eeb46b9 libopensc: Removes unused flag SC_CARD_CAP_RSA_2048.
Relates to [http://www.opensc-project.org/opensc/ticket/296#comment:1 #296].

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5308 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-07 18:16:40 +00:00
martin ea7eb699e5 WindowsInstaller: build for x64 with nmake -f Makefile.mak BUILD_TYPE=WIN64
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5286 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-01 08:06:25 +00:00
ludovic.rousseau 6fe27b2c4a Fix compiler warning
pkcs15-iasecc.c:63: warning: no previous prototype for 'iasecc_reference_to_pkcs15_id'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5254 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:19:15 +00:00
ludovic.rousseau c824662a03 Fix compiler warning
pkcs15-lib.c: In function 'prkey_fixup_rsa':
pkcs15-lib.c:1936: warning: declaration of 'ctx' shadows a previous local
pkcs15-lib.c:1911: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5253 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:16:52 +00:00
ludovic.rousseau de196fa205 Fix compiler warning
pkcs15-lib.c: In function 'sc_pkcs15init_store_private_key':
pkcs15-lib.c:1339: warning: declaration of ‘ctx’ shadows a previous local
pkcs15-lib.c:1278: warning: shadowed declaration is here

The ctx variable was already declared with the correct value.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5252 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:15:30 +00:00
ludovic.rousseau f88bbe117f Remove typedef file_info to complete the change/cleanup in revision 5250
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5251 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:12:40 +00:00
ludovic.rousseau 99bbc06bcb Fix compiler warning
profile.c: In function 'sc_profile_get_pin_id_by_reference':
profile.c:785: warning: declaration of ‘pin_info’ shadows a global declaration
profile.c:217: warning: shadowed declaration is here

Avoid using a typedef with a "common" name


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5250 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:10:10 +00:00
martin 7ab9b7f10d Fix a typo reported by lintian
I: libopensc3: spelling-error-in-binary ./usr/lib/libopensc.so.3.0.0 extention extension

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5238 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-20 12:18:55 +00:00
vtarasov 3c5d61716c pkcs15init: EnterSafe: increase size of the xDF files
http://www.opensc-project.org/pipermail/opensc-devel/2011-February/016051.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5236 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-15 09:39:04 +00:00
vtarasov 763c0bcefe pkcs15init: #327: unique ID for the private key objects. Thanks a Diego (NdK) ...
http://www.opensc-project.org/opensc/ticket/327


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5219 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-06 11:34:58 +00:00
vtarasov 4f266b6099 libopensc: include 'scdl' library when linking with Visual Studio ...
missing 'scdl' header file in 'pkcs15-lib'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5206 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 13:35:25 +00:00
martin 2ea78bf741 Amend r5201: also move libltdl build properties to the right Makefile and other leftovers.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5203 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-17 07:45:36 +00:00
martin ffb46d2573 core: reanimate the sc_dlopen API for dynamic loading
* shift libpkcs11 from src/pkcs11 to src/common as it is not used to implement the OpenSC PKCS#11 module
 * invent a "libscdl" mini library that implements either libltdl based dynamic loading or uses native interfaces
 * drop hard requirement for libltl to build OpenSC
 * native Windows build does not need libltdl any more
 * specify CNGSDK include dir to find cardmod.h. CNGSDK only registers with a handful of compilers

Deals with #323

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5201 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 19:02:11 +00:00
vtarasov 53dd2ceafa IAS/ECC: remove dead code and '//' coments, resolve some warnings ...
to be continued, thanks to Martin


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5200 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 14:05:17 +00:00
vtarasov 69b7f200eb IAS/ECC: include support of the IAS/ECC v1.0.1 cards ...
http://www.opensc-project.org/pipermail/opensc-devel/2011-January/015756.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5198 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 10:59:10 +00:00
vtarasov 57b7a81c3a IAS/ECC: add IAS/ECC card specific files ...
as it was announced in 
http://www.opensc-project.org/pipermail/opensc-devel/2011-January/015756.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5197 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 10:55:05 +00:00
vtarasov ce116f42b6 pkcs15init: for MyEID card set tokenInfo flags ...
it's a part of demand of the card driver's maintainer
http://www.opensc-project.org/pipermail/opensc-devel/2011-February/015994.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5196 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 10:46:06 +00:00
ludovic.rousseau b6ea61fcf5 Remove dead code
pkcs15-authentic.c:692:2: warning: Value stored to 'caps' is never read
        caps = card->caps;
        ^      ~~~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5151 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:54:31 +00:00
ludovic.rousseau 28bf3bf02e Remove dead code
pkcs15-oberthur-awp.c:143:3: warning: Value stored to 'desc' is never read
                desc = "Oberthur AWP container list";
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur-awp.c:138:3: warning: Value stored to 'desc' is never read
                desc = "Oberthur AWP private object list";
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur-awp.c:133:3: warning: Value stored to 'desc' is never read
                desc = "Oberthur AWP public object list";
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur-awp.c:128:3: warning: Value stored to 'desc' is never read
                desc = "Oberthur AWP token info";
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur-awp.c:122:3: warning: Value stored to 'desc' is never read
                desc = "Oberthur AWP private data object info";
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur-awp.c:117:3: warning: Value stored to 'desc' is never read
                desc = "Oberthur AWP data object info";
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur-awp.c:112:3: warning: Value stored to 'desc' is never read
                desc = "Oberthur AWP public key info";
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur-awp.c:106:3: warning: Value stored to 'desc' is never read
                desc = "Oberthur AWP private key info";
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur-awp.c💯3: warning: Value stored to 'desc' is never read
                desc = "Oberthur AWP certificate info";
                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur-awp.c:338:2: warning: Value stored to 'rec_offs' is never read
        rec_offs = 0;
        ^          ~
pkcs15-oberthur-awp.c:1369:2: warning: Value stored to 'offs' is never read
        offs += len;
        ^       ~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5150 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:53:08 +00:00
ludovic.rousseau 12a0613da2 Remove dead code
pkcs15-oberthur.c:457:4: warning: Value stored to 'type' is never read
                        type = SC_PKCS15INIT_USER_PIN;
                        ^      ~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur.c:452:4: warning: Value stored to 'type' is never read
                        type = SC_PKCS15INIT_USER_PUK;
                        ^      ~~~~~~~~~~~~~~~~~~~~~~
pkcs15-oberthur.c:445:4: warning: Value stored to 'type' is never read
                        type = SC_PKCS15INIT_SO_PIN;
                        ^      ~~~~~~~~~~~~~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5149 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:51:02 +00:00
ludovic.rousseau 041a1449f5 Remove dead code
pkcs15-myeid.c:251:4: warning: Value stored to 'type' is never read
          type = SC_PKCS15INIT_USER_PIN;
          ^      ~~~~~~~~~~~~~~~~~~~~~~
pkcs15-myeid.c:244:4: warning: Value stored to 'type' is never read
          type = SC_PKCS15INIT_SO_PIN;
          ^      ~~~~~~~~~~~~~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5148 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:50:00 +00:00
ludovic.rousseau d3a5a1389f Remove dead code
pkcs15-muscle.c:101:3: warning: Value stored to 'type' is never read
                type = SC_PKCS15INIT_USER_PIN;
                ^      ~~~~~~~~~~~~~~~~~~~~~~
pkcs15-muscle.c:99:3: warning: Value stored to 'type' is never read
                type = SC_PKCS15INIT_SO_PIN;
                ^      ~~~~~~~~~~~~~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5147 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:48:56 +00:00
ludovic.rousseau b4bdb72745 Remove dead code
pkcs15-incrypto34.c:133:7: warning: Although the value stored to 'r' is used in
      the enclosing expression, the value is never actually read from 'r'
  ...r = sc_pkcs15init_authenticate(profile, p15card, file, SC_AC_OP_DELETE)...
     ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5146 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:47:40 +00:00
ludovic.rousseau 80ed46d689 Remove dead code
pkcs15-starcos.c:158:3: warning: Value stored to 'p' is never read
        *p++ = ipf_file->size & 0xff;
         ^~~
pkcs15-starcos.c:128:3: warning: Value stored to 'p' is never read
        *p++ = 0x00;    /* SM ISF: no */
         ^~~
pkcs15-starcos.c:239:3: warning: Value stored to 'p' is never read
        *p++ = ipf_file->size & 0xff;
         ^~~
pkcs15-starcos.c:206:3: warning: Value stored to 'p' is never read
        *p++ = 0x00;            /* SM ISF: no */
         ^~~
pkcs15-starcos.c:636:4: warning: Value stored to 'p' is never read
                *p++ = 0x00;
                 ^~~
pkcs15-starcos.c:613:4: warning: Value stored to 'p' is never read
                *p++ = (u8) kinfo->key_reference;       /* CHA byte */
                 ^~~
pkcs15-starcos.c:699:3: warning: Value stored to 'p' is never read
        *p++ = (u8) kinfo->key_reference;       /* CHA */
         ^~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5145 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:46:24 +00:00
ludovic.rousseau 98dd13f44f Remove dead code
pkcs15-jcop.c:118:17: warning: Value stored to 'type' is never read
                type = SC_PKCS15INIT_USER_PIN;
                ^      ~~~~~~~~~~~~~~~~~~~~~~
pkcs15-jcop.c:112:17: warning: Value stored to 'type' is never read
                type = SC_PKCS15INIT_SO_PIN;
                ^      ~~~~~~~~~~~~~~~~~~~~
pkcs15-jcop.c:171:9: warning: Value stored to 'pub_len' is never read
        pub_len = 2 + mod_len + exp_len;
        ^         ~~~~~~~~~~~~~~~~~~~~~
pkcs15-jcop.c:284:6: warning: Value stored to 'bytes' is never read
     bytes   = mod_len / 2;
     ^         ~~~~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5144 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:45:05 +00:00
ludovic.rousseau 18c144603a Remove dead code
pkcs15-cflex.c:747:3: warning: Value stored to 'key' is never read
        *key++ = 0;
         ^~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5143 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:42:50 +00:00
ludovic.rousseau 9df8712b9e Remode dead code
pkcs15-gpk.c:213:3: warning: Value stored to 'type' is never read
                type = SC_PKCS15INIT_USER_PIN;
                ^      ~~~~~~~~~~~~~~~~~~~~~~
pkcs15-gpk.c:207:3: warning: Value stored to 'type' is never read
                type = SC_PKCS15INIT_SO_PIN;
                ^      ~~~~~~~~~~~~~~~~~~~~
pkcs15-gpk.c:853:3: warning: Value stored to 'pe' is never read
                pe++;
                ^~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5142 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:41:51 +00:00
ludovic.rousseau b8a9abe314 Remove dead code
pkcs15-lib.c:727:4: warning: Value stored to 'pin_type' is never read
                        pin_type = SC_PKCS15INIT_USER_PIN;
                        ^          ~~~~~~~~~~~~~~~~~~~~~~
pkcs15-lib.c:1011:3: warning: Value stored to 'pin_type' is never read
                pin_type = SC_PKCS15INIT_SO_PIN;
                ^          ~~~~~~~~~~~~~~~~~~~~
pkcs15-lib.c:1009:3: warning: Value stored to 'pin_type' is never read
                pin_type = SC_PKCS15INIT_USER_PUK;
                ^          ~~~~~~~~~~~~~~~~~~~~~~
pkcs15-lib.c:1505:2: warning: Value stored to 'usage' is never read
        usage = SC_PKCS15_PRKEY_USAGE_SIGN;
        ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-lib.c:1507:3: warning: Value stored to 'usage' is never read
                usage = sc_pkcs15init_map_usage(args->x509_usage, 0);
                ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs15-lib.c:2560:3: warning: Value stored to 'file' is never read
                file = df->file;
                ^      ~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5141 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:38:49 +00:00
ludovic.rousseau fb9e21d823 Fix a memory leak
The initializations are already done a few lines below

pkcs15-lib.c:1938:11: warning: Value stored to 'ctx' during its initialization
      is never read
                BN_CTX *ctx = BN_CTX_new();
                        ^     ~~~~~~~~~~~~
pkcs15-lib.c:1937:11: warning: Value stored to 'aux' during its initialization
      is never read
                BIGNUM *aux = BN_new();
                        ^     ~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5140 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 20:29:52 +00:00
ludovic.rousseau c17eb11d41 Fix compiler warning
pkcs15-authentic.c:97:1: warning: no previous prototype for function
      'authentic_reference_to_pkcs15_id' [-Wmissing-prototypes]
authentic_reference_to_pkcs15_id (unsigned int ref, struct sc_pkcs15_id *id)
^


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5130 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 17:04:02 +00:00
ludovic.rousseau 65b65e588b Use & for logical and
pkcs15-asepcos.c:518:23: warning: use of logical && with constant operand; switch to bitwise & or remove constant [-Wconstant-logical-operand]
        *p++ = (fileid >> 8) && 0xff;
                             ^  ~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5129 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 16:54:28 +00:00
vtarasov 8e81e3912b MyEID: pkcs15init: create all xDF files at the stage of the card initialisation ...
it was discussed in 
http://www.opensc-project.org/pipermail/opensc-devel/2011-January/015620.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5115 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-19 14:47:54 +00:00
vtarasov 2fff7a1e91 pkcs15init: profile: unused variables
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5113 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-19 14:16:12 +00:00