Commit Graph

3541 Commits

Author SHA1 Message Date
viktor.tarasov 596b8c3c03 oberthur: clean 'global' PIN reference flag when getting byte from ACL
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3979 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-02 14:31:37 +00:00
martin ff4c2c6aa2 Include simclist.h to opensc includes to be able to build OpenSC.tokend
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3978 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-02 12:53:44 +00:00
martin 92debb4b5e PC/SC: Do not try to watch 0 readers on OS X
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3977 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-02 12:01:36 +00:00
viktor.tarasov bf471eaf74 pkcs15init: migrate MyEID to the New API
Migrated without testing, but normally should work -- the pkcs15init part of MyEID and SetCOS are sufficiently close.




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3976 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-02 09:46:03 +00:00
viktor.tarasov 840053f6ba pkcs15init: migrate MyEID to the New API
Migrated without testing, but normally should work -- the pkcs15init part of MyEID and SetCOS are sufficiently close.




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3975 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-02 09:44:46 +00:00
viktor.tarasov 976c214a05 pkcs15init: unused variables
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3974 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-02 09:33:29 +00:00
aj ac9f672189 update windows makefiles: only create one dll.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3973 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-01 15:22:28 +00:00
aj e9b3c5982e remove no longer used export files.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3972 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-01 15:20:51 +00:00
aj 4b2fe63ac2 build only one shared library instead of many.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3971 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-01 15:12:53 +00:00
viktor.tarasov 9c7624c81b pkcs15init: sc_verify() has been deprecated (thanks to Martin)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3970 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-01 10:14:04 +00:00
viktor.tarasov 0ce0b37487 pkcs15init miocos: remove obsolete code
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3969 c6295689-39f2-0310-b995-f0e70906c6a9
2010-02-01 09:04:10 +00:00
viktor.tarasov 167aed7c1f pkcs15init: migrate setcos to the New API
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3968 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-31 20:29:58 +00:00
viktor.tarasov 7f52a0267f pkcs15init cardos: fix update keys
When creating application DF ('PKCS15-AppDF'), User PIN is not yet created, and AC type 'SC_AC_SYMBOLIC' cannot be resolved.
So, in the card profile, the macro '$PIN' cannot be used to define the ACLs of the application DF.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3967 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-31 20:26:45 +00:00
aj 72d5ebb79c make erase incompatible with all other actions.
thus we don't need to worry about if the pin/so-pin was passed
for the old structures (before erase) or the new ones (if used
with create).


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3966 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-30 19:25:22 +00:00
viktor.tarasov b83ed7ed71 sertcos: both PINs are globals
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3965 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-29 17:41:05 +00:00
viktor.tarasov 19e9aaf635 pkcs15init: fix putting xPINs in cache
;when putting SOPIN into the global cache, use the path from the object info;
;sc_pkcs15init_create_pin() can be called to create PUK object;




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3964 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-29 17:40:03 +00:00
viktor.tarasov 742b0ea341 pkcs15init: one more fix
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3963 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-29 17:12:53 +00:00
viktor.tarasov 2bcd535284 pkcs15init: fix
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3962 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-29 17:08:26 +00:00
viktor.tarasov 5e805ecf2d libopensc: in iso7816 process_fci() decode Life Cycle Status byte (ISO 7816-4 2005, 5.3.3, tag '8A')
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3961 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-29 10:54:51 +00:00
viktor.tarasov 90ba3c769d pkcs15init: card specific pkcs15init has to be ready for pin_reference = -1
Starting from r3946, the reference of PIN, instantiated from profile, is not overwritten by 0 in sc_pkcs15init_create_pin().
http://www.opensc-project.org/opensc/browser/trunk/src/pkcs15init/pkcs15-lib.c?rev=3946#L1064

So, card specific pkcs15init has to be ready for the pin_reference = -1. 




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3960 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-28 16:44:02 +00:00
aj 32f7a4eed3 fix text a bit.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3959 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-28 14:53:36 +00:00
martin c23f07764d Add more event type defines, add declaration of sc_ctx_get_reader_by_id().
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3958 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-28 14:29:30 +00:00
viktor.tarasov 9eebe0e1a5 pkcs11: by default do not create slot for the User PUK (thanks to Andreas)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3957 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-28 14:15:13 +00:00
viktor.tarasov 630eb213f4 miocos: migration to New API
Miocos card owners are heartly invited to test this revision.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3956 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-28 12:46:36 +00:00
viktor.tarasov 55f7f02e18 remove debug message
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3955 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-28 12:42:19 +00:00
viktor.tarasov 67b1ba0562 opensc.conf: in pkcs11 section a new option to disable slot for User PUK
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3954 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-28 12:17:05 +00:00
viktor.tarasov 031bfc7a07 pkcs11: parametrize disabling of the slot for PUK
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3953 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-28 12:14:48 +00:00
viktor.tarasov ae046cc460 pkcs11: do not create slot for PUK
Ignore PUK for the 'normal' pkcs11 also, not only for 'one-pin-pkcs11'.




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3952 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-28 08:28:25 +00:00
viktor.tarasov 660fdea68a profile: for PIN flags use rather 'define' macro
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3951 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 18:18:10 +00:00
viktor.tarasov f2d3618ff6 oberthur: finalize migration to the NEW API
no more 'init_app'.

- Oberthur unblock style is the only one (local SOPIN is used as PUK);
- user PIN and PUK should be everywhere defined as local;
- SOPIN is always global.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3950 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 18:07:14 +00:00
viktor.tarasov 38e1144c1e pkcs15init: pkcs15 PinObject for PUK
When creating PIN, if 'puk_id' is defined in 'struct sc_pkcs15init_pinargs', 
the pkcs15 PinObject for PUK will be created. 

For a moment, PinObject is not created for SO PUK.







git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3949 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 17:53:51 +00:00
viktor.tarasov 8aa2128423 pkcs15-init tool: don't ask for PUK value when creating PIN with 'unblock-disabled' in flags
- prepare pkcs15-init tool for creating a pkcs15 PinObject for PUK.




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3948 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 17:38:43 +00:00
viktor.tarasov 42ad65e8d2 sorry, fix
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3947 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 17:08:04 +00:00
viktor.tarasov 7f0abe80bb libopensc pkcs15: path is optional for PinAttributes of PinObject
- for 'global' PINs path in not encoded into the AODF;
- when selecting pin_reference, start from value defined in profile.




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3946 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 17:03:04 +00:00
s 33228c7cbc cleanup and correct style
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3945 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 16:04:19 +00:00
s 723bcc41ff fix: use of uninitialised value - return parameter (phObject) from C_CreateObject and C_GenerateKeyPair
(In function 'pkcs15_add_object': warning: unused parameter 'pHandle')

Example (C_CreateObject):
Breakpoint 3, C_CreateObject (hSession=134587040, pTemplate=0x8049160, ulCount=5, phObject=0xbff55560)
    at pkcs11-object.c:57
57              rv = sc_pkcs11_lock();
(gdb) x/x phObject
0xbff55560:     0xffffffff
(gdb) finish
0xb7f5c6c0 17:15:09.969 [opensc-pkcs11] framework-pkcs15.c:657:pkcs15_add_object: Setting object handle of 0x0 to 0x805ab80
Run till exit from #0  C_CreateObject (hSession=134587040, pTemplate=0x8049160, ulCount=5,
    phObject=0xbff55560) at pkcs11-object.c:57
0x080487a4 in main ()
Value returned is $1 = 0
(gdb) x/x 0xbff55560
0xbff55560:     0xffffffff
(gdb) c
Continuing.

Breakpoint 4, C_DestroyObject (hSession=134587040, hObject=4294967295) at pkcs11-object.c:106
106             rv = sc_pkcs11_lock();
(gdb) p/x hObject
$2 = 0xffffffff
(gdb) finish
Run till exit from #0  C_DestroyObject (hSession=134587040, hObject=4294967295) at pkcs11-object.c:106
0xb7f5c6c0 17:15:56.581 [opensc-pkcs11] pkcs11-object.c:110:C_DestroyObject: C_DestroyObject(hSession=0x805a2a0, hObject=0xffffffff)
0x080487cb in main ()
Value returned is $3 = 130



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3944 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 14:50:35 +00:00
s 66f9ccaa94 fix SIGSEGV:
$ pkcs11-tool --slot 5 --login --pin "12345678" --label 1 --type data --private --write-object tmp.txt
Generated Data Object:
Data object 0
...
$ pkcs11-tool --slot 5 -O --login --pin "12345678"
Data object 135436368
  label:          '1'
  application:    '1'
  app_id:         -1
  flags:           modifiable private
...
(gdb) run
Starting program: /usr/local/bin/pkcs11-tool --slot 5 --login --pin "12345678" --label 1 --type data --delete-object

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210333504 (LWP 7193)]
0xb7cc8181 in slot_token_removed (id=5) at slot.c:319
319                     if (object->ops->release)
(gdb) bt
#0  0xb7cc8181 in slot_token_removed (id=5) at slot.c:319
#1  0xb7cc82dd in card_removed (reader=0x811bdf0) at slot.c:132
#2  0xb7cc43e7 in C_Finalize (pReserved=0x0) at pkcs11-global.c:298
#3  0x08050fc0 in main (argc=11, argv=0xbf98d6f4) at pkcs11-tool.c:677


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3943 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-27 12:22:50 +00:00
viktor.tarasov 5cd5728c0e libopensc: search pkcs15 objects: accept NULL value for the output argument
So that, the dummy object for the 'search pkcs15 object' calls is not neccessary. 



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3942 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-26 12:59:08 +00:00
s 2ec8932c93 fix:
reader-openct.c: In function 'openct_reader_connect':
reader-openct.c:204: error: 'reder' undeclared (first use in this function)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3941 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-26 10:40:47 +00:00
viktor.tarasov bc140126e9 pkcs15init: in select_object_path() look for the template also outside the 'key-domain'.
To use New API with the cards that do not have 'key-domain' in their profile,
when setting object data path,
the object template has to be also looked for outside the 'key-domain'.

;migrate Oberthur to the New API;
;use macros SC_CALLED, SC_TEST_.., SC_RETURN in pkcs15-lib.c




git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3940 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-25 16:42:22 +00:00
viktor.tarasov 986309db79 libopensc: new operations for access control
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3939 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-25 16:10:54 +00:00
viktor.tarasov 4662812e93 pkcs15-init tool: when importing bunch of certificates, break after the first error
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3938 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-25 15:53:29 +00:00
viktor.tarasov 97d5b3e6e7 sorry, commit by error; reverting back to r3935
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3937 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-25 15:30:33 +00:00
viktor.tarasov 6e9c7e5619 pkcs15-init tool: when importing bunch of certificate, break after the first errorsrc/tools/pkcs15-init.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3936 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-25 15:11:35 +00:00
martin 0244baa494 pkcs11:
- slots, sessions and objects are kept as lists.
  - change the way slots, cards and readers are managed.
  - re-implement C_WaitForSlotEvent(/C_Finalize) as written in PCKS#11 v2.20, canceling pending blocking calls.
  - implement a "virtual hotplug slot" with a floating slot id to keep NSS working with C_WaitForSlotEvent with a new reader.
    NSS does not call C_GetSlotList(NULL) to re-fetch the list of available slots if C_WaitForSlotEvent returns an event in an already known slot ID.
    By changing the ID of a slot whenever a reader attached  NSS/Firefox can be tricked into recognizing new readers when waiting for events with C_WaitForSlotEvent.
  - change (possibly break something) sc_to_cryptoki_error() to not have side-effects
  - Implement CKU_CONTEXT_SPECIFIC in C_Login to implement CKA_ALWAYS_AUTHENTICATE (keys with user consent) 
 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3935 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 20:45:02 +00:00
martin 0595eb7d1e tests: remove slots and sc_disconnect_card API as in r3931
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3934 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 15:40:02 +00:00
martin 5a0cc50123 tools: remove slots; implement change in sc_disconnect_card(); convert util_connect_card()/--wait to support the changes in r3931
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3933 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 15:29:47 +00:00
martin e191142d04 pkcs15init: remove slots, according to r3931
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3932 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 15:26:14 +00:00
martin d006b1845e libopensc:
- Remove slot abstraction from internal API and all reader drivers. CT-API (from where it all comes from) readers with multiple slots (if still found) can be presented as separate readers, OpenCT should remove the slot abstraction, PC/SC never knew about it. None of the tools knew how to use slots.
 - Add sc_cancel (translates to SCardCancel)
 - Re-implement sc_wait_for_event; support a blocking call.
 - Replace the "int reader" API with "* sc_reader_t" style; add "Get reader by name" functionality.
 - Remove "action" parameter from sc_disconnect_card() (was not used)


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3931 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 15:25:08 +00:00
martin 0c7d6587be Use a constant buffer instead of malloc.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3930 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-24 15:14:55 +00:00