[Pcsclite-cvs-commit] r4902 - /trunk/Drivers/ccid/src/commands.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Apr 29 07:58:04 UTC 2010


Author: rousseau
Date: Thu Apr 29 07:58:03 2010
New Revision: 4902

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4902
Log:
SecurePINVerify() & SecurePINModify(): with a TPDU reader and a T=1 card
the ns & nr sequence numbers were not correctly handled if the CCID
command was rejected at the reader level (not sent to the card).
The next APDU sent to the card would fail.

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

Modified: trunk/Drivers/ccid/src/commands.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/commands.c?rev=4902&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/commands.c (original)
+++ trunk/Drivers/ccid/src/commands.c Thu Apr 29 07:58:03 2010
@@ -458,12 +458,13 @@
 	ret = CCID_Receive(reader_index, RxLength, RxBuffer, NULL);
 
 	/* T=1 Protocol Management for a TPDU reader */
-	if ((IFD_SUCCESS == ret)
-		&& (SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol)
+	if ((SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol)
 		&& (CCID_CLASS_TPDU == (ccid_descriptor->dwFeatures & CCID_CLASS_EXCHANGE_MASK)))
 	{
 		/* timeout and cancel cases are faked by CCID_Receive() */
-		if (2 == *RxLength)
+		if ((2 == *RxLength)
+			/* the CCID command is rejected or failed */
+		   || (IFD_SUCCESS != ret))
 		{
 			/* Decrement the sequence numbers since no TPDU was sent */
 			get_ccid_slot(reader_index)->t1.ns ^= 1;
@@ -685,12 +686,13 @@
  	ret = CCID_Receive(reader_index, RxLength, RxBuffer, NULL);
 
 	/* T=1 Protocol Management for a TPDU reader */
-	if ((IFD_SUCCESS == ret)
-		&& (SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol)
+	if ((SCARD_PROTOCOL_T1 == ccid_descriptor->cardProtocol)
 		&& (CCID_CLASS_TPDU == (ccid_descriptor->dwFeatures & CCID_CLASS_EXCHANGE_MASK)))
 	{
 		/* timeout and cancel cases are faked by CCID_Receive() */
-		if (2 == *RxLength)
+		if ((2 == *RxLength)
+			/* the CCID command is rejected or failed */
+			|| (IFD_SUCCESS != ret))
 		{
 			/* Decrement the sequence numbers since no TPDU was sent */
 			get_ccid_slot(reader_index)->t1.ns ^= 1;




More information about the Pcsclite-cvs-commit mailing list