Commit Graph

255 Commits

Author SHA1 Message Date
vtarasov a7c75182a1 pkcs15-init: no more 'SPLIT-KEY' flag ...
more of debug messages


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5019 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 13:55:03 +00:00
vtarasov 682c464540 AuthentIC: "now there is no way to build without OpenSSL" (Andre Zepezauer)
Thanks for patch.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5011 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-31 08:54:07 +00:00
vtarasov 1a58c429cb 'AuthentIC': basic support of Oberthur's 'COSMO.v7/AuthentIC.v3.2' ...
it's the natively PKCS#15 card


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5006 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-30 14:40:28 +00:00
vtarasov 891f98363b pkcs15init: new 'emulation-store-data' operation ...
the first usage is to update the public key PKCS#15 object attributes 
and to encode it's direct value.
(support of the Oberthur's AuthentIC V3.2 card)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5001 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-30 12:50:35 +00:00
ludovic.rousseau 6f5f29eee9 Revert revision 4853 because of a regression when initialing cards
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4857 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 13:03:46 +00:00
ludovic.rousseau 70ead491fc sc_pkcs15init_read_info(): do not use affectation and test in the same
line of code but use two different lines so the code is easier to read.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4854 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-02 08:02:13 +00:00
ludovic.rousseau 93f5e24e13 sc_pkcs15init_read_info(): do not call sc_pkcs15init_parse_info() if
sc_select_file() failed.

Thanks to Andre Zepezauer for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2010-November/015216.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4853 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-02 07:59:46 +00:00
vtarasov 0d96b3c9c3 oberthur: from the common part remove the Oberthur specific tokenInfo flags
Thanks to Andre Zepezauer for the patch.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4800 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-07 15:12:12 +00:00
martin 50f99a20f8 libopensc: move TokenInfo fields from sc_pkcs15_card_t to a separate structure.
Thanks to Andre Zepezauer for the patch.

See http://www.opensc-project.org/pipermail/opensc-devel/2010-September/015076.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4788 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 15:44:58 +00:00
viktor.tarasov dc3b1d008b pkcs15init: homogenise line ending of debug messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4759 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-22 12:17:53 +00:00
martin 4a547b6f09 libopensc: Don't touch TokenInfo.flags->loginRequired
See http://www.opensc-project.org/pipermail/opensc-devel/2010-September/014871.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4722 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-15 12:00:16 +00:00
martin 1f73d32e40 libopensc: Remove unused internal SC_ERROR_EXTRACTABLE_KEY and correct relevant comments (native != extractable)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4645 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-23 10:32:26 +00:00
ludovic.rousseau f47416d60e Do not cast the return value of malloc(3) and calloc(3)
From http://en.wikipedia.org/wiki/Malloc#Casting_and_type_safety
" Casting and type safety

malloc returns a void pointer (void *), which indicates that it is a
pointer to a region of unknown data type. One may "cast" (see type
conversion) this pointer to a specific type, as in

int *ptr = (int*)malloc(10 * sizeof (int));

When using C, this is considered bad practice; it is redundant under the
C standard. Moreover, putting in a cast may mask failure to include the
header stdlib.h, in which the prototype for malloc is found. In the
absence of a prototype for malloc, the C compiler will assume that
malloc returns an int, and will issue a warning in a context such as the
above, provided the error is not masked by a cast. On certain
architectures and data models (such as LP64 on 64 bit systems, where
long and pointers are 64 bit and int is 32 bit), this error can actually
result in undefined behavior, as the implicitly declared malloc returns
a 32 bit value whereas the actually defined function returns a 64 bit
value. Depending on calling conventions and memory layout, this may
result in stack smashing.

The returned pointer need not be explicitly cast to a more specific
pointer type, since ANSI C defines an implicit conversion between the
void pointer type and other pointers to objects. An explicit cast of
malloc's return value is sometimes performed because malloc originally
returned a char *, but this cast is unnecessary in standard C
code.[4][5] Omitting the cast, however, creates an incompatibility with
C++, which does require it.

The lack of a specific pointer type returned from malloc is type-unsafe
behaviour: malloc allocates based on byte count but not on type. This
distinguishes it from the C++ new operator that returns a pointer whose
type relies on the operand. (see C Type Safety). "

See also
http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014586.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4636 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 15:08:51 +00:00
viktor.tarasov ae14336221 pkcs15init: create frame to implement card specific 'sanity check' procedure
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4508 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-02 14:26:29 +00:00
viktor.tarasov 2883c17b15 pkcs15init: homogenize argument order of pkcs15init operations
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4507 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-02 13:46:13 +00:00
viktor.tarasov 78d6bc4189 pkcs15init: fix undeclared variable
Noted by Jean-Michel, thanks.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4383 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-27 08:12:20 +00:00
viktor.tarasov fff1963931 pkcs15init: do not reuse existing file when storing object data or updating certificate
merged with r4380:4380 of https://www.opensc-project.org/svn/opensc/branches/vtarasov/opensc-sm.trunk



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4382 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-26 14:33:01 +00:00
viktor.tarasov e23756123e pkcs15init: when verifying PIN, if no value supplied, try to use pin pad
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4361 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-19 08:26:01 +00:00
ludovic.rousseau e63d12bc8f replace spaces by tab
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4326 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-10 14:35:43 +00:00
viktor.tarasov 922d7cdc66 add TODO comments
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4325 c6295689-39f2-0310-b995-f0e70906c6a9
2010-05-10 09:18:49 +00:00
viktor.tarasov d5f201bcb5 pkcs15init: in sc_pkcs15init_update_file() take care about file selection errors
Noted by Ludovic.

In sc_pkcs15init_update_file() procedure the file selection errors other then SC_ERROR_FILE_NOT_FOUND were not treated.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4271 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-28 09:20:17 +00:00
viktor.tarasov 06f5b0ba5b pkcs15init: when updating certificate and when there are no ACLs in FCI of selected file use default ACLs from the card profile
Some cards do not include security attributes into the FCI returned by 'SELECT' command.
    For such cards, when updating certificate, to authenticate 'UPDATE' operation use the
    'sc_file' with default ACLs instantiated from the card profile.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4265 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-24 17:37:02 +00:00
viktor.tarasov 8f4ee1b6e4 pkcs15init: fix #96: more details for the load profiles error
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4261 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-20 17:09:26 +00:00
viktor.tarasov 1c7aefe76e pkcs15init: corrent debug messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4216 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-12 08:46:27 +00:00
viktor.tarasov f9eb1b3bbb pkcs15init: for the newly generated key object set public key as it's content
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4215 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-12 08:44:24 +00:00
ludovic.rousseau 88764575f2 use (const char *) as return type to avoid compilation warnings:
pkcs15-lib.c: In function ‘get_template_name_from_object’:
pkcs15-lib.c:2152: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2154: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2156: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2159: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2161: warning: return discards qualifiers from pointer target type
pkcs15-lib.c: In function ‘get_pin_ident_name’:
pkcs15-lib.c:2815: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2817: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2819: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2823: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2825: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2827: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2829: warning: return discards qualifiers from pointer target type
pkcs15-lib.c:2832: warning: return discards qualifiers from pointer target type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4196 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-02 11:55:13 +00:00
martin d1d47d44c5 Fix #198: set correct access flags to private keys
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4193 c6295689-39f2-0310-b995-f0e70906c6a9
2010-04-01 14:16:43 +00:00
ludovic.rousseau 5914be4e58 Fix
pkcs15-lib.c:799: warning: no previous prototype for ‘sc_pkcs15init_store_puk’
pkcs15-lib.c:2814: warning: no previous prototype for ‘get_pin_ident_name’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4152 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-28 09:45:54 +00:00
viktor.tarasov 7106674d41 oberthur pkcs15init: support for creation of the 'public' DATA objects
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4143 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-22 14:17:27 +00:00
viktor.tarasov 0c9b9f21a8 pkcs15init: free cert object if 'link object' failed
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4135 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-18 10:25:50 +00:00
viktor.tarasov ef8e169955 pkcs15init: use encoded public key as the 'content' of private and public key pkcs15 objects
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4134 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-18 10:15:51 +00:00
viktor.tarasov 965ecbf9a1 pkcs15init: pkcs15 card flags
Set 'TOKEN INITIALIZED' after an application has been added,
set 'USER PIN INITIALIZED' and 'LOGIN REQUIRED' after User PIN object has been created.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4130 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-18 09:27:09 +00:00
viktor.tarasov 5eba20e263 pkcs15init emulation: use emu_update_tokeninfo() if available
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4129 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-18 09:20:33 +00:00
viktor.tarasov e214ba206c pkcs15init: emulation API
Four method are added to the 'sc_pkcs15init_operations':
emu_update_dir		-- create or not the DIR file;
emu_update_any_df	-- update the non-pkcs15 descriptors that are equivalents to pkcs15 xDF files;
emu_update_tokeninfo	-- update analog of tokenInfo;
emu_write_info		-- to not create OPENSC-INFO file;


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4128 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-18 09:10:51 +00:00
viktor.tarasov fb45d8925b pkcs15init: simplify internal API
; do not pad PIN in pkcs15init. It's already done in libopensc/pkcs15-pin;
; the 'do_verify_pin()', 'sc_pkcs15init_verify_key()' and 'do_get_and_verify_secret()' are replaced by unique 'sc_pkcs15init_verify_secret()'; edit debug messages;



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4123 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-17 16:26:07 +00:00
aj 6545b42c02 cleanup of the debug code:
* reduce to a few, supported functions.
* change all functions to take the debug level as parameter.
* use symbolic names for the debug levels.
* fix tools to pass "verbose"/"opt_debug" as ctx->debug.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4118 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-15 12:17:13 +00:00
viktor.tarasov da9aa435c4 fix second part of #199: pkcs15init: when freeing pkcs15 object remove it from list
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4116 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-15 08:36:36 +00:00
viktor.tarasov e5300b1c2d fix #199: to authenticate 'update' in sc_pkcs15init_update_file() use the file instantiated from profile, rather then selected one
This bug concerned the card drivers for which the file ACLs cannot be obtained from the FCI of the selected file.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4114 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-13 23:35:08 +00:00
aj 02768fb5dc remove "split-key" option and emulat sign for sign,decrypt keys with padding
and decrypt() for cardos.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4113 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-13 22:52:51 +00:00
viktor.tarasov 8b15f0f340 pkcs15init: sc_pkcs15_add_df() has no more 'handler' parameter
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4110 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-13 19:54:28 +00:00
viktor.tarasov 052881c38f libopensc: in pkcs15 PIN commands 'pin_info' parameter replaced by 'pin_object'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4103 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-10 09:23:01 +00:00
viktor.tarasov 3a2f0415fe libopensc emu: postponed object loading
Some non-pkcs15 cards protect the reading of the private objects attributes. 

For the emulated pkcs15 cards, the 'init' emu-handler was the only place where pkcs15 objects could be loaded.
This handler is called before the card is binded, and so, for an application there was no 'normal' way to verify PIN and load the objects with protected attributes.

Actually it's possible to complete list of the pkcs15 objects after the emulated pkcs15 card has been binded. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4096 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-09 16:49:00 +00:00
viktor.tarasov aff7b5523c pkcs15init: homegenize pin reference type in a different structures; remove unused parameters in the internal procedures;
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4088 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-05 10:37:11 +00:00
viktor.tarasov 3a424cf26a pkcs15init: dummy object is not needed for the sc_pkcs15_find_XX() procedures; coding style issues
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4086 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-04 16:14:30 +00:00
viktor.tarasov de3e6aeba9 pkcs15init: prepare instantiation of the pin-domain templates
When binding profile and p15card (in sc_pkcs15init_set_p15card()), add to the profile EF list the named DF for the path of the all existing AUTH.

; variables name and coding style issues;
; debug messages;


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4084 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-04 13:05:03 +00:00
aj d22a2483c0 Header file cleanup.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4081 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-04 08:14:36 +00:00
viktor.tarasov 02c35be138 asepcos: 'trasport PIN' (global PIN with reference '0') is presented as 'AUT' key
; no more need of athena dedicated PIN flag 'TRANSPORT KEY';



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4078 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-02 16:22:33 +00:00
viktor.tarasov de6649fed5 pkcs15init asepcos: fixup initialisation with protected profile
; new, athena dedicated, PIN pkcs15 flag 'TRANSPORT_KEY': 
in the Athena initialization procedure the 'trasport' SOPIN object is used. This object references to the pre-existing global SOPIN and is different from the final SOPIN of the card. This object should be ignored when fixing up the ACLs of the newly created file;

; the pkcs15 refereces of the new private keys are derived from the file-id;

; remove duplicated code;

; some log messages in  pkcs15-lib.c;




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4077 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-02 09:50:07 +00:00
viktor.tarasov 70ee7c1438 pkcs15init: in sc_pkcs15init_add_object() if DF update fails, remove object from the list before return
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4076 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-01 15:29:39 +00:00
viktor.tarasov dbd315c7e9 profile: 'cbs' member of 'struct sc_profile' is not used
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4075 c6295689-39f2-0310-b995-f0e70906c6a9
2010-03-01 14:01:25 +00:00