[Pcsclite-cvs-commit] r6868 - trunk/Drivers/ccid/src/openct
ludovic.rousseau at free.fr
ludovic.rousseau at free.fr
Sat Mar 8 16:14:39 UTC 2014
Author: rousseau
Date: 2014-03-08 16:14:39 +0000 (Sat, 08 Mar 2014)
New Revision: 6868
Modified:
trunk/Drivers/ccid/src/openct/proto-t1.c
Log:
t1_transceive(): check retries is is positive
The test was "retries == 0" but it may happen that retries becomes
negative. Then the counter will be decreasing "indefinitely".
The new test is "retries <= 0" to also get the negative values and
resync if needed.
The problem was detected by a T=1 card on a TPDU pinpad reader with a
VERIFY command that send a WTX request before returning the SW code.
Modified: trunk/Drivers/ccid/src/openct/proto-t1.c
===================================================================
--- trunk/Drivers/ccid/src/openct/proto-t1.c 2014-03-08 15:04:27 UTC (rev 6867)
+++ trunk/Drivers/ccid/src/openct/proto-t1.c 2014-03-08 16:14:39 UTC (rev 6868)
@@ -193,7 +193,7 @@
{
DEBUG_COMM("Parity error");
/* ISO 7816-3 Rule 7.4.2 */
- if (retries == 0)
+ if (retries <= 0)
goto resync;
/* ISO 7816-3 Rule 7.2 */
@@ -221,7 +221,7 @@
{
DEBUG_COMM("R-BLOCK required");
/* ISO 7816-3 Rule 7.4.2 */
- if (retries == 0)
+ if (retries <= 0)
goto resync;
/* ISO 7816-3 Rule 7.2 */
@@ -241,7 +241,7 @@
if (!t1_verify_checksum(t1, sdata, n)) {
DEBUG_COMM("checksum failed");
/* ISO 7816-3 Rule 7.4.2 */
- if (retries == 0)
+ if (retries <= 0)
goto resync;
/* ISO 7816-3 Rule 7.2 */
@@ -267,7 +267,7 @@
{
DEBUG_COMM("R-Block required");
/* ISO 7816-3 Rule 7.4.2 */
- if (retries == 0)
+ if (retries <= 0)
goto resync;
/* ISO 7816-3 Rule 7.2 */
@@ -292,7 +292,7 @@
t1_seq(pcb), t1->ns, t1->more);
/* ISO 7816-3 Rule 7.4.2 */
- if (retries == 0)
+ if (retries <= 0)
goto resync;
/* ISO 7816-3 Rule 7.2 */
@@ -363,7 +363,7 @@
DEBUG_COMM("wrong nr");
/* ISO 7816-3 Rule 7.4.2 */
- if (retries == 0)
+ if (retries <= 0)
goto resync;
slen = t1_build(t1, sdata, dad,
@@ -404,7 +404,7 @@
if (T1_S_IS_RESPONSE(pcb))
{
/* ISO 7816-3 Rule 7.4.2 */
- if (retries == 0)
+ if (retries <= 0)
goto resync;
/* ISO 7816-3 Rule 7.2 */
@@ -764,7 +764,7 @@
retries--;
/* ISO 7816-3 Rule 7.4.2 */
- if (retries == 0)
+ if (retries <= 0)
goto error;
if (-1 == n)
More information about the Pcsclite-cvs-commit
mailing list