Ticket #187: opensc.patch
| File opensc.patch, 2.7 KB (added by arnout, 3 years ago) |
|---|
-
src/libopensc/card-cardos.c
50 50 { "3b:f4:98:00:ff:c1:10:31:fe:55:4d:34:63:76:b4", NULL, NULL, SC_CARD_TYPE_CARDOS_GENERIC, 0, NULL}, 51 51 /* cardos m4.2 and above */ 52 52 { "3b:f2:18:00:ff:c1:0a:31:fe:55:c8:06:8a", "ff:ff:0f:ff:00:ff:00:ff:ff:00:00:00:00", NULL, SC_CARD_TYPE_CARDOS_M4_2, 0, NULL }, 53 { "3b:f4:18:00:02:c1:0a:31:fe:58:56:34:63:76:c5", "ff:ff:0f:ff:00:ff:00:ff:ff:00:00:00:00:00:00", NULL, SC_CARD_TYPE_CARDOS_M4_2, 0, NULL }, 53 54 { NULL, NULL, NULL, 0, 0, NULL } 54 55 }; 55 56 … … 86 87 SC_TEST_RET(card->ctx, rv, "APDU transmit failed"); 87 88 if (apdu.sw1 != 0x90 || apdu.sw2 != 0x00) 88 89 return 0; 89 if (apdu.resp[0] != card->atr[10] || 90 apdu.resp[1] != card->atr[11]) 90 if (apdu.resp[0] != 0xC8) 91 91 /* version mismatch */ 92 92 return 0; 93 if ( card->atr[11] <= 0x04) {94 sc_debug(card->ctx, "found cardos m4.01");93 if (apdu.resp[1] <= 0x04) { 94 sc_debug(card->ctx, "found cardos M4.01"); 95 95 card->type = SC_CARD_TYPE_CARDOS_M4_01; 96 } else if (card->atr[11] == 0x08) { 97 sc_debug(card->ctx, "found cardos v4.3b"); 96 } else if (apdu.resp[1] == 0x06) { 97 sc_debug(card->ctx, "found cardos M4.2"); 98 card->type = SC_CARD_TYPE_CARDOS_M4_2; 99 } else if (apdu.resp[1] == 0x07) { 100 sc_debug(card->ctx, "found cardos M4.3"); 98 101 card->type = SC_CARD_TYPE_CARDOS_M4_3; 99 } else if (card->atr[11] == 0x09) { 100 sc_debug(card->ctx, "found cardos v4.2b"); 102 } else if (apdu.resp[1] == 0x08) { 103 sc_debug(card->ctx, "found cardos M4.3b"); 104 card->type = SC_CARD_TYPE_CARDOS_M4_3; 105 } else if (apdu.resp[1] == 0x09) { 106 sc_debug(card->ctx, "found cardos M4.2b"); 101 107 card->type = SC_CARD_TYPE_CARDOS_M4_2B; 102 } else if (card->atr[11] >= 0x0B) {103 sc_debug(card->ctx, "found cardos v4.2c or higher");104 card->type = SC_CARD_TYPE_CARDOS_M4_2C;108 } else if (apdu.resp[1] >= 0x0B) { 109 sc_debug(card->ctx, "found cardos M4.2c or higher"); 110 card->type = SC_CARD_TYPE_CARDOS_M4_2C; 105 111 } else { 106 sc_debug(card->ctx, "found cardos m4.2"); 112 sc_debug(card->ctx, "Unknown cardos version."); 113 card->type = SC_CARD_TYPE_CARDOS_GENERIC; 107 114 } 108 115 } 109 116 return 1; … … 1105 1112 /* FIXME: the following values depend on what pin length was 1106 1113 * used when creating the BS objects */ 1107 1114 if (data->pin1.max_length == 0) 1108 data->pin1.max_length = 8;1115 data->pin1.max_length = 10; 1109 1116 if (data->pin2.max_length == 0) 1110 data->pin2.max_length = 8;1117 data->pin2.max_length = 10; 1111 1118 return iso_ops->pin_cmd(card, data, tries_left); 1112 1119 } 1113 1120
