Commit Graph

220 Commits

Author SHA1 Message Date
Frank Morgner ac65af0669 Fixes unreleased locks with pcsc-lite
This is a bug in PCSC-Lite propably won't be fixed, see
https://alioth.debian.org/tracker/index.php?func=detail&aid=315083&group_id=30105&atid=410088

Fixes https://github.com/OpenSC/OpenSC/issues/480
Closes https://github.com/OpenSC/OpenSC/pull/487
2015-10-03 12:55:15 +02:00
Frank Morgner b2508b6c59 removed workaround for HP USB Smart Card Keyboard
Has been fixed by the CCID driver
https://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2011-March/005218.html
2015-09-02 10:49:12 +02:00
Frank Morgner cf2a9cbbb0 added call back for getting vendor/product id
implementation taken from
83142d4cae
2015-09-02 10:47:29 +02:00
Viktor Tarasov ff2d88a724 libopensc: uncomplete changes in c48afdbf breaks windows builds 2015-08-16 20:18:29 +02:00
Frank Morgner d7d64ee8d4 Merge pull request #494 from frankmorgner/fork
After a fork do not release resources shared with parent
2015-08-04 10:32:01 +02:00
Frank Morgner c92e3b4f98 honour PC/SC pt 10 dwMaxAPDUDataSize
closes #306
2015-07-28 09:49:44 +02:00
Frank Morgner 7cec500e54 added flags to sc_context_t
- is initialized in sc_context_create with parm->flags
- removes members paranoid_memory and enable_default_driver
2015-07-22 17:30:21 +02:00
Frank Morgner edc839e072 restrict access to card handles after fork
fixes #333
closes #493
2015-07-22 16:46:04 +02:00
vletoux ad47d4d043 minidriver:
* factorize the code from CardAuthenticatePIN into CardAuthenticateEx
* allows authentication with the PINPAD without a UI

minidriver: fix some code analysis warnings
2015-05-10 15:04:36 +02:00
viktorTarasov c754e3f197 Merge pull request #444 from frankmorgner/pkcs11-error-handling
Improved error handling for PKCS#11 module
2015-04-25 13:04:07 +02:00
Frank Morgner bcb5fc15e5 honour HAVE_CONFIG_H 2015-04-22 23:55:33 +02:00
Frank Morgner e359b2a310 handle unexpected meltdown of PC/SC service 2015-04-21 01:09:21 +02:00
Frank Morgner 54f285d57a correctly handle readers that have been removed 2015-04-21 01:04:18 +02:00
Frank Morgner f3573ede0d fixed requesting PACE features 2015-03-29 12:42:13 +02:00
Frank Morgner 6759c04b26 don't ignore errors 2015-01-28 04:45:08 +01:00
Frank Morgner 3a557ad0dd fixed parsing pace output data 2015-01-28 07:22:03 +01:00
Frank Morgner 027e4a0867 fixed out of bounds read 2015-01-28 05:59:41 +01:00
Ludovic Rousseau abb48c8ba7 reader-pcsc: fix compiler warning
Add a missing "const" for a constant C-string

reader-pcsc.c: In function `detect_reader_features':
reader-pcsc.c:926:20: warning: initialization discards `const' qualifier from pointer target type [enabled by default]
2014-01-06 15:36:50 +01:00
Ludovic Rousseau c6d3b3b086 reader-pcsc: fix verify/modify pinpad commands
The PC/SC v2 part 10 commands for PIN verify and modify were wrong after
a change in pcsc-lite.
See a similar change in http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2013-December/006364.html

Should fix issue #199
2014-01-06 15:28:22 +01:00
Frank Morgner 32c470469d use enough memory for pin verification/modification structure 2013-08-02 15:00:09 +02:00
Viktor Tarasov 407ffa3388 libopensc: for hex dump in debug messages ...
use dedicated log procedure that uses a static dump buffer

inspired by pull request #164 of Frank Morgner
https://github.com/OpenSC/OpenSC/pull/164
2013-08-02 14:21:02 +02:00
Frank Morgner 3567660a1c reader-pcsc.c: fixed implicit pin modification
Allows the application to only initialize pin2 for implicit pin
modification and to leave pin1 untouched.
2013-08-02 11:41:30 +02:00
Frank Morgner eb281b1ada reader-pcsc.c: fixed pin checking when implicitly given 2013-08-02 11:41:29 +02:00
Martin Paljak 16ee818440 Update domain name. paljak.pri.ee is gone since 2011. 2013-02-25 11:58:25 +02:00
Viktor Tarasov 41861e42b0 no 'pace' in common part
'PACE' is extremely card specific protocol and has not to be ostensibly
present in the common part of OpenSC:
 * currently in OpenSC there is no card driver that supports or uses this protocol;
 * amazing content of the common 'sc_perform_pace' -- beside the verbose logs
   the only substantial action is to call the card/reader specific handler.
   According to the current sources and the pull request 83
   this 'common' procedure is called by the card driver or
   card specific tool/operation.
 * currently the 'PACE' can be thouroghly tested only by one person (Frank Morgner),
   and only using the OpenSSL patched with the PACE specific patch.
   So, at least a dedicated configuration option could be introduced when comiting PACE to the common part.
 * common 'sc_perfom_pace' has the same role as the 'initialize-SM' handler of the existing SM framework
   and can be implemented as card specific SM, as the others cards do.
   This confirmed by Frank Morgner, the author of PACE commits and nPA card driver, himself.
   (https://github.com/OpenSC/OpenSC/pull/83)
2012-08-30 18:51:42 +02:00
Alon Bar-Lev df8715849d Remove libltdl: Remove ltld references
http://www.opensc-project.org/pipermail/opensc-devel/2011-December/017490.html
cherry-picked from 'libtool' branch of Alon Barlev's github project git://github.com/alonbl/OpenSC.git
and rebased

Remove libltdl: Remove ltld references
(cherry picked from commit a350326c520c5b0cb185f90946648633f4d0e456)

Remove libltdl: Detect libdl
(cherry picked from commit 51e7de45c11823460e776492dcbd40e60583a7eb)

Remove libltdl: Use libscdl
(cherry picked from commit 09f3eadb8a1a47407c011dcd3d5ce461516f3b87)

Remove libltdl: Cleanup libscdl
(cherry picked from commit 52d5f1be01146079e3a6fad1c88ebb0f577d0a94)

Remove libltdl: Cleanup libscdl usage at Microsoft VC build

Untested, I don't have the environment, Martin, please test.
(cherry picked from commit 7fb18f8d0b0bae6d181981a0c71190440e917c2c)

Change-Id: I73c98ccb9365584b12f4b0b97b69316a190b6e45
2012-03-17 20:55:05 +01:00
Ludovic Rousseau 006a97b8c8 Use the short form sc_log() instead of sc_debug()
Replace sc_debug(ctx, SC_LOG_DEBUG_NORMAL, ...) by sc_log(ctx, ...) as
suggested by Viktor Tarasov
2012-02-21 21:22:54 +01:00
Ludovic Rousseau 27c6652a1d Remove extra spaces and tabs at end of lines 2012-02-21 21:10:20 +01:00
Ludovic Rousseau af9dada86c Fix compilation error on Windows
SC_READER_CAP_PACE has been renamed to SC_READER_CAP_PACE_GENERIC during
patch discussion.
Thanks to Viktor Tarasov for the bug report
2012-02-21 21:10:20 +01:00
Frank Morgner 1141ae5202 Add support for PACE-enabled readers
Implements PC/SC interface to PACE-enabled readers defined in PC/SC
pt. 10 AMD 1 and BSI TR-03119.

PACE can be started using `sc_perform_pace`. This function currently
calls the new `perform_pace` from `struct sc_reader_operations`, if the
reader has the needed capabilities. `sc_perform_pace` could also be
extended with a stand-alone implementation of PACE (code could be
imported from here http://vsmartcard.sourceforge.net/npa/README.html).

Note that the reader's PACE capabilities are correctly determined by
calling GetReaderPACECapabilities.

OpenSC's new PACE capabilities can be tested using the `npa-tool` from
the Virtual Smart Card Architecture (see link above).
2012-02-21 14:10:47 +01:00
Martin Paljak 46e0c49d7b pcsc: correctly handle timeout situation when refreshing reader state.
The code that treated a timeout as success was never reached, because the
surrounding if eliminated the possibility of entering the block when the return code
from SCardGetStatusChange was SCARD_E_TIMEOUT.

Issue found by Coverity Scan.
2011-06-16 10:15:34 +03:00
Martin Paljak 1f870b0c07 pcsc: initialize variables
Patch by Frank Morgner

http://www.opensc-project.org/pipermail/opensc-devel/2011-May/016659.html
2011-06-16 10:08:04 +03:00
Ludovic Rousseau 75524a5be8 Fix PIN min and max sizes for pinpads
Some pinpads do not support PIN size less than 4 or greater than 8.
PC/SC v2 part 10 allows to ask the driver/reader for the supported
values. This avoids to have the SECURE PIN CCID command rejected by the
reader.

This should fix OpenSC ticket #361 "card-entersafe should ask the pinpad
reader for the maximum pin size"
2011-06-14 15:54:49 +02:00
Ludovic Rousseau 8936901e2b Correctly wait for card event
The timeout parameter of SCardGetStatusChange() is a DWORD (unsigned
int). An int timeout parameter was used instead.
The problem happens on 64-bits architectures where DWORD is 64-bits long
and int is only 32-bits long. The sign extension C mechanism transforms
the PC/SC value INFINITE into -1 instead of 4294967295.

See http://www.opensc-project.org/pipermail/opensc-devel/2011-June/016831.html
"Kobil KAAN Advanced Reader, "waiting for card" timeout"
2011-06-14 13:50:37 +02:00
martin 44cf3d06ae MiniDriver: rename cardmod to minidriver in source.
Also change some grammar, whitespace (reported by git) and wording (Opensc->OpenSC) issues.
Add some comments here and there.

See http://www.opensc-project.org/pipermail/opensc-devel/2011-April/016261.html

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5329 c6295689-39f2-0310-b995-f0e70906c6a9
2011-04-12 07:40:12 +00:00
martin cd3012f55e Fix #340: ignore pinpad properties of readers known to be broken.
On Mac OS X the HP smart card keyboard claims secure PIN entry support but the PIN is transmitted to host.
Disregard the pinpad flag for this reader. Other readers claiming pinpad support but having problems to follow in this list.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5273 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-29 11:36:45 +00:00
ludovic.rousseau f1170e009a Fix compiler warning
reader-pcsc.c: In function 'refresh_attributes':
reader-pcsc.c:339: warning: declaration of 'rv' shadows a previous local
reader-pcsc.c:273: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5258 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:46:51 +00:00
ludovic.rousseau f7f6213d24 Fix compiler warning
reader-pcsc.c: In function 'refresh_attributes':
reader-pcsc.c:337: warning: declaration of 'state' shadows a previous local
reader-pcsc.c:272: warning: shadowed declaration is here


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5257 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-23 15:45:41 +00:00
martin 711cbda2e0 PC/SC: Add "PIN length not in range" interpretation to PC/SC pinpad code.
This way this condition won't get translated to a generic -1200 error, as 0x6403 is not a known SW.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5217 c6295689-39f2-0310-b995-f0e70906c6a9
2011-03-02 14:18:09 +00:00
martin ffb46d2573 core: reanimate the sc_dlopen API for dynamic loading
* shift libpkcs11 from src/pkcs11 to src/common as it is not used to implement the OpenSC PKCS#11 module
 * invent a "libscdl" mini library that implements either libltdl based dynamic loading or uses native interfaces
 * drop hard requirement for libltl to build OpenSC
 * native Windows build does not need libltdl any more
 * specify CNGSDK include dir to find cardmod.h. CNGSDK only registers with a handful of compilers

Deals with #323

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5201 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-16 19:02:11 +00:00
dengert 0a9d507556 Fixes to cardmod:
The registry in no longer used to pass the
    handles provided by BaseCSP. sc_ctx_use_reader
    is used instead.  (uses r5190)

    A decryption routine was added as it is needed by login.

    Key container names are based on the card serial
    number and cert ID. The must be unique as they
    are searched for in the certificate store to 
    find the card to insert in some situations. 

    If the handles change, the association to the reader
    and card is refreshed as it may be a different card
    or reader.  (uses r5127)

    Extra low lowel debugging was added. To use
    it the CARDMOD_LOW_LEVEL_DEBUG but be defined in
    cardmod.c This can log entries before and sc_context
    is established. 

    The use of "texte" was replaced, as it looked like there 
    could be buffer overflows. It was replaced with a 
    loghex routine.

    SC_ALGORITHM_RSA_HASH_MD5_SHA1 can now be used
    (IE uses this.) 
       
    Several other bugs were fixed.

The code can now bue used for AD login, and was tested
with swaping cards duirng login, and with several readers. 
The code is still experimental, and for login to work,
the dlls were moved to system32. 



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5192 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-09 17:52:00 +00:00
dengert d3b3faa91a Add sc_ctx_use_reader as a reader driver operation.
It is used by cardmod to pass in pointers to the PC/SC handles 
provided by the caller of cardmod. Other drivers will return
an error if this routine called. 


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5190 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-09 14:33:52 +00:00
ludovic.rousseau a4e314e453 Add missing check code for NULL before dereferencing
reader-pcsc.c:1076:3: warning: Dereference of null pointer (loaded from variable
      'event_reader')
                *event_reader = NULL;
                ^~~~~~~~~~~~~
reader-pcsc.c:1098:3: warning: Dereference of null pointer (loaded from variable
      'event')
                *event = 0;
                ^~~~~~
reader-pcsc.c:1137:6: warning: Dereference of null pointer (loaded from variable
      'event_reader')
                                        *event_reader = ...
                                        ^~~~~~~~~~~~~
reader-pcsc.c:1112:6: warning: Dereference of null pointer (loaded from variable
      'event_reader')
                                        *event_reader = NULL;
                                        ^~~~~~~~~~~~~


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5161 c6295689-39f2-0310-b995-f0e70906c6a9
2011-02-05 21:32:28 +00:00
vtarasov a576582701 libioensc: use 'struct sc_atr' instead of 'u8 *atr, size_t atr_len'
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5061 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-07 17:18:58 +00:00
martin 6af2bc07c3 PC/SC: don't try to use SCARD_SHARE_DIRECT if there is a card in the reader. This can confuse some card/reader combos.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5054 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-07 08:55:12 +00:00
martin c911c2ffeb PC/SC: add additional flags to indicate readers which are in use and readers which are in exclusive mode.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5015 c6295689-39f2-0310-b995-f0e70906c6a9
2011-01-02 12:54:51 +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 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 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