Hello,

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

(Btw: the commit 6312 fixed "pattern B" for me.)

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.

With the "patch" below the loop exits.



regards,

Martin


This loops over DEBUG_COMM("wrong nr");

00059990 winscard_svc.c:315:ContextThread() Received command: TRANSMIT from
client 12
00000099 winscard.c:1539:SCardTransmit() Send Protocol: T=1
00000059 APDU: 00 CA 01 07 00
00000052 ifdhandler.c:1257:IFDHTransmitToICC()
usb:0529/0620:libudev:0:/dev/bus/usb/002/015 (lun: 0)
00000052 commands.c:2092:CmdXfrBlockTPDU_T1() T=1: 5 and 320 bytes
00000050 openct/proto-t1.c:582:t1_build() more bit: 0
00000053 sending: 00 00 05 00 CA 01 07 00 C9
00000060 -> 000000 6F 09 00 00 00 00 30 00 00 00 00 00 05 00 CA 01 07 00 C9
00004292 <- 000000 80 35 00 00 00 00 30 00 00 00 00 60 31 07 4B 01 04 00 47
BA B1 02 02 00 00 03 04 04 1D 01 01 04 04 4A 5C 6F AE 05 01 01 06 02 00 01
07 20 65 54 6F 6B 65 6E 20 50 52 4F 20 4A 61 76 61 20 D5
CCID_Receive5:
CCID_Receive: n:0x0
00000129 received: 00 60 31 07 4B 01 04 00 47 BA B1 02 02 00 00 03 04 04 1D
01 01 04 04 4A 5C 6F AE 05 01 01 06 02 00 01 07 20 65 54 6F 6B 65 6E 20 50
52 4F 20 4A 61 76 61 20 D5
t1_xcv:53
cont-3
00000070 openct/proto-t1.c:359:t1_transceive()
00000056 openct/proto-t1.c:371:t1_transceive() wrong nr
retries:2
00000051 sending: 00 82 00 82
00000059 -> 000000 6F 04 00 00 00 00 31 00 00 00 00 82 00 82
00001013 <- 000000 80 35 00 00 00 00 31 00 00 00 00 60 31 07 4B 01 04 00 47
BA B1 02 02 00 00 03 04 04 1D 01 01 04 04 4A 5C 6F AE 05 01 01 06 02 00 01
07 20 65 54 6F 6B 65 6E 20 50 52 4F 20 4A 61 76 61 20 D5
CCID_Receive5:
CCID_Receive: n:0x0
00000119 received: 00 60 31 07 4B 01 04 00 47 BA B1 02 02 00 00 03 04 04 1D
01 01 04 04 4A 5C 6F AE 05 01 01 06 02 00 01 07 20 65 54 6F 6B 65 6E 20 50
52 4F 20 4A 61 76 61 20 D5
t1_xcv:53
cont-3
00000135 openct/proto-t1.c:371:t1_transceive() wrong nr
retries:1
00000105 sending: 00 82 00 82
00000092 -> 000000 6F 04 00 00 00 00 32 00 00 00 00 82 00 82
00000676 <- 000000 80 35 00 00 00 00 32 00 00 00 00 60 31 07 4B 01 04 00 47
BA B1 02 02 00 00 03 04 04 1D 01 01 04 04 4A 5C 6F AE 05 01 01 06 02 00 01
07 20 65 54 6F 6B 65 6E 20 50 52 4F 20 4A 61 76 61 20 D5
CCID_Receive5:
CCID_Receive: n:0x0
00000114 received: 00 60 31 07 4B 01 04 00 47 BA B1 02 02 00 00 03 04 04 1D
01 01 04 04 4A 5C 6F AE 05 01 01 06 02 00 01 07 20 65 54 6F 6B 65 6E 20 50
52 4F 20 4A 61 76 61 20 D5
t1_xcv:53
cont-3
00000107 openct/proto-t1.c:371:t1_transceive() wrong nr
retries:0
00000103 sending: 00 82 00 82
00000091 -> 000000 6F 04 00 00 00 00 33 00 00 00 00 82 00 82
00000699 <- 000000 80 35 00 00 00 00 33 00 00 00 00 60 31 07 4B 01 04 00 47
BA B1 02 02 00 00 03 04 04 1D 01 01 04 04 4A 5C 6F AE 05 01 01 06 02 00 01
07 20 65 54 6F 6B 65 6E 20 50 52 4F 20 4A 61 76 61 20 D5
CCID_Receive5:
CCID_Receive: n:0x0
00000110 received: 00 60 31 07 4B 01 04 00 47 BA B1 02 02 00 00 03 04 04 1D
01 01 04 04 4A 5C 6F AE 05 01 01 06 02 00 01 07 20 65 54 6F 6B 65 6E 20 50
52 4F 20 4A 61 76 61 20 D5
t1_xcv:53
cont-3
[......]

retries:-1795
00000003 sending: 00 82 00 82
00000006 -> 000000 6F 04 00 00 00 00 36 00 00 00 00 82 00 82
00000358 <- 000000 80 35 00 00 00 00 36 00 00 00 00 60 31 07 4B 01 04 00 47
BA B1 02 02 00 00 03 04 04 1D 01 01 04 04 4
A 5C 6F AE 05 01 01 06 02 00 01 07 20 65 54 6F 6B 65 6E 20 50 52 4F 20 4A 61
76 61 20 D5
CCID_Receive5:
CCID_Receive: n:0x0
00000014 received: 00 60 31 07 4B 01 04 00 47 BA B1 02 02 00 00 03 04 04 1D
01 01 04 04 4A 5C 6F AE 05 01 01 06 02 00 0
1 07 20 65 54 6F 6B 65 6E 20 50 52 4F 20 4A 61 76 61 20 D5
t1_xcv:53
cont-3
00000004 openct/proto-t1.c:371:t1_transceive() wrong nr
retries:-1796

.....and so on

Patch is simple:

if (t1_seq(pcb) != t1->nr) {
   DEBUG_COMM("wrong nr");
   // Added:
   printf("retries:%d\n",retries);
   if (retries == 0) {
      printf("goto resync\n");
      goto resync;
   }
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to