Skip to content

Commit

Permalink
Restore blocking WaitForSlotEvent functionality for recent PCSC-Lite …
Browse files Browse the repository at this point in the history
…versions

 * Add configure-time dependency on pcsclite (required version from comments in reader-pcsc.c)
 * The functionality is already supported in PCSC-Lite
 * For older PCSC-Lite versions still return CKR_FUNCTION_NOT_SUPPORTED

 # closes OpenSC#899
  • Loading branch information
Jakuje authored and viktorTarasov committed Nov 20, 2016
1 parent 282632f commit 3cb24eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion configure.ac
Expand Up @@ -583,7 +583,10 @@ if test "${enable_pcsc}" = "yes"; then
if test "${WIN32}" != "yes"; then
PKG_CHECK_EXISTS(
[libpcsclite],
[PKG_CHECK_MODULES([PCSC], [libpcsclite])]
[PKG_CHECK_MODULES([PCSC], [libpcsclite >= 1.6.5],
[AC_DEFINE([PCSCLITE_GOOD], [1], [Sufficient version of PCSC-Lite with all the required features])],
[:]
)]
)
if test -z "${PCSC_CFLAGS}"; then
case "${host}" in
Expand Down
3 changes: 2 additions & 1 deletion src/pkcs11/pkcs11-global.c
Expand Up @@ -641,10 +641,11 @@ CK_RV C_WaitForSlotEvent(CK_FLAGS flags, /* blocking/nonblocking flag */
return CKR_ARGUMENTS_BAD;

sc_log(context, "C_WaitForSlotEvent(block=%d)", !(flags & CKF_DONT_BLOCK));
#ifndef PCSCLITE_GOOD
/* Not all pcsc-lite versions implement consistently used functions as they are */
/* FIXME: add proper checking into build to check correct pcsc-lite version for SCardStatusChange/SCardCancel */
if (!(flags & CKF_DONT_BLOCK))
return CKR_FUNCTION_NOT_SUPPORTED;
#endif /* PCSCLITE_GOOD */
rv = sc_pkcs11_lock();
if (rv != CKR_OK)
return rv;
Expand Down

0 comments on commit 3cb24eb

Please sign in to comment.