[Pcsclite-cvs-commit] r6327 - /trunk/Drivers/ccid/src/openct/proto-t1.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Wed Jun 6 12:36:02 UTC 2012


Author: rousseau
Date: Wed Jun  6 12:36:00 2012
New Revision: 6327

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6327
Log:
t1_transceive(): avoids a infinite retry loop

Add a check for ISO 7816-3 Rule 7.4.2 (2 retried before resync) in case
of "wrong nr".

" currently I have an endless loop in t1_transceive.  It happens from
time to time with the aladdin token.

I added some printfs to the code.
I can see, that the errors are detected and then a t1_build
is called with a T1_OTHER_ERROR, retries are decreased,
but this is never evaluated in the loop path
and the retries counter counts and counts....
I stopped it at: retries -1796. "

Thanks to Martin Vogt for the bug report and patch
http://archives.neohapsis.com/archives/dev/muscle/2012-q2/0076.html

Modified:
    trunk/Drivers/ccid/src/openct/proto-t1.c

Modified: trunk/Drivers/ccid/src/openct/proto-t1.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/openct/proto-t1.c?rev=6327&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/openct/proto-t1.c (original)
+++ trunk/Drivers/ccid/src/openct/proto-t1.c Wed Jun  6 12:36:00 2012
@@ -361,6 +361,11 @@
 			 * an R block */
 			if (t1_seq(pcb) != t1->nr) {
 				DEBUG_COMM("wrong nr");
+
+				/* ISO 7816-3 Rule 7.4.2 */
+				if (retries == 0)
+					goto resync;
+
 				slen = t1_build(t1, sdata, dad,
 						T1_R_BLOCK | T1_OTHER_ERROR,
 						NULL, NULL);




More information about the Pcsclite-cvs-commit mailing list