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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Feb 25 09:03:55 UTC 2011


Author: rousseau
Date: Fri Feb 25 09:03:48 2011
New Revision: 5637

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5637
Log:
get_IFSC(): parse TA byte before TD byte for a same iteration. So that
TA3 is parsed before TD3 and the IFSC is correctly parsed in an ATR
like: 3B F0 12 00 FF 91 81 B1 7C 45 1F 03 99

Thanks to Toshimune Konno for the bug report

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=5637&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c (original)
+++ trunk/Drivers/ccid/src/ifdhandler.c Fri Feb 25 09:03:48 2011
@@ -2014,19 +2014,19 @@
 
 	for (i=0; i<ATR_MAX_PROTOCOLS; i++)
 	{
+		/* TAi (i>2) present and protocol=1 => IFSC */
+		if (i >= 2 && protocol == 1
+			&& atr->ib[i][ATR_INTERFACE_BYTE_TA].present)
+		{
+			ifsc = atr->ib[i][ATR_INTERFACE_BYTE_TA].value;
+			*idx = i+1;
+			/* only the first TAi (i>2) must be used */
+			break;
+		}
+
 		/* protocol T=? */
 		if (atr->ib[i][ATR_INTERFACE_BYTE_TD].present)
 			protocol = atr->ib[i][ATR_INTERFACE_BYTE_TD].value & 0x0F;
-
-		/* TAi (i>2) present and protocol=1 => IFSC */
-		if (i >= 2 && protocol == 1
-			&& atr->ib[i][ATR_INTERFACE_BYTE_TA].present)
-		{
-			ifsc = atr->ib[i][ATR_INTERFACE_BYTE_TA].value;
-			*idx = i+1;
-			/* only the first TAi (i>2) must be used */
-			break;
-		}
 	}
 
 	if (ifsc > 254)




More information about the Pcsclite-cvs-commit mailing list