From 3331a7f134f8805e17ba2e6d791800408d5d1ee0 Mon Sep 17 00:00:00 2001 From: Zoltan Kelemen Date: Wed, 1 Jul 2020 09:59:32 +0200 Subject: [PATCH] Fix MF selection APDU to use 0x0c in P2 (no data). The previous value of 0x00 is invalid according to IAS-ECC and resulted in 6A 86 on the Oberthur cards that we tested with. --- src/libopensc/card-iasecc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libopensc/card-iasecc.c b/src/libopensc/card-iasecc.c index 6033837b..e3b5efa5 100644 --- a/src/libopensc/card-iasecc.c +++ b/src/libopensc/card-iasecc.c @@ -275,13 +275,14 @@ iasecc_select_mf(struct sc_card *card, struct sc_file **file_out) sc_format_path("3F00", &path); path.type = SC_PATH_TYPE_FILE_ID; - sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xA4, 0x00, 0x00); + sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xA4, 0x00, 0x0C); apdu.lc = path.len; apdu.data = path.value; apdu.datalen = path.len; apdu.resplen = sizeof(apdu_resp); apdu.resp = apdu_resp; + /* TODO: this might be obsolete now that 0x0c (no data) is default for p2 */ if (card->type == SC_CARD_TYPE_IASECC_MI2) apdu.p2 = 0x04;