Restore blocking WaitForSlotEvent functionality for recent PCSC-Lite 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 #899
This commit is contained in:
Jakub Jelen 2016-11-10 16:29:47 +01:00 committed by Viktor Tarasov
parent 282632f7e6
commit 3cb24ebc79
2 changed files with 6 additions and 2 deletions

View File

@ -583,7 +583,10 @@ if test "${enable_pcsc}" = "yes"; then
if test "${WIN32}" != "yes"; then if test "${WIN32}" != "yes"; then
PKG_CHECK_EXISTS( PKG_CHECK_EXISTS(
[libpcsclite], [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 if test -z "${PCSC_CFLAGS}"; then
case "${host}" in case "${host}" in

View File

@ -641,10 +641,11 @@ CK_RV C_WaitForSlotEvent(CK_FLAGS flags, /* blocking/nonblocking flag */
return CKR_ARGUMENTS_BAD; return CKR_ARGUMENTS_BAD;
sc_log(context, "C_WaitForSlotEvent(block=%d)", !(flags & CKF_DONT_BLOCK)); 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 */ /* 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)) if (!(flags & CKF_DONT_BLOCK))
return CKR_FUNCTION_NOT_SUPPORTED; return CKR_FUNCTION_NOT_SUPPORTED;
#endif /* PCSCLITE_GOOD */
rv = sc_pkcs11_lock(); rv = sc_pkcs11_lock();
if (rv != CKR_OK) if (rv != CKR_OK)
return rv; return rv;