Hi
It seems to me that simtrace looses a byte between 2 URB transfers from the device. To
trace the problem down, I wrote a little test-program, running the same APDU against the
smart card.
I’m using simtrace to trace the card on the HW level and at the very same time I trace on
the PCSC layer of the OS. Of cause the 2 APDU traces should give exactly the same results.
Surprisimgly I found that the simtrace is swallowing one byte between two URB chunks
transferred.
Please find below the 2 logs A.) PCSC trace, B.) simtrace output. In this example simtrace
is missing 1 byte (“7F”) between the two URB chunks a.) and b.). This missing byte causes
to scrow up the analyser (APDU number 5). The same problem occurs also between the next
two URB chunks b.) and c.): This time a “00” gets lost ... etc etc.
A.) The PCSC traces as reference: =======================================
1.) transmitted:
80 C2 00 00 28 D8 00 01 6F 00 F5 EF BF B1 8C 76 16 00 0E 43 6F 6E 74 65 6E 74
4D 61 6E 61 67 65 72 00 C0 4B 4E 7F BD 00 04 4D 53 43 4D
received:
61 05
2.) transmitted:
00 C0 00 00 05
received:
01 00 00 00 05 90 00
3.) transmitted:
80 C2 00 00 12 D8 00 05 6F 00 C0 4B 4E 7F BD DE EC 00 04 4D 53 43 4D
received:
61 0F
4.) transmitted:
00 C0 00 00 0F
received:
00 D2 5D 1C 11 27 00 07 37 2E 31 2E 30 2E 30 90 00
5.) transmitted:
80 C2 00 00 14 D8 00 05 6F 00 C0 4B 4E 7F BD 81 87 00 04 4D 53 43 4D 05 00
received:
61 1A
6.) transmitted:
00 C0 00 00 1A
received:
00 D2 5D 1C 45 A3 00 00 00 10 2E 4E 45 54 57 01 13 51 21 9C 77 14 27 14 FF FF
90 00
7.) transmitted:
80 C2 00 00 12 D8 00 05 6F 00 C0 4B 4E 7F BD FA 3B 00 04 4D 53 43 4D
received:
61 12
8.) transmitted:
00 C0 00 00 12
received:
00 D2 5D 1C 45 A3 00 00 00 08 83 17 65 55 19 7E A5 EB 90 00
9.) transmitted:
80 C2 00 00 1E D8 00 05 6F 00 C0 4B 4E 7F BD 24 FE 00 04 4D 53 43 4D 00 00 00
08 FC 66 34 93 BD 58 68 54
received:
90 00
10.) transmitted:
80 C2 00 00 13 D8 00 05 6F 00 C0 4B 4E 7F BD 6D 08 00 04 4D 53 43 4D 02
received:
61 0A
11.) transmitted:
00 C0 00 00 0A
received:
00 D2 5D 1C 61 C0 00 00 00 05 90 00
B.) The simtrace output: ================================================
simtrace - GSM SIM and smartcard tracing
(C) 2010 by Harald Welte <laforge(a)gnumonks.org>
Entering main loop
URB: 01 01 00 00 3b 16 96 41 73 74 72 69 64
ATR APDU: 3b 16 96 41 73 74 72 69 64
a.) URB: 01 00 00 00 80 c2 00 00 28 c2 d8 00 01 6f 00 f5 ef bf b1 8c 76 16 00 0e 43 6f 6e
74 65 6e 74 4d 61 6e 61 67 65 72 00 c0 4b 4e 7f bd 00 04 4d 53 43 4d 61 05 00 c0 00 00 05
c0 01 00 00 00 05 90 00 80 c2 00 00 12 c2 d8 00 05 6f 00 c0 4b 4e 7f bd de ec 00 04 4d 53
43 4d 61 0f 00 c0 00 00 0f c0 00 d2 5d 1c 11 27 00 07 37 2e 31 2e 30 2e 30 90 00 80 c2 00
00 14 c2 d8 00 05 6f 00 c0 4b 4e
1.) APDU: 80 c2 00 00 28 d8 00 01 6f 00 f5 ef bf b1 8c 76 16 00 0e 43 6f 6e 74 65 6e 74 4d
61 6e 61 67 65 72 00 c0 4b 4e 7f bd 00 04 4d 53 43 4d 61 05
2.) APDU: 00 c0 00 00 05 01 00 00 00 05 90 00
3.) APDU: 80 c2 00 00 12 d8 00 05 6f 00 c0 4b 4e 7f bd de ec 00 04 4d 53 43 4d 61 0f
4.) APDU: 00 c0 00 00 0f 00 d2 5d 1c 11 27 00 07 37 2e 31 2e 30 2e 30 90 00
b.) URB: 01 00 00 00 bd 81 00 04 4d 53 43 4d 05 00 61 1a 00 c0 00 00 1a c0 00 d2 5d 1c 45
a3 00 00 00 10 2e 4e 45 54 57 01 13 51 21 9c 77 14 27 14 ff ff 90 00 80 c2 00 00 12 c2 d8
00 05 6f 00 c0 4b 4e 7f bd fa 3b 00 04 4d 53 43 4d 61 12 00 c0 00 00 12 c0 00 d2 5d 1c 45
a3 00 00 00 08 83 17 65 55 19 7e a5 eb 90 00 80 c2 00 00 1e c2 d8 00 05 6f 00 c0 4b 4e 7f
bd 24 fe 00 04 4d 53 43 4d 00 00
5.) APDU: 80 c2 00 00 14 d8 00 05 6f 00 c0 4b 4e bd 81 00 04 4d 53 43 4d 05 00 61 1a 00 c0
APDU: 00 00 1a c0 00 d2 5d
APDU: 1c 45 a3 00 00 00 10
APDU: 2e 4e 45 54 57 01 13
APDU: 51 21 9c 77 14 27 14
APDU: ff ff 90 00 80 c2 00
APDU: 00 12 c2 d8 00 05 6f
APDU: 00 c0 4b 4e 7f bd fa
APDU: 3b 00 04 4d 53 43 4d
APDU: 61 12 00 c0 00 00 12
APDU: c0 00 d2 5d 1c 45 a3
APDU: 00 00 00 08 83 17 65
APDU: 55 19 7e a5 eb 90 00
c.)URB: 01 04 00 00 08 fc 66 34 93 bd 58 68 54
d.)URB: 01 04 00 00 90 00 80 c2 00 00 13 c2 d8 00 05 6f 00 c0 4b 4e 7f bd 6d 08 00 04 4d
53 43 4d 02 61 0a 00 c0 00 00 0a c0 00 d2 5d 1c 61 c0 00 00 00 05 90 00
APDU: 80 c2 00 00 1e d8 00 05 6f 00 c0 4b 4e 7f bd 24 fe 00 04 4d 53 43 4d 00 00 08 fc 66
34 93 bd 58 68 54 90 00 80
APDU: c2 00 00 13 c2 d8 00
APDU: 05 6f 00 c0 4b 4e 7f
APDU: bd 6d 08 00 04 4d 53
APDU: 43 4d 02 61 0a 00 c0
APDU: 00 00 0a c0 00 d2 5d
APDU: 1c 61 c0 00 00 00 05
URB: 01 01 00 00 3b 16 96 41 73 74 72 69 64
ATR APDU: 3b 16 96 41 73 74 72 69 64
==========================================================
Is this a problem of simtrace or the firmware?
Am I using a wrong firmware?
Thanks,
Ben