Commit Graph

3777 Commits

Author SHA1 Message Date
martin 791cbd7f53 Fix r4977: C89 style to support MS Visual Studio
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4979 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-20 08:57:07 +00:00
ep ab40e70e04 Wrong structure size calculation in pkcs15-itacns.c; thanks to Matteo Nastasi for the heads-up.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4978 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-19 11:18:43 +00:00
ep c14831eebd Modified patch for Actalis smart cards. Closes #235.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4977 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-19 11:18:40 +00:00
andre 02c4f1ec77 pkcs11-tool.c: Avoid compiler warning 'may be used uninitialized in this function'.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4968 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-18 00:44:12 +00:00
andre b7fad04e10 pkcs11-tool.c: Simplifies interface to show_key() and avoids more compiler warnings.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4967 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-17 23:02:03 +00:00
andre 30bf0f17a8 pkcs11-object.c: Add missing initializers.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4966 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-17 19:09:24 +00:00
andre b58592d297 mechanism.c: Removal of unused variables.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4965 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-17 18:47:41 +00:00
andre 1a5c0aea24 framework-pkcs15.c: Avoid some warnings if the macro USE_PKCS15_INIT is undefined. That is always the case if build without OpenSSL.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4964 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-17 17:54:07 +00:00
dengert bf28607dd3 More ENABLE_OPENSSL changes so sc_pkcs11_register_sign_and_hash_mechanism
will not fail. 



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4963 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-17 17:12:22 +00:00
andre 82824402f4 framework-pkcs15init.c: Add missing initializers.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4962 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-17 16:30:12 +00:00
andre 50567141f0 Rename of SC_NO_ERROR to SC_SUCCESS.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4954 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-16 05:04:37 +00:00
andre 6b10272caa framework-pkcs15.c: More specific log messages. Enables better tracking of errors.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4953 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-16 03:56:49 +00:00
andre 5c6afb6bed Add missing initializers. Left over from r4508.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4952 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-16 01:47:03 +00:00
andre f9acbf9073 pkcs15.h: Fixing type of parameter to avoid compiler warning: 'comparison between signed and unsigned'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4951 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-15 13:47:58 +00:00
andre 8defdf9aed pkcs15-algo.c: Just making the compiler happy.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4949 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-14 03:11:31 +00:00
andre 3cfe542813 Textual output of SC_ERROR_* return codes in debug messages.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4948 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-14 03:08:17 +00:00
andre 1b030f5d73 pkcs11-pubkey.c: Minor corrections related to r4874 and r4902.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4946 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-14 01:19:46 +00:00
andre 2eca7061b4 iso7816.c: Fixes #301.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4945 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-14 01:09:44 +00:00
andre f1293c372d pkcs11-display: Fixing some type mismatches that the compiler complains about.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4943 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-13 06:28:37 +00:00
vtarasov c8c291ea07 win32: build of MSI on checkouted trunk ...
is possible after 'bootstrap' and 'configure'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4942 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-12 13:17:17 +00:00
vtarasov 795dbf0342 win32: change path to the OpenSC registry keys
Now it begins with "SOFTWARE\\OpenSC Project\\..." .


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4940 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-12 10:30:07 +00:00
martin 5cc8814e30 EstonianEid: Add SC_ALGORITHM_RSA_RAW to not make sc_pkcs15_compute_signature remove the DigestInfo header.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4939 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-11 22:07:07 +00:00
andre b1287e3ff2 log.c: Fixes format string to match actual type.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4938 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-09 19:52:56 +00:00
andre 35fd3c10c1 pkcs15.c: Use size_t as type of vector-index.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4937 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-09 19:49:42 +00:00
vtarasov e259021d36 win32: change path to OpenSC windows registers
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4935 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-09 09:23:21 +00:00
vtarasov aed53df545 win32: test 'BUILD_MSI' condition and build MSI
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4934 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-09 09:21:57 +00:00
vtarasov 2aa034d467 libopensc: avoid warning 'not all control paths return a value'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4933 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-09 09:17:08 +00:00
s d66b3c71d2 fix: implicit depending on the RSA algo_info for GOSTR3410 algo
add sc_card_find_gostr3410_alg function

Thanks to Douglas E. Engert
http://www.opensc-project.org/pipermail/opensc-devel/2010-December/015408.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4931 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-09 08:23:14 +00:00
s 0dba036837 add to r4904: fix calculating of signature size for CKK_GOSTR3410
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4930 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-09 07:23:10 +00:00
martin 5f1b3a2288 Fix [4911]
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4929 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-08 08:56:12 +00:00
andre 559e4f3dc4 framework-pkcs15 [pkcs15_logout]: Better propagation of errors
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4928 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-08 03:31:07 +00:00
andre 5b69b39c33 sc_pkcs15_pincache_revalidate: Avoid compiler warning 'discards qualifiers from pointer target type'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4927 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 18:59:49 +00:00
andre de6021d6f2 compat_strlcat: Avoid compiler warning 'no newline at end of file'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4926 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 18:51:23 +00:00
martin f5e21e0ba0 Complete change, SIMCLIST_DUMPRESTORE is by default off.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4925 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 18:35:43 +00:00
andre ea4ddf8f17 pkcs15-pin: If the usage counter of a cached PIN is expired, then free that cached PIN instead of freeing the objects content that is protected by the PIN.
If re-validation of a cached PIN fails, then free that cached PIN to ensure that it isn't used again for re-validation.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4924 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 18:33:17 +00:00
andre 3b270b8d27 pkcs15.c: use int instead of bool as type of configuration option pin_cache_counter
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4923 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 18:15:12 +00:00
andre 548630971e pkcs11-tool: replaced OPENSSL_NO_EDSA with OPENSSL_NO_ECDSA
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4922 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 16:28:26 +00:00
vtarasov 04c5cb955b win32: control from Make.rules.mak the including of 'cardmod'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4920 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 15:47:03 +00:00
vtarasov e353c1bf2f win32: 'netkey' and 'westcos' tools are OpenSSL dependents
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4919 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 15:20:19 +00:00
martin b5f329ba7c tools: EC(DSA) requires OpenSSL >= 0.9.8.
This fixes building for OS X 10.5.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4918 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 14:41:15 +00:00
martin 4c2cbeec13 card-piv: remove unused variables.
card-piv.c: In function ‘piv_get_data’:
card-piv.c:879: warning: unused variable ‘filename’
card-piv.c:878: warning: unused variable ‘dataenvname’
card-piv.c:877: warning: unused variable ‘keyenvname’

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4917 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 14:18:42 +00:00
martin 98d2d6db39 PIV: amend [4908], Apple has /usr/include/malloc/malloc.h
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4916 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 14:18:35 +00:00
martin eb5871645b entersafe: don't list supported exponents in the dirver.
Native keys are generated with exponent 65537, imported keys can now have any (?) exponent.
Tested with openssl genrsa -3/-f4 keys.

Improves r4910 and closes #297

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4915 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 12:52:27 +00:00
martin a92f3a80d5 EstonianEid: limit authentication key usage bits.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4914 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 12:52:20 +00:00
martin 9fe86d16fe libopensc: protect for possible buffer overflows from rogue cards.
Reported by Rafael Dominguez Vega

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4913 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 12:52:14 +00:00
martin 37944007aa libopensc: move MIN/MAX macros from muscle.c to internal.h
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4912 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 12:52:07 +00:00
martin cd996245b9 EstonianEid: correctly free the used OpenSSL structures.
Thanks to Raul Metsma for the patch.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4911 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 12:51:59 +00:00
ludovic.rousseau 5a736c0ac6 entersafe_init(): add support of RSA exponent 35
Closes: Ticket #297


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4910 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 09:37:23 +00:00
vtarasov 0bf12aa1f4 card-piv: avoid warning 'differs in levels of indirection from' ...
when compiling with VS


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4908 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-06 08:30:00 +00:00
dengert 3cfcb5cdc6 Minor corrections to r4906
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4907 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-03 15:44:29 +00:00
dengert b7f4537031 Test for OPENSSL_NO_EC as some systems build OPENSSL without EC.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4906 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-03 15:15:29 +00:00
martin 471e43c7cb simclist: build with mingw32, Visual Studio and gcc on Linux. By default dumprestore is OFF.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4905 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-02 08:59:26 +00:00
dengert c2fe4609a9 Modifications to support EC and ECDSA for
emulated cards. True PKCS#15 cards with EC 
will need additional changes. 

Main changes are in framework-pkcs15.c, mechanism.c,
padding.c, pkcs15-algo.c and pkcs15-sec.c 
where switch statements for key type, and testing
of flags was modified to make it easier to add 
additional key types in the future. 

The code was tested using RSA and ECDSA using a PIV card 
from pkcs11-tool, OpenSSL and Thunderbird with 
modifications to NSS-3.12.7 to get ECDSA to sign e-mail. 

Only named curves are supported for ECDSA, ECDH is still 
needed. pkcs11-tool has only minimal changes need to work 
with the -O option to list EC keys. 

One additional line was added to pkcs15-sec.c which 
should get GOSTR sign to work. 

libp11 and engine do not yet have EC support. 

 --This line, and those below, will be ignored--

M    src/tools/piv-tool.c
M    src/tools/pkcs11-tool.c
M    src/pkcs11/framework-pkcs15.c
M    src/pkcs11/mechanism.c
M    src/pkcs11/pkcs11-object.c
M    src/libopensc/pkcs15-prkey.c
M    src/libopensc/card-piv.c
M    src/libopensc/padding.c
M    src/libopensc/cardctl.h
M    src/libopensc/pkcs15-algo.c
M    src/libopensc/libopensc.exports
M    src/libopensc/pkcs15-piv.c
M    src/libopensc/pkcs15-sec.c


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4904 c6295689-39f2-0310-b995-f0e70906c6a9
2010-12-01 20:08:42 +00:00
dengert e2bd16ecd0 Additional EC routines _sc_card_add_ec_alg and sc_card_find_ec_alg
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4903 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 19:30:03 +00:00
dengert c34caeb662 Support for ECC keys (part 1) header files and
support routines. Add definitions for EC keys,
parameters and extensions to structures. 
Add the sc_card_find_ec_alg, sc_pkcs15_decode_pubkey_ec,
sc_pkcs15_encode_pubkey_ec, sc_pkcs15emu_add_ec_prkey,
sc_pkcs15emu_add_ec_pubkey routines. 
Only EC named curves are currently supported. 



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4902 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 19:13:48 +00:00
dengert 137a7282ad Allow emulation routine to setup an emulated object
to be used instead of trying to read a file.
This will be used  with the ECC code. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4901 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 15:57:01 +00:00
dengert e642436fc6 SPY does not process CKA_ALWAYS_AUTHENTICATE
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4900 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 15:32:58 +00:00
martin c16179f75a EstonianEid: Don't leak 1024bit key to 2048b card properties
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4899 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 12:33:24 +00:00
martin 185d46f3c9 simclist: Visual studio does not have unistd.h
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4898 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 12:33:04 +00:00
martin 424ef32dfc libopensc: fix building new simclist with mingw
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4897 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 11:22:38 +00:00
martin 7ab591a684 libopensc: make sc_reset() take an additional parameter "do_cold_reset" which will unpower the card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4896 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-30 11:22:31 +00:00
martin 5d9c02b197 ISO 7816: if decrypting with 2048 keys, non-extended APDU cards require command chaining (Lc would be 257, which is 2 bytes over 255 limit)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4895 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 14:22:15 +00:00
martin b33a44fdf0 pkcs11: clean up mechanism registration
* check for out of memory conditions
 * register SHA256 as well
 * key generation depends on onboard key generation capabilities, not OpenSSL

Further adjustments are needed.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4894 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 14:22:09 +00:00
martin 113dfda494 EstEID: add support for v 3.0 cards with 2048b keys
* Detect different cards based on ATR-s and on card objects
 * Set the card name from the ATR table
 * Conditionally add support for 2048b keys
 * Add workarounds for broken MULTOS and JavaCard cards.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4893 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 14:22:01 +00:00
martin 5c32c15b60 Revert a protocol forcing change from [4873] which was a mistake.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4892 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 13:56:27 +00:00
martin c1c3aa1d55 PC/SC: make (dis)connect actions configurable, SCardDisconnect, SCardEndTransaction and SCardReconnect
actions can now be configured via opensc.conf in better detail.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4891 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 13:56:19 +00:00
martin 77c8cfc37d pcsc: a change in ATR will not always mean a changed card, rely on PC/SC layer for card change information.
One of the few cards that has two different ATR-s is the EstonianEid card. The changing ATR (especially if
it has different protocol information and historical bytes) can cause confusion in many places, like
Microsoft BaseCSP or certain versions of pcsc-lite.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4890 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 13:35:06 +00:00
martin acb54b965f typo: remove double semicolon which prevents compilation with Visual Studio.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4888 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 08:51:25 +00:00
andre 636b0c1d27 framework-pkcs15: Do not populate the unwrap capability, because the corresponding function C_UnwrapKey isn't implemented.
http://www.opensc-project.org/opensc/browser/trunk/src/pkcs11/pkcs11-object.c?rev=4885#L969

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4886 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 00:58:12 +00:00
andre fd11c909bd pkcs11-tool: Completing the output of "Mechanism Information Flags".
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4885 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-28 23:46:12 +00:00
andre 146041fcee pkcs11-tool: Correcting the behaviour in the case where C_SignUpdate fails. Quotation from PKCS#11:
"A call to C_SignUpdate which results in an error terminates the current signature operation."

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4884 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-28 22:16:50 +00:00
andre b63a601666 pkcs11-tool: Use attributes MODULUS and PUBLIC_EXPONENT instead of VALUE to retrieve RSA-Public-Key. The first two attributes are valid whereas the latter is not.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4883 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-28 18:09:30 +00:00
ludovic.rousseau cf92133cef Update from SimCList version 1.5
http://mij.oltrelinux.com/devel/simclist/


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4882 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-26 12:57:53 +00:00
andre 0eb404b2e6 pkcs11-display.c: more detailed less verbose output of CK_ATTRIBUTE lists
http://www.opensc-project.org/pipermail/opensc-devel/2010-November/015321.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4881 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-25 00:20:21 +00:00
dengert 09131a4e9f Fix support for CKU_ALWAYS_AUTHENTICATE and CKU_CONTEXT_SPECIFIC
spy segfaulted if CKU_CONTEXT_SPECIFIC was used,
pkcs11-session was reseting the userType before calling 
framework.  Framework will now see CKU_CONTEXT_SPECIFIC
and use slot->login_user to determine which PIN was used
to create the original session, and will send the PIN
to the card. It does not treats CKU_CONTEXT_SPECIFIC 
as a full login, only a reassertion of the PIN. 



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4880 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-24 20:28:30 +00:00
ludovic.rousseau c9ad140394 sc_pkcs15emu_postponed_load is no more defined
Compilation fails on Mac OS X (but not on GNU/Linux):
Undefined symbols:
  "_sc_pkcs15emu_postponed_load", referenced from:
   -exported_symbol[s_list] command line option
ld: symbol(s) not found


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4879 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-20 09:30:26 +00:00
andre 821f4fef6d card.c: Fixes the overriding of max_x_size limitations. In the result, the limitations of cards are adjusted to fit the limitations imposed by the configured reader.
ctx.c: Lookup conf_block of reader_driver by short_name

Fixes #269

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4878 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-19 18:09:04 +00:00
andre 5a183a8dc7 framework-pkcs15.c: new logic to discover objects that were hidden before PIN verification
pkcs15.c: object search continues with normal processing, even if enumeration of some files failed
pkcs15.h: obsolete prototype removed
pkcs15-syn.c: now obsolete function sc_pkcs15emu_postponed_load removed

fixes: #266

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4877 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-18 23:31:08 +00:00
andre 0ad6771346 {{{more verbose messages for debug in:__sc_pkcs15_search_objectssc_pkcs15_parse_dfsc_pkcs15_read_file}}}
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4876 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-18 18:47:42 +00:00
andre bcef13cfd2 In login() the flag CKF_LOGIN_REQUIRED is now ignored. This makes the behaviour of login() more predictable. If parameter --login is specified on the command line, then C_Login() is always called.fixes #220
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4875 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-18 14:56:26 +00:00
dengert d1aa716bec Move decoding of subjectPubkeyInfo from pkcs15-cert.c
to pkcs15-pubkey.c and call the new sc_pkcs15_pubkey_from_spki.
Add sc_pkcs15_pubkey_from_spki_filename to allow a file to 
contain the subjectPubkeyInfo, which will be used the the PIV 
driver when EC is implemented. The format of the file, is the
same as an X509 certificate subjectPublicKeyInfo and what 
OpenSSL calls an EVP_PKEY, which includes the algorithm,
any parameters and the public key. 
 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4874 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-08 17:05:40 +00:00
martin c6eb9d3d92 PC/SC: move protocol (T=0/T=1) selection to reader-pcsc.c, where it is used.
Also, check fot the required protocol before connecting to the card and use the forced prtocol instead of re-connecting.

See http://lists.drizzle.com/pipermail/muscle/2010-November/008671.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4873 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-08 12:37:22 +00:00
martin 5e909df85d Amend r4871: prevent mingw32 from including an incompatible getopt version.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4872 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-08 12:29:15 +00:00
martin ab6511cb63 Trac #264: fix mingw32 build with mingw32-runtime versions <= 3.13
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4871 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-08 11:17:09 +00:00
ludovic.rousseau 2e9c72ec5e Use 'const char *' instead of 'char *' for static strings and avoids a
lot of "discards qualifiers from pointer target type" warnings


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4870 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 18:07:04 +00:00
ludovic.rousseau 96deb9d4d4 Use 'const char *' instead of 'char *' for static strings and avoids a
lot of "discards qualifiers from pointer target type" warnings


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4869 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 18:05:21 +00:00
ludovic.rousseau c64cb12f2f pkcs15-tcos.c: In function ‘insert_pin’:
pkcs15-tcos.c:216: warning: declaration of ‘r’ shadows a previous local
pkcs15-tcos.c:194: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4868 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 17:07:13 +00:00
ludovic.rousseau 07ccc3965e pkcs15-tool.c: In function ‘verify_pin’:
pkcs15-tool.c:976: warning: declaration of ‘r’ shadows a previous local
pkcs15-tool.c:972: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4867 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 17:05:32 +00:00
ludovic.rousseau 8dd3b98b1d pkcs15-tool.c:150: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:151: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:152: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:153: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:154: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:155: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:156: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:157: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:158: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:159: warning: initialization discards qualifiers from pointer target type
pkcs15-tool.c:160: warning: initialization discards qualifiers from pointer target type


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4866 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 17:04:04 +00:00
ludovic.rousseau 3c12d20bfa piv-tool.c: In function ‘gen_key’:
piv-tool.c:292: warning: declaration of ‘newkey’ shadows a global declaration
piv-tool.c:97: warning: shadowed declaration is here
piv-tool.c: At top level:
piv-tool.c:97: warning: ‘newkey’ defined but not used


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4865 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 17:01:17 +00:00
ludovic.rousseau 9c433a9cce pkcs11-object.c: In function ‘C_DigestInit’:
pkcs11-object.c:455: warning: label ‘out’ defined but not used


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4864 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 17:00:09 +00:00
ludovic.rousseau 2a4cdd4d57 pkcs15-pteid.c: In function ‘sc_pkcs15emu_pteid_init’:
pkcs15-pteid.c:56: warning: ‘buf’ may be used uninitialized in this function


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4863 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 16:58:33 +00:00
ludovic.rousseau 512be83138 ctx.c: In function ‘sc_ctx_detect_readers’:
ctx.c:548: warning: ‘r’ may be used uninitialized in this function


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4862 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 16:57:05 +00:00
ludovic.rousseau 3ac5bb4ba1 Declare internal functions as static and fix compiler warnings
card-itacns.c:90: warning: no previous prototype for ‘itacns_match_cns_card’
card-itacns.c:125: warning: no previous prototype for ‘itacns_match_cie_card’
card-itacns.c:146: warning: no previous prototype for ‘itacns_match_card’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4861 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 16:54:57 +00:00
ludovic.rousseau f841b88e06 opensc-explorer.c:89: warning: function declaration isn’t a prototype
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4860 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 16:53:11 +00:00
ludovic.rousseau 3aea304a8e sc_do_log_va(): fix compiler warning
log.c:87: warning: format ‘%03ld’ expects type ‘long int’, but argument
8 has type ‘int’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4859 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 16:50:41 +00:00
ludovic.rousseau 98fdeaa0b6 C_LoadModule(): Fix compiler warning
libpkcs11.c:58: warning: format ‘%lx’ expects type ‘long unsigned int’,
but argument 3 has type ‘int’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4858 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-06 16:49:00 +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
dengert 641ea4eddd Fix compile warning message.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4852 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-01 15:44:17 +00:00
martin 8af1b60afd PC/SC: temporarily disable blocking C_WaitForSlotEvent until a checked version for pcsc-lite 1.5.3-1.6.4 exists.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4835 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-28 13:33:50 +00:00
martin df639efd89 EstonianEid: revert to old behavior and have the T=0 forcing.
Some cards have incorrect ATR-s and can cause troubles if pcsc-lite by default tries to set T=1 by default.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4834 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-28 13:11:13 +00:00
martin 8156095b46 FIXME: Don't issue SCardCancel unless the environment is known not to hang (part 1)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4833 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-28 09:44:22 +00:00
dengert bd93b97674 Additianl changes to r4805 which made cert->pubkey a pointer to sc_pkcs15_pubkey_t
Thanks to Andre Zepezauer for pointing out most of these. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4828 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-25 20:58:02 +00:00
s 150d26d51e fix: opensc-tool: invalid output of access control for EF (add to r4509)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4826 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-23 06:54:56 +00:00
martin 6648255cb0 EstonianEid: add a broken EstEID ATR to the Micardo driver. Don't force a protocol for EstEID cards
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4825 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-22 15:48:04 +00:00
martin df2d7d1dd1 EstEID: remove incorrect ATR matching. A reset is required as there is no way simpler way to identify a broken card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4821 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-20 15:04:31 +00:00
martin fa0e236881 Missed these from r4818
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4820 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-20 12:33:07 +00:00
martin f7000a93c1 EstEID: add workarond for a buggy card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4819 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-20 08:48:56 +00:00
martin 6a750e6cc0 tools: -v sets ctx->debug only if set more than once. -vv also makes the debug go to stderr.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4818 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-20 07:53:19 +00:00
martin 2d6e3bd262 EstonianEid: remove the iconv dependency and use the common name from the certificate as the card label.
This makes it universal, as some cards don't have the personal data file (Digi-ID)
It also makes it a bit ugly, as the common name is the name and personal ID code
concatenated like "FIRSTNAME,LASTNAME,123456789"

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4817 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-19 11:25:25 +00:00
flc 23b64f88d2 fix sc_pkcs15_card_t struct change in cardmod.c and issue in reader_pcsc.c for cardmod part too
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4809 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-15 13:37:37 +00:00
flc 3076fe265c Fix patch [4709] for cardmod until build in one static dll
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4808 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-15 08:07:34 +00:00
dengert a569bf9646 Fix test code so will work with card with real history object.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4807 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-14 19:55:57 +00:00
dengert f194c873d0 Fix 253 third fix for same problem. The first fix
r4761 added a test in the wrong place. Second fix
r4804 added the test in the correct place. This fix
removes one of the tests added by r4761


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4806 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-14 14:59:51 +00:00
dengert 0f2a44b33e sc_pkcs15_pubkey_from_cert now uses parse_x509_cert without OpenSSL.
sc_pkcs15_cert now has pointer to sc_pkcs15_pubkey, allowing it to 
be removed and used separatly.  
sc_pkcs15_pubkey now has pointer to sc_algorithm_id to faclitate
addition of other key algorithms and their parameters. 
Various code changes to free these structures and references
to the structures have been changed. 



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4805 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-12 15:26:45 +00:00
dengert 6b4cb93c84 Fix #253 - Allow caller to read a partial object
by returning all that was read. Related to #257
which fixed a different path in apdu.c


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4804 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-08 14:53:29 +00:00
martin 364ba4882d pkcs11-tool: handle non-recognized tokens gracefully.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4803 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-08 08:36:56 +00:00
martin fad0116fef pkcs11-tool: if no slot is specified on the command line, try to locate a slot with a token.
A modified patch from Andre Zepezauer.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4802 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-08 08:36:48 +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 6410da59a9 PC/SC: better detection of card changing events.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4798 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-06 07:54:08 +00:00
martin dfe8a014b9 Fix leftover from r4646
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4795 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-06 07:15:32 +00:00
martin 19da5d8f16 WindowsInstaller: Fix Mingw32 Windows build
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4793 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-06 07:10:44 +00:00
joao 36f1fbb655 Add new ATR for the Portuguese eID card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4790 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 16:10:35 +00:00
martin f5a21e417b pkcs15: don't play with TokenInfo.version. 0 means PKCS#15 v1.1. The flag is not used by OpenSC.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4789 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 16:02:57 +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
martin 14752f0c43 Remove now unused variables.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4787 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 15:12:10 +00:00
martin 192de4199c libopensc: remove unused SC_CTX_MAGIC define
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4786 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 14:58:55 +00:00
martin c51156875f libopensc: remove meaningless sc_card_valid()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4785 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 14:58:50 +00:00
martin 75a10198fc PC/SC: simplify reader state detection.
This needs to be improved further, based on revision 5278 of pcsc-lite.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4784 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 14:58:45 +00:00
martin ebdc92407e PC/SC: move reader feature detection to a separate function. Don't detect features of a reader that is in exclusive mode.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4783 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 14:58:29 +00:00
martin b060049fa4 opensc-tool: don't print reader driver (only one is enabled by default), instead print the presence of a card.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4782 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 14:58:22 +00:00
martin 283ac67229 pkcs11-spy: log matching objects in hex. Patch from Andre Zepezauer
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4781 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-05 14:42:01 +00:00
dengert a71b64f3fc Fix erros with freeing algorithm parameters and
last entry of the algorithm_table. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4780 c6295689-39f2-0310-b995-f0e70906c6a9
2010-10-04 15:58:34 +00:00
viktor.tarasov 517878d102 myeid: applied patch for MyEID card profile
provided by Tony (Aventra development), thanks.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4777 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-27 07:50:14 +00:00
viktor.tarasov 58c1c88efa libopensc: homogenise line ending in the debug messages
continuating r4759


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4774 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-25 20:35:59 +00:00
viktor.tarasov 10a99dc055 myeid: remove windows line ending
because it give the wrong LINE value in the debug messages that follows 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4773 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-25 20:25:23 +00:00
dengert e9d1f10084 PIV support for NIST 800-73-3 objects,
PIV driver client can build and run without OpenSSL,
(admin functions and piv-tool still need OpenSSL)
define PIV specific ctrl codes and structures.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4767 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-24 20:37:22 +00:00
dengert 391ec96306 Remove max_recv_size checks
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4766 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-24 18:34:44 +00:00
martin f339f9ba77 pkcs11-tool: only do hotplug testing before other activities.
Thanks to Andre Zepezauer for noticing.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4765 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-24 07:24:43 +00:00
flc 7ef766b785 Fix issue in log message in cardmod with i386-mingw-gcc v 3.4.5
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4764 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-23 11:57:51 +00:00
dengert 3bb5c9f530 allow pkcs15-itacns.c compile without OpenSSL
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4763 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-22 20:57:07 +00:00
dengert 1a5b898b07 Another max_recv_size fix
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4762 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-22 15:12:01 +00:00
dengert 10a5d1be3a Fix #257 Reading partial objects differs for T=0 vs T=1
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4761 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-22 14:55:03 +00:00
dengert 573a1de4d6 Allow c_FindObjectsInit to find unlimited objects - #258
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4760 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-22 14:41:50 +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
viktor.tarasov 239de7b6e3 libopensc: remove 'max_xx_size' from debug message
after the 'max_xx_size' stuff has been reverted


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4757 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-22 11:51:52 +00:00
viktor.tarasov 652a1801e0 opensc-explorer: to use AID of maximal allowed length in 'cd' command
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4754 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-22 11:46:33 +00:00
s 659db6f50b Fix: default count of attempt (use profile) for new version firmware
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4752 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 18:14:04 +00:00
martin 3202355fa3 pkcs11-tool: print the token before asking for a PIN code; shorten CKU_CONTEXT_SPECIFIC prompt
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4751 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:49 +00:00
martin 01931d6794 pkcs11-tool: do --test even without a slot, at least hotplug. print a proper error name for C_GetSlotInfo
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4750 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:44 +00:00
martin 528b7ae7c7 pkcs11: move around CKR_ARGUMENTS_BAD check
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4749 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:40 +00:00
martin 294a8bca3d pkcs11-tool: pkcs11-tool --verbose does not affect OpenSC debugging. Document a workaround
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4748 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:36 +00:00
martin 50952cdcba pkcs11-tool: cleanup whitespace and remove unused OpenSSL ERR_* calls.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4747 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:31 +00:00
martin 2dff969e05 pkcs11-tool: better separation between opaqe slot IDs and slot list indexes.
--slot will take the actual CK_SLOT_ID
--slot-label will use the token label to find the correct slot
--slot-index will use the N-th slot from the list returned by C_GetSlotList

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4746 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 16:11:26 +00:00
ludovic.rousseau 2085126d39 Use "const char *" instead of "char *" where needed.
Fix compiler warnings:
compat_getopt_main.c: In function ‘main’:
compat_getopt_main.c:145: warning: initialization discards qualifiers from pointer target type
compat_getopt_main.c:288: warning: assignment discards qualifiers from pointer target type
compat_getopt_main.c:336: warning: assignment discards qualifiers from pointer target type
compat_getopt_main.c:366: warning: passing argument 3 of ‘handle’ discards qualifiers from pointer target type
compat_getopt_main.c:76: note: expected ‘char *’ but argument is of type ‘const char *’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4743 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 09:48:57 +00:00
ludovic.rousseau 96a2568ee0 Remove an ugly cast and fix a compiler warning
compat_getopt_main.c: In function ‘handle’:
compat_getopt_main.c:123: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘long unsigned int’


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4742 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 09:45:09 +00:00
ludovic.rousseau 4630f1c65f VERSION is already defined ni config.h included by compat_getopt.h
Redefine our own version of VERSION


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4741 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 09:42:39 +00:00
ludovic.rousseau 9bdbaf4970 include compat_getopt.h instead of getopt.h
Thanks to Guillaume JEAN for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2010-September/014948.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4740 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 09:39:04 +00:00
ludovic.rousseau 43ee9f60ce build but do not install compat_getopt_main
This is just used for testing the compat_getopt code in libcompat


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4739 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-21 09:37:17 +00:00
martin a404370f0c pkcs15-tool: harmonize and align the output of --dump
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4738 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-20 23:10:29 +00:00
martin 09fb4468d0 pkcs15-tool: only print Auth ID if present
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4737 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-20 23:10:23 +00:00
martin 215b3fc056 pkcs15-tool: pretty-print common object flags.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4736 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-20 23:10:16 +00:00
martin 53c3c486af MacInstaller: statically link libltdl for 10.5, as 10.5 PPC comes without the necessary .dylib (i386 has it)
Thanks to Kalev Lember for the original patch.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4735 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-20 15:01:45 +00:00
ludovic.rousseau 63dafb8ee5 Remove the traces of C99: declare variables before any code.
Thanks to Guillaume JEAN for the patch
http://www.opensc-project.org/pipermail/opensc-devel/2010-September/014903.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4723 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-15 14:15:17 +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 39311cb881 libopensc: check for unset max_recv/send_size in all places.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4721 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-15 11:09:28 +00:00
martin fc5b3e5417 EstEID: buffer is 2 bytes bigger than max Le.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4720 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-14 09:27:46 +00:00
viktor.tarasov 8aa2a64261 opensc tools: to be compiled with Visual Studio
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4716 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-13 08:08:42 +00:00
viktor.tarasov 19df2c812b MyEID: to be compiled with Visual Studio
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4715 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-13 07:55:12 +00:00
martin cae16b6ef8 By default the reader driver does not have receive/send limitations.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4714 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-13 07:40:45 +00:00
martin 36705f8f10 Add missing piece from r4706.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4713 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-13 07:27:34 +00:00
martin 89d5bcf4d5 whitespace fix
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4712 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-11 13:01:06 +00:00
martin 0f7891293f libopensc: fix "ctx.c:389: warning: unused parameter ‘opts’"
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4711 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-11 13:01:00 +00:00
martin 8c1bcea28a libopensc: remove unused SC_MAX_READER_DRIVERS
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4710 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-11 13:00:54 +00:00
martin 72d961beb2 Fix #216: initial go with multiple reader subsystem removal.
* One sc_context has only a single reader driver.
 * remove dynamic reader driver loading capabilities
 * remove opensc-tool -R command
 * change the internal API, we don't need to pass around a "driver data" pointer as it can be found directly from the context.
 * check in ./configure for only a single enabled reader driver

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4709 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-11 13:00:47 +00:00
martin 0858a5c854 libopensc: remove SC_MAX_READERS which is not used.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4708 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-11 13:00:36 +00:00
martin 01c3bde101 Belpic: remove BELPIC_SET_LANG and related code, as it is not used in OpenSC
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4707 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-11 13:00:29 +00:00
martin a5ca648afd Revert r4668. Change the way limitations on max send and receive sizes are set.
See http://www.opensc-project.org/pipermail/opensc-devel/2010-September/014836.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4706 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-09 18:58:44 +00:00
s ac0a8dbb15 remove software RSA support for Rutoken S
Migration OpenSC to "new scheme" (further to r4646)
http://www.opensc-project.org/pipermail/opensc-devel/2010-September/014717.html



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4705 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-09 17:28:44 +00:00
ep ffdad69bca Avoid mixed declarations and code in ItaCNS files, per C90
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4702 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-08 21:23:49 +00:00
flc be6d4d062b Fix small log issue
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4701 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-08 07:52:00 +00:00
martin 10fe6e4441 MyEID: force PIN padding properties (already set by sc_pkcs15* but not present with opensc-explorer)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4700 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-07 12:53:26 +00:00
martin 525bf7381e MyEID: use ISO7816 pin_cmd. Fix card_state logic.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4699 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-07 12:49:16 +00:00
martin f9026bc86f EstEID: Fix #250. Force a SELECT FILE by cheating on the internal micardo path cache.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4697 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-06 09:32:13 +00:00
martin d994bb81a1 Micardo: remove redundant mcrd_decipher. Handled by ISO7816
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4696 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-06 08:54:13 +00:00
martin 3ab92454a2 card-jcop: remove dummy stubs.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4695 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 19:55:00 +00:00
martin 6c156e2318 MyEID: remove no-op ISO7816 wrappers and not implemented stubs.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4694 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 19:22:54 +00:00
viktor.tarasov 3d988eed5c MyEID: make working change/unblock PIN
tested with pkcs15-tool on Linux and Windows


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4693 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 18:21:43 +00:00
martin 93da2252c7 pkcs11: #250: refresh PIN counters and associated token flags on every call to C_GetTokenInfo
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4692 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:53:08 +00:00
martin 7a66f4e339 pkcs11-tool: recognize user PIN related token flags
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4691 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:53:02 +00:00
martin 362a907bf0 Micardo: Add SC_PIN_CMD_GET_INFO support, currently only for EstEID cards.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4690 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:52:56 +00:00
martin 54c67f105b EstEID: style: use sizeof()
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4689 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:52:50 +00:00
martin f085a9b373 libopensc: add SC_PIN_CMD_GET_INFO and related fields to sc_pin_cmd_pin
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4688 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:52:43 +00:00
martin 2f440e63ca pkcs11: Remove the comment about max_tries==1 and CKF_USER_PIN_FINAL_TRY
Assuming the driver has correctly set max_tries to 1 then PKCS#11 is very clear about it:
"""
True if supplying an incorrect user PIN will it to become locked.
"""

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4687 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-05 16:52:36 +00:00
viktor.tarasov ec6bb9859d MyEID: For Aventra card applied Toni's patch, enriched by Andre's proposal
see:
http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014662.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4686 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-04 20:46:07 +00:00
viktor.tarasov 602d170c3d libopensc: pkcs15: more of debug messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4685 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-04 20:21:34 +00:00
viktor.tarasov 741b8c362e libopensc: supplement to the previous commit
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4684 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-04 20:19:14 +00:00
viktor.tarasov 2db473a160 libopensc: export 'sc_card_find_rsa_alg'
Following proposal of Andre Zepezauer, see
http://www.opensc-project.org/pipermail/opensc-devel/2010-August/014699.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4683 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-04 20:16:54 +00:00
viktor.tarasov 0fe106e53a libopensc: in a supplement to r4668
Use 'max_recv_size' when building APDU for 'select file'


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4682 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-04 20:08:52 +00:00
ep 223d5e1bb3 Fix signedness issues in pkcs15-itacns.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4681 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 22:58:47 +00:00
ep 31e6602835 Remove unused variables and constants from pkcs15-itacns.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4680 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 22:58:45 +00:00
ep f70d4acf07 Squelch warning about unused se_num argument in itacns_set_security_env(),
as the driver is computing the right argument from the security environment
data.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4679 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 22:58:38 +00:00
ep 8697b4c04b Fix signedness warnings in card-itacns.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4678 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 22:58:36 +00:00
ep fbf1d621cb Remove unused give_random operation
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4677 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 22:58:34 +00:00
ep f5ef30bdd7 Pass SFI as an appropriately-sized number
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4676 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 22:58:31 +00:00
martin 49577941d6 Fixup for #102: also in command help.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4675 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 18:23:49 +00:00
martin 2d32947de4 Style: // -> /**/
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4673 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 13:39:01 +00:00
martin 4697cc386b libpkcs11: Print error messages from PKCS#11 module loading
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4672 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 13:38:56 +00:00
viktor.tarasov 9acc8c44af pkcs11: #250: update slot PIN flags when verifying slot's auth object
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4671 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-02 09:19:27 +00:00
martin 241d3b5d86 libopensc: improve max_send/recv_size related code comments.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4670 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 11:50:39 +00:00
martin 07ab2a2871 Ticket #226: Initial changes as noted by reporter
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4668 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 11:50:24 +00:00
martin 27ed902ce0 Add a FIXME for keys>2048b
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4667 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 11:46:37 +00:00
martin b04a1ef9f0 EstEID: small fixes for working with a modified max_send/recv_size
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4666 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 11:46:31 +00:00
martin befff1b0d4 libopensc: PIN usage counter is decreased every time it is sent to the card, no matter what the card replies (should probably reply with success)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4665 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 06:23:43 +00:00
martin 5e3f7b10d0 Whitespace fix
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4664 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 06:23:37 +00:00
martin 15b6f29013 Whitespace fix
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4663 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 06:23:32 +00:00
martin 8c9666d631 pkcs11: C_SeedRandom is not implemented by OpenSC nor most smart cards, nor does it fit well into PKCS#15 concept.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4662 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 06:23:26 +00:00
martin 12a1e9d49b pkcs15: don't override TokenInfo PRNG flag. pkcs11: announce CKF_RNG if the card driver supports it, bypassing PKCS#15.
GET CHALLENGE and RNG don't match 1:1 anyway.

Thanks to Andre Zepezauer for noticing this.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4661 c6295689-39f2-0310-b995-f0e70906c6a9
2010-09-01 06:23:17 +00:00
martin 8d3a1bcd1f libopensc: remove the "etoken" alias for "cardos" cards.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4659 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-31 01:24:53 +00:00
viktor.tarasov 0285264af5 #73: pkcs15-tool: when changing PIN, print message if no PIN value supplied
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4658 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-30 16:37:15 +00:00
martin b4f9ac456a pkcs15-init: fix leftover from [4646]
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4656 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-27 09:28:42 +00:00
martin a7191a9540 Revert CardOS change from Italian CNS patch [4627].
Limiting Le for CNS should be done in pkcs15-itacns.c

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4655 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-27 08:24:39 +00:00
s ed589feda7 add ATR for Rutoken ECP (DS)
Thanks to Aktiv Co. Kirill Mescheryakov for the patch.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4654 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-25 19:24:23 +00:00
martin cd01ad0936 pkcs15init: On Windows, get the profile directory from registry instead of configuration file.
This allows the installation directory for non-dll files to be anywhere on the system.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4652 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-25 12:51:55 +00:00
martin a3d02dd63c CT-API, PC/SC: truncating atr_len makes no sense.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4648 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-25 08:32:42 +00:00
martin 4f03502b60 pkcs11: check PKCS#11 function parameters for obvious errors and return CKR_ARGUMENTS_BAD early without locking the module.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4647 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-23 14:47:14 +00:00
martin 9a63e03e9a pkcs11/pkcs15-init: remove automagic software key generation. Remove software based secret key handling from PKCS#11.
Support for importing cleartext keys is left untouched, but all transparent key generation by either opensc-pkcs11.so or pkcs15-init is removed, to make the operation with cleartext keys visible to the user and his explicit wish.
OpenSC is a PKCS#11 library for accessing keys protected by a smart card. Key material in software is not protected by smart cards and can leave a false sense of security to the user.

http://www.opensc-project.org/pipermail/opensc-devel/2010-April/013877.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4646 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-23 14:47:07 +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
martin 98255b109a libopensc: Fix SC_ERROR defines and messages: remove unused error defines, fix the internal value of some PKCS#15 related errors.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4644 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-23 10:32:21 +00:00
martin c235f93cff EstEID: sc_format_path sets SC_PATH_TYPE_PATH by default
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4642 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-23 09:34:30 +00:00
ep 6474853217 Support reading record files by SFI
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4641 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-21 20:12:59 +00:00
ep cba47b33bf Only free current_file if it is set
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4640 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-21 20:12:56 +00:00
ep 5990d26f80 If a FCI features tag 84h, then the file is a DF
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4639 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-21 20:12:53 +00:00
ep fd396a0546 Refactored the "select the file referenced by current_path; die on error" idiom in opensc-explorer.
This version, additionally, skips this step entirely if there is no current_path; this is useful when starting with --mf "".

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4638 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-20 22:51:42 +00:00
ep 4e726bd09b Fix and document opensc-explorer's new -m, --mf option
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4637 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-20 22:51:39 +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
ep d37dd91b63 Use strlcpy(3), strlcat(3) in pkcs15-itacns.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4635 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 13:42:30 +00:00
ep b279287701 strlcat(3) implementation
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4634 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 13:42:26 +00:00
ep 96df880730 Prevent card-incrypto34.c from catching the Italian CNS card's ATR
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4633 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 13:42:21 +00:00
ep acd062e0dd Avert potential buffer overflows in pkcs15-itacns.c
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4632 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-18 13:42:16 +00:00
ludovic.rousseau 31d1a552d3 Use (SCARD_READERSTATE *) instead of LPSCARD_READERSTATE since
LPSCARD_READERSTATE is not define in old pcsc-lite (< 1.6.3) nor Mac OS X


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4631 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-16 09:33:56 +00:00
martin b1ff1abb1b Fix and change ignored readers feature introducsed in r4626 for Windows. strcasestr is GNU specific extension.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4630 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-16 08:59:14 +00:00
martin bb8b2d5f4b itacns: add itacns.h to distribution targzip, fix card driver ordering.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4629 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-16 08:59:09 +00:00
martin 484d484c21 PC/SC: Fix building on OS X and mingw32 after r4626
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4628 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-16 08:59:05 +00:00
ep 71cdef0ed2 New card driver: Italian CNS/CIE (eID)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4627 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-16 00:56:27 +00:00
ludovic.rousseau 947c3291db Use SCARD_READERSTATE instead of SCARD_READERSTATE_A
SCARD_READERSTATE_A is not used by Microsoft API and is no more
defined/used by pcsc-lite >= 1.6.2

Thanks to Josef Windorfer for the bug report
http://www.opensc-project.org/pipermail/opensc-user/2010-August/004235.html


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4626 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-15 14:57:34 +00:00
martin fde87a8c6e pkcs11: remove outdated config entry parsing.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4625 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-15 09:34:13 +00:00
martin a938d3b67f Implement simple reader ignoring, to exclude readers from OpenSC PKCS#11 module.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4624 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-15 09:33:18 +00:00