Commit Graph

4139 Commits

Author SHA1 Message Date
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 6fc7e62f20 conf: correct comments about OpenSC.tokend score meaning and default value.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4889 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 13:34:54 +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
martin c4a9ab6732 WindowsInstaller: overwrite files with same version to allow nightly builds; replace and delete blocked files on a reboot.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4887 c6295689-39f2-0310-b995-f0e70906c6a9
2010-11-29 08:51:17 +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