Strange USIM response to READ RECORD command

Simon Baatz gmbnomis
Wed Dec 14 16:55:19 PST 2011


Hi,

when trying to get the identity (i.e. the IMSI) for EAP-AKA from the
USIM, the USIM I use here responds in a way which is unexpected by the
scard_get_record_len function in pcsc_funcs.c.

If I read ETSI TS 102 221 correctly, the UICC should respond with '6c
<length>' if the Le is 0 or greater than the real length.
scard_get_record_len sets Le to 255. However, the response is '67
<length>' ( 'incorrect parameter P3'?) and not '6c <length>':

SCARD: scard_transmit: send - hexdump(len=5): 00 b2 01 04 ff
SCARD: scard_transmit: recv - hexdump(len=2): 67 16
SCARD: file length determination response - hexdump(len=2): 67 16

If I change Le to be 0, then the expected answer is returned:

SCARD: scard_transmit: send - hexdump(len=5): 00 b2 01 04 00
SCARD: scard_transmit: recv - hexdump(len=2): 6c 16
SCARD: file length determination response - hexdump(len=2): 6c 16

Thus, the UICC seems to handle the two cases differently. I am not an
expert for UICC/SIM/USIM and thus, I am unsure whether the problem is in
the UICC or the code.
Nevertheless, what is the correct fix/workaround for this? Should we set
Le to zero, or should we also accept '67 <length>' as a response here?

- Simon




More information about the Hostap mailing list