Project

General

Profile

Actions

Bug #5380

open

Incorrect answer to PC_to_RDR_SetParameters CCID command

Added by rousseau about 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
01/01/2022
Due date:
% Done:

0%

Spec Reference:
CCID v1.1 chapter 6.2.3 RDR_to_PC_Parameters

Description

Since the fix for https://osmocom.org/issues/5285 the communication speed is very low.
I discovered that the new firmware does not respond correctly to the PC_to_RDR_SetParameters CCID command.

In my CCID driver log I have:
```
00000004 [140598069671488] ifdhandler.c:872:IFDHSetProtocolParameters() Set speed to 156250 bauds
00000004 [140598069671488] ifdhandler.c:1113:IFDHSetProtocolParameters() Communication timeout: 511181 ms
00000003 [140598069671488] commands.c:2319:SetParameters() length: 5 bytes
00000007 [140598069671488] > 000000 61 05 00 00 00 00 4C 00 00 00 96 00 00 0A 00
00000201 [140598069671488] ccid_usb.c:948:ReadUSB() Waiting data for slot 0
00000166 [140598627542592] ccid_usb.c:1949:Multi_ReadProc() Read 14 bytes for slot 0
00000025 [140598627542592] ccid_usb.c:1957:Multi_ReadProc() Signaled reader 0 slot 0
00000006 [140598627542592] ccid_usb.c:1917:Multi_ReadProc() Waiting read for reader 0
00000065 [140598069671488] ccid_usb.c:962:ReadUSB() Got 14 bytes for slot 0
00000018 [140598069671488] <
000000 82 05 00 00 00 00 4C 00 00 00 00 00 00 00
```

The reader answer RDR_to_PC_Parameters should contain 15 bytes (same as in the PC_to_RDR_SetParameters command) and should reflect the options set in the PC_to_RDR_SetParameters command.
But the answer is 14 bytes only. The abProtocolDataStructure in the response contains 4 bytes instead of 5. And the 4 bytes are all 0x00.

I guess the reader does not handle the PC_to_RDR_SetParameters and that explains the very slow card/reader communication speed. The bmFindexDindex parameter is not used so, I guess, the speed is using TA1=0x11 instead of 0x96 in my example.

My CCID driver does not check the data in the abProtocolDataStructure of the RDR_to_PC_Parameters so the driver is not complaining. But maybe it should report the error.

Actions #1

Updated by rousseau about 1 year ago

00000004 [140598069671488] ifdhandler.c:872:IFDHSetProtocolParameters() Set speed to 156250 bauds
00000004 [140598069671488] ifdhandler.c:1113:IFDHSetProtocolParameters() Communication timeout: 511181 ms
00000003 [140598069671488] commands.c:2319:SetParameters() length: 5 bytes
00000007 [140598069671488] -> 000000 61 05 00 00 00 00 4C 00 00 00 96 00 00 0A 00 
00000201 [140598069671488] ccid_usb.c:948:ReadUSB() Waiting data for slot 0
00000166 [140598627542592] ccid_usb.c:1949:Multi_ReadProc() Read 14 bytes for slot 0
00000025 [140598627542592] ccid_usb.c:1957:Multi_ReadProc() Signaled reader 0 slot 0
00000006 [140598627542592] ccid_usb.c:1917:Multi_ReadProc() Waiting read for reader 0
00000065 [140598069671488] ccid_usb.c:962:ReadUSB() Got 14 bytes for slot 0
00000018 [140598069671488] <- 000000 82 05 00 00 00 00 4C 00 00 00 00 00 00 00

It is nicer with a correctly formatted log.

Actions #2

Updated by rousseau about 1 year ago

Because of this bug the card-reader communication speed is very low.

For example, to dump a SIM card phone book the time was 5.1 seconds but is now 24,6 seconds.
It is 4.8 times slower!

Actions #3

Updated by rousseau about 1 year ago

The sysmoSIMBANK reader in sysmocom lab now has firmware 0.2.76-9034 and this bug is present.
The problem is easy to reproduce. I don't know if it is easy to fix.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)