[Pcsclite-cvs-commit] r5991 - /trunk/Drivers/ccid/src/ifdhandler.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Sun Oct 2 12:17:55 UTC 2011


Author: rousseau
Date: Sun Oct  2 12:17:55 2011
New Revision: 5991

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5991
Log:
Add support of FEATURE_CCID_ESC_COMMAND and bPPDUSupport

FEATURE_CCID_ESC_COMMAND is available only if ifdDriverOptions (from
Info.plist config file) has bit 1 set:

	1: DRIVER_OPTION_CCID_EXCHANGE_AUTHORIZED
		the CCID Exchange command is allowed. You can use it through
		SCardControl(hCard, IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE, ...)

Modified:
    trunk/Drivers/ccid/src/ifdhandler.c

Modified: trunk/Drivers/ccid/src/ifdhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ifdhandler.c?rev=5991&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c (original)
+++ trunk/Drivers/ccid/src/ifdhandler.c Sun Oct  2 12:17:55 2011
@@ -1379,7 +1379,7 @@
 		int readerID = ccid_descriptor -> readerID;
 
 		/* we need room for up to five records */
-		if (RxLength < 5 * sizeof(PCSC_TLV_STRUCTURE))
+		if (RxLength < 6 * sizeof(PCSC_TLV_STRUCTURE))
 			return IFD_ERROR_INSUFFICIENT_BUFFER;
 
 		/* We can only support direct verify and/or modify currently */
@@ -1427,6 +1427,17 @@
 		pcsc_tlv -> value = htonl(IOCTL_FEATURE_GET_TLV_PROPERTIES);
 		pcsc_tlv++;
 		iBytesReturned += sizeof(PCSC_TLV_STRUCTURE);
+
+		/* IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE */
+		if (DriverOptions & DRIVER_OPTION_CCID_EXCHANGE_AUTHORIZED)
+		{
+			pcsc_tlv -> tag = FEATURE_CCID_ESC_COMMAND;
+			pcsc_tlv -> length = 0x04; /* always 0x04 */
+			pcsc_tlv -> value = htonl(IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE);
+
+			pcsc_tlv++;
+			iBytesReturned += sizeof(PCSC_TLV_STRUCTURE);
+		}
 
 		*pdwBytesReturned = iBytesReturned;
 		return_value = IFD_SUCCESS;
@@ -1526,6 +1537,14 @@
 			RxBuffer[p++] = 1;	/* length */
 			RxBuffer[p++] = 0x02;	/* validation key pressed */
 		}
+
+		/* bPPDUSupport */
+		RxBuffer[p++] = PCSCv2_PART10_PROPERTY_bPPDUSupport;
+		RxBuffer[p++] = 1;	/* length */
+		RxBuffer[p++] =
+			(DriverOptions & DRIVER_OPTION_CCID_EXCHANGE_AUTHORIZED) ? 1 : 0;
+			/* bit0: PPDU is supported over SCardControl using
+			 * FEATURE_CCID_ESC_COMMAND */
 
 		*pdwBytesReturned = p;
 		return_value = IFD_SUCCESS;




More information about the Pcsclite-cvs-commit mailing list