Commit Graph

3638 Commits

Author SHA1 Message Date
martin 612d66655d Introduce SC_ERROR_NOT_ENOUGH_MEMORY <=> CKR_DEVICE_MEMORY.
When trying to import a too large keyfile as a data object, TrueCrypt received a CKR_GENERAL_ERROR before this.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3926 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-23 19:12:52 +00:00
martin f48ec9528e OpenSSL 1.0.0-beta series crash when assembler implementations underflow with 0 byte length call to OPENSSL_cleanse() and overwrite memory.
Avoid it by nut trying to eraze zero memory.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3925 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-23 06:28:35 +00:00
martin 561507769a tools: cardos-tool uses OpenSSL, link against it.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3924 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-22 12:11:41 +00:00
s f2bc83b138 fix:
CK_MECHANISM rsa_mech = { CKM_RSA_PKCS_KEY_PAIR_GEN, NULL, 0 };
C_GenerateKeyPair(..., &rsa_mech, ..., ..., ..., ..., ..., ...); -> ... -> sc_pkcs15init_store_public_key -> sc_pkcs15init_store_data -> select_object_path -> sc_pkcs15_get_objects: return 0 -> CKR_OK
($ pkcs15-tool --list-public-keys:
Public RSA Key [Public Key]
        ...
        Path        : 3f0050000200
)

CK_MECHANISM gost_mech = { CKM_GOSTR3410_KEY_PAIR_GEN, NULL, 0 };
C_GenerateKeyPair(..., &gost_mech, ..., ..., ..., ..., ..., ...); -> ... -> sc_pkcs15init_store_public_key -> sc_pkcs15init_store_data -> select_object_path -> sc_pkcs15_get_objects: return 0 -> CKR_OK
($ pkcs15-tool --list-public-keys:
Public RSA Key [Public Key]
        ...
        Path        : 3f0050000200

Public GOSTR3410 Key [Public Key]
        ...
        Path        : 3f0050000200
)



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3923 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-22 12:01:17 +00:00
martin 7d935df1bc Fix #193: cryptoflex driver did not set minimum PIN length.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3922 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-21 19:58:49 +00:00
s a6dd95cd03 update on NEWS
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3921 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-21 10:58:10 +00:00
viktor.tarasov 39a70345b9 pkcs15init profile: 'private key' as BSO is differenciated from the one as EF
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3920 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-21 10:07:40 +00:00
viktor.tarasov 6fc954cbc6 pkcs15init: new profile type BSO
at the profile level the difference between EF and BSO is:
- BSO path is always the path of the host DF and do not indexated when template is instanciated;
- EF path is always ending with file-id that is always indexated  when template is instanciated.

New non-static 'sc_profile_get_file_instance' procedure to instanciate non-template entries.
In profile.c get_uint() accepts hexadecimals.
In CardOS profile (I venture to) increase the xDF sizes 
	and change ACL to permit the key re-importing.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3919 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-21 09:41:40 +00:00
martin d5200b3bbe Add GemSafeXpresso 32K ATR.
The card is available from http://www.smartcardfocus.com/shop/ilp/id~246/p/index.shtml



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3918 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-19 13:11:21 +00:00
viktor.tarasov 54ee99d486 pkcs15init: use pinpad
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3917 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-17 21:08:13 +00:00
viktor.tarasov f205d48258 pkcs15init: dissociate object file-id and object ID;
;use macros SC_CALLED, SC_RETURN and SC_TEST_RET;
;change debug level in debug macros;

For a new pkcs15 object of a given type the file index is chosen as a first value in the range from 'file-id' to 'max-id', 
excluding the values that are already assigned to the file indexes of the existing pkcs15 objects of the same type.

'file-id' is defined in the template ('key-domain') of the card profile ;
'max-id' is 'file-id' + hard coded value 0xFE .



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3916 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-16 21:52:47 +00:00
viktor.tarasov 45b95583d0 profile sanity check: in template check for minimal difference between file-ids
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3915 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-16 20:55:45 +00:00
viktor.tarasov 1a7793c77c pkcs15init: possible error of 'find_object_by_id' should not be ignored
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3914 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 15:29:16 +00:00
viktor.tarasov bb5b8d0493 oberthur: increase sizes of xDF files; source tabified
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3913 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 14:08:54 +00:00
martin 29d93a07b1 Add comments about unused errors and add an error for locked readers.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3912 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 09:45:11 +00:00
martin 875fe4a50f pkcs11-tool: test hotplug partial commit fix + make a slot ID mandatory and parse it as an unsigned long, not int.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3911 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 09:36:00 +00:00
martin c5effc32c3 pkcs11-tool: test hotplugging and events (C_GetSlotList/C_WaitForSlotEvent) before others tests and only if --hotplug is given
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3910 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 09:33:27 +00:00
martin cc5c03197d pkcs11-tool: Check for CKA_ALWAYS_AUTHENTICATE and CKU_CONTEXT_SPECIFIC login for --test operations.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3909 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 09:27:17 +00:00
martin e595042474 pkcs11-tool: Call C_Finalize when a fatal error happens. (Otherwise OSX pcsc locks up)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3908 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-15 09:22:03 +00:00
viktor.tarasov c6a0e54f9a oberthur: accept token 'OCS ID-One Cosmo Card'; ignore warning status 'end of file reached ...'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3907 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-13 16:39:37 +00:00
aj 4942760d06 Xiaoshuo Wu:
removes the assert line and some unused code, solves a problem with ePass3000.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3906 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-13 12:27:05 +00:00
martin d43ea3f065 Remove strange characters.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3905 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-10 21:58:48 +00:00
viktor.tarasov 0518ed57c5 no more 'reuse pkcs15 object'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3904 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-10 20:33:32 +00:00
martin 7ce6c1d05e PC/SC: Add SCardCancel to please mingw
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3903 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-10 18:44:02 +00:00
viktor.tarasov ece2a6a340 regression tests: pkcs11-tool API has been changed
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3902 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-08 15:51:42 +00:00
viktor.tarasov e2dae6b97b Unlock User PIN with PKCS#11:
One of the three unblock methods can be activated from the 'opensc-pkcs11' section of opensc.conf:
- C_SetPin() in the unlogged sesssion;
- C_SetPin() in the CKU_SPECIFIC_CONTEXT session;
- C_InitPin() in CKU_SO session (inspired by Pierre Ossman).
-- This last one works, for a while, only for the pkcs15 cards without SOPIN auth object.
   For the pkcs15 cards with SOPIN, this method will be useful for the cards 
   that do not have then modes '00' and '01' of ISO command 'RESET RETRY COUNTER'.

Test commands:
# pkcs11-tool --module ./opensc-pkcs11.so --slot 0 --unlock-pin --puk "123456" --new-pin "9999"
# pkcs11-tool --module ./opensc-pkcs11.so --slot 0 --unlock-pin -l --login-type context-specific --puk "123456" --new-pin "9999"
# pkcs11-tool --module ./opensc-pkcs11.so --slot 0 --init-pin -l --new-pin "9999"



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3901 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-08 15:41:07 +00:00
viktor.tarasov 39ca6b156f pkcs15-init tool: delete both key parts when deleting splitted key
Splitted key is stored as the two private keys with the same ID.
(It's not conform to PKCS#15, but tolerated by OpenSC.)
Previously used 'sc_pkcs15_find_prkey_by_id()' is not appropriated to the case of splitted key.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3900 c6295689-39f2-0310-b995-f0e70906c6a9
2010-01-03 18:26:46 +00:00
aj f0484968a9 merge changes 0.11.11 -> 0.11.12
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3899 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-18 13:33:03 +00:00
s 7cf8760f9f Fix: any of these calls
C_CreateObject(hSession, NULL_PTR, 1, NULL_PTR);
C_GetAttributeValue(hSession, hObject, NULL_PTR, 1);
C_SetAttributeValue(hSession, hObject, NULL_PTR, 1);
C_FindObjectsInit(hSession, NULL_PTR, 1);
C_FindObjects(hSession, NULL_PTR, 0, NULL_PTR);
C_FindObjects(hSession, NULL_PTR, 1, NULL_PTR);
C_FindObjects(hSession, NULL_PTR, 1, pulObjectCount);
C_DigestInit(hSession, NULL_PTR);
C_SignInit(hSession, NULL_PTR, hKey);
C_SignRecoverInit(hSession, NULL_PTR, hKey);
C_DecryptInit(hSession, NULL_PTR, hKey);
C_VerifyInit(hSession, NULL_PTR, hKey);
C_GenerateKeyPair(hSession, NULL_PTR, pubKeyTmpl, arraysize(pubKeyTmpl),
prvKeyTmpl, arraysize(prvKeyTmpl), &hPubKey, &hPrvKey);
C_GenerateKeyPair(hSession, pMechanism, pubKeyTmpl,
arraysize(pubKeyTmpl), NULL_PTR, 1, &hPubKey, &hPrvKey);
C_GenerateKeyPair(hSession, pMechanism, NULL_PTR, 1, prvKeyTmpl,
arraysize(prvKeyTmpl), &hPubKey, &hPrvKey);
=>
Segmentation fault

Remark: Allow calls:
C_FindObjectsInit(hSession, NULL_PTR, 0)
C_GenerateKeyPair(hSession, pMechanism, NULL_PTR, 0, NULL_PTR, 0, phPublicKey, phPrivateKey)
C_UnwrapKey(hSession, pMechanism, hUnwrappingKey, pWrappedKey, ulWrappedKeyLen, NULL_PTR, 0, phKey)



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3891 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-10 14:50:32 +00:00
s 1ec5a6b25d fix: return CKR_ARGUMENTS_BAD from C_Login, C_InitPIN, C_SetPIN, if pPin == NULL_PTR and PinLen > 0
PKCS#11:
"To log into a token with a protected authentication path, the pPin parameter to C_Login should be NULL_PTR."
"To initialize the normal user?s PIN on a token with such a protected authentication path, the pPin parameter to C_InitPIN should be NULL_PTR."
"To modify the current user?s PIN on a token with such a protected authentication path, the pOldPin and pNewPin parameters to C_SetPIN should be NULL_PTR."


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3890 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-10 12:34:04 +00:00
s 9dff2deae1 fix: return CKR_USER_NOT_LOGGED_IN (now CKR_GENERAL_ERROR) from C_GenerateKeyPair for the case where there was no call C_Login
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3889 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-09 13:59:03 +00:00
s 781c3c0fff add to changeset 3887
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3888 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-08 18:34:55 +00:00
s 425ec51f78 fix:
CK_MECHANISM gostMech = { CKM_GOSTR3410_KEY_PAIR_GEN, NULL, 0 };
...
C_GenerateKeyPair(hSession, &gostMech, NULL_PTR, 0, NULL_PTR, 0, &hPubKey, &hPrvKey);
-> CKR_OK and Generate RSA Key Pair


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3887 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-08 18:28:22 +00:00
s 22a950cd0d Fix: return CKR_SESSION_READ_ONLY from C_InitPIN, C_SetPIN,
C_CreateObject, C_CopyObject, C_DestroyObject, C_SetAttributeValue,
C_GenerateKey, C_GenerateKeyPair, C_UnwrapKey, C_DeriveKey if session is
read-only.

PKCS#11:
"C_InitPIN can only be called in the 'R/W SO Functions' state."

"C_SetPIN can only be called in the 'R/W Public Session' state, 'R/W SO
Functions' state, or 'R/W User Functions' state. An attempt to call it
from a session in any other state fails with error CKR_SESSION_READ_ONLY."

"Only session objects can be created/destroyed/modified
(C_CreateObject/C_DestroyObject/C_SetAttributeValue) during a read-only
session."


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3886 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-08 14:29:49 +00:00
s 5881b46ac1 PKCS#11: Spec does not allow CKR_OBJECT_HANDLE_INVALID from C_EncryptInit, C_DecryptInit, C_DigestKey, C_SignInit, C_SignRecoverInit, C_VerifyInit, C_VerifyRecoverInit, C_WrapKey, C_DeriveKey, C_UnwrapKey
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3885 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-07 12:50:59 +00:00
viktor.tarasov 5bf000da18 pkcs15-tool: unblock PIN with pinpad
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3884 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 13:11:56 +00:00
viktor.tarasov 193ca76980 pkcs15-tool: change PIN with pinpad
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3883 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 12:51:12 +00:00
viktor.tarasov 44e94c8c94 opensc-explorer: remove debug messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3882 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 11:59:48 +00:00
aj 4730e98da1 Thomas Uhle: Just this morning I realised that there is
a minor mistake in my patch for opensc_info(). For the Sun Studio 12.1
compiler (__SUNPRO_C == 0x5100) and later versions also, it must be
(__SUNPRO_C >> 4) & 0xFF to split the micro and mask the major version
number.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3881 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 11:13:17 +00:00
viktor.tarasov 6ff96b8c66 pinpad support of PIN changing and unlocking
Oberthur and opensc-explorer


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3880 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 11:11:04 +00:00
viktor.tarasov 490e02b349 after Martin's suggestion: for pcsc do not use '0' protocol when detecting readers
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3879 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 10:47:51 +00:00
aj df4bdaf6f7 Update westcos emulation by François Leblanc.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3878 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 07:18:19 +00:00
aj 93a2b39028 Updated westcos driver by François Leblanc
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3877 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 07:10:24 +00:00
aj 073c9da342 Thomas Uhle: modify Makefile so configure finds the include files
of PC/SC lite.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3876 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 07:05:15 +00:00
aj b2c5ab3209 Thomas Uhle: Add information about sun compiler to opensc-tool.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3875 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-03 07:03:53 +00:00
aj 06aaa718cc Describe now option for --help.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3874 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-02 11:10:16 +00:00
aj 724c3485a6 remove dead code for now - easy to recreate later.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3873 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-02 11:07:45 +00:00
aj 29407cf2d8 fixed and tested by Viktor TARASOV. Thanks!
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3872 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-02 09:52:12 +00:00
aj 5b21dd6a05 basic command to change startkey,
so far untested.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3871 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-01 21:10:06 +00:00
viktor.tarasov b9935bf410 cardos-tool: invalid parsing of the 'common system keys' info
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3870 c6295689-39f2-0310-b995-f0e70906c6a9
2009-12-01 11:47:19 +00:00