Commit Graph

3927 Commits

Author SHA1 Message Date
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 2b1a8b5828 build: don't check for unused functions and headers.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4643 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-23 10:32:17 +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
martin 409284ed60 opensc-tool: Fix ACL reporting for EF-s. Patch by Emanuele Pucciarelli.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4623 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-14 12:18:27 +00:00
martin 9f639f48c4 Add back MAX_ATR_SIZE which was erroneously removed in r4611. Fixes mingw32 build.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4622 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-13 09:27:38 +00:00
ludovic.rousseau 7ac66ae4cf Correctly use pin2 when needed.
Patch from OpenSUSE.

Closes ticket #249.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4621 c6295689-39f2-0310-b995-f0e70906c6a9
2010-08-12 21:49:14 +00:00
ludovic.rousseau c7a99c2e03 Use || instead of | in a #if check
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4619 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-30 07:09:15 +00:00
martin a8c438fde1 configure: Add possible docbook paths on OS X (Fink, MacPorts)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4612 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-27 08:05:31 +00:00
martin 5c2c12bb78 Trac #244: Fix structure packing on Apple and SUN. Fix display detection by updating structure definitions.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4611 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-26 13:16:37 +00:00
martin 11dc9ba797 cardos-tool: fix handing of --help/--verbose/--debug
--debug was not documented and not used by other tools; --help was not handled.

Thanks to Ludolf Holzheid for noticing this.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4596 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-26 11:18:00 +00:00
martin 002843c140 pkcs15-init: fix help text ordering (Ludolf Holzheid)
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4595 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-26 11:17:57 +00:00
martin 578bbd2104 man: use --auth-id instead of bogus --pin-id in pkcs15-tool man page. [Ludolf Holzheid]
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4594 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-26 11:17:53 +00:00
viktor.tarasov 13a42de128 pkcs11 tool: fix messages
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4593 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-21 09:50:10 +00:00
flc 764c1d9183 minors log message corrections to build successfully.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4586 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-20 07:51:07 +00:00
viktor.tarasov 006c30c2e0 #245: pkcs15 asn1: 'subjectName' in 'commonPrivateKeyAttributes' is optional
thanks to Jean-Michel


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4518 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-08 08:09:46 +00:00
viktor.tarasov 3ea6b28405 #229: pkcs15init entersafe: 'sanity-check' includes the update of the User PIN's 'pinFlags'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4516 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-06 12:40:56 +00:00
viktor.tarasov 3a3c41a6db pkcs15: encode/decode 'AccessControlRules' in 'CommonObjectAttributes'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4515 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-06 09:09:04 +00:00
martin b7e25bb407 Fix MuscleApplet version detection
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4514 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-05 17:54:12 +00:00
viktor.tarasov 1090d19d30 #60: pkcs11-tool: print key sizes from CK_MECHANISM_INFO
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4513 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-05 14:43:31 +00:00
viktor.tarasov b78d7630e7 pkcs15: encode/decode 'subjectName' in 'CommonPrivateKeyAttributes'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4512 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-05 13:29:10 +00:00
viktor.tarasov f85b625b47 pkcs15: correct the comments
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4511 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-05 12:57:10 +00:00
viktor.tarasov f18ba7d984 pkcs15: decode 'supportedAlgorithms' in 'TokenInfo'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4510 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-05 12:54:23 +00:00
viktor.tarasov 1d82e8abab re-distribute 'define' macros between types.h and opensc.h
move 'define' macros closer to the definition of the related data types


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4509 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-05 09:33:51 +00:00
viktor.tarasov ae14336221 pkcs15init: create frame to implement card specific 'sanity check' procedure
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4508 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-02 14:26:29 +00:00
viktor.tarasov 2883c17b15 pkcs15init: homogenize argument order of pkcs15init operations
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4507 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-02 13:46:13 +00:00
viktor.tarasov 765ea98cfb tools opensc-explorer: for 'apdu' command accept space separated hexadecimal data
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4500 c6295689-39f2-0310-b995-f0e70906c6a9
2010-07-01 12:31:52 +00:00
martin e26783201a Assuan is not used.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4499 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-30 17:27:04 +00:00
viktor.tarasov bd5c186767 pkcs15/pkcs11: encoding of certificate's attribute 'serialNumber'
Applying patch of Andre Zepezauer. Thanks.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4451 c6295689-39f2-0310-b995-f0e70906c6a9
2010-06-21 10:49:58 +00:00