IASECC/CPX: fix APDU errors for SE get data

On a CPX, this object needs to be read from 3F00.

For instance:

$ opensc-explorer -r 2

OpenSC [3F00]> cd 0002
OpenSC [3F00/0002]> apdu 00 CB 3F FF 0A 4D 08 70 06 BF FB 05 02 7B 80
Sending: 00 CB 3F FF 0A 4D 08 70 06 BF FB 05 02 7B 80
Received (SW1=0x6A, SW2=0x88)
Failure: Data object not found

OpenSC [3F00/0002]> apdu 00 A4 09 04 02 3F 00
Sending: 00 A4 09 04 02 3F 00
Received (SW1=0x90, SW2=0x00)
Success!

OpenSC [3F00/0002]> apdu 00 CB 3F FF 0A 4D 08 70 06 BF FB 05 02 7B 80
Sending: 00 CB 3F FF 0A 4D 08 70 06 BF FB 05 02 7B 80
Received (SW1=0x90, SW2=0x00)
Success!

Currently, this patch limits to the CPX cards since I cannot know
the behaviour for the other cards. I could not find any reference
from the standard.

Fix: issue #2275
This commit is contained in:
Vincent JARDIN 2021-03-29 16:45:07 +00:00 committed by Frank Morgner
parent 405ecfc402
commit fcd2e665fe
1 changed files with 5 additions and 0 deletions

View File

@ -1714,6 +1714,11 @@ iasecc_se_get_info(struct sc_card *card, struct iasecc_se_info *se)
LOG_FUNC_CALLED(ctx);
if (iasecc_is_cpx(card)) {
rv = iasecc_select_mf(card, NULL);
LOG_TEST_RET(ctx, rv, "MF invalid");
}
if (se->reference > IASECC_SE_REF_MAX)
LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS);