diff --git a/src/libopensc/card-cardos.c b/src/libopensc/card-cardos.c index 3e8438bb..555eabe9 100644 --- a/src/libopensc/card-cardos.c +++ b/src/libopensc/card-cardos.c @@ -52,6 +52,8 @@ static struct sc_atr_table cardos_atrs[] = { { "3b:f4:98:00:ff:c1:10:31:fe:55:4d:34:63:76:b4", NULL, NULL, SC_CARD_TYPE_CARDOS_GENERIC, 0, NULL}, /* cardos m4.2 and above */ { "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 }, + /* CardOS 4.4 */ + { "3b:d2:18:02:c1:0a:31:fe:58:c8:0d:51", NULL, NULL, SC_CARD_TYPE_CARDOS_M4_4, 0, NULL}, { NULL, NULL, NULL, 0, 0, NULL } }; @@ -65,6 +67,8 @@ static int cardos_match_card(sc_card_t *card) /* Do not change card type for CIE! */ if (card->type == SC_CARD_TYPE_CARDOS_CIE_V1) return 1; + if (card->type == SC_CARD_TYPE_CARDOS_M4_4) + return 1; if (card->type == SC_CARD_TYPE_CARDOS_M4_2) { int rv; sc_apdu_t apdu; @@ -171,7 +175,8 @@ static int cardos_init(sc_card_t *card) card->caps |= SC_CARD_CAP_APDU_EXT; } else if (card->type == SC_CARD_TYPE_CARDOS_M4_3 || card->type == SC_CARD_TYPE_CARDOS_M4_2B - || card->type == SC_CARD_TYPE_CARDOS_M4_2C) { + || card->type == SC_CARD_TYPE_CARDOS_M4_2C + || card->type == SC_CARD_TYPE_CARDOS_M4_4) { card->caps |= SC_CARD_CAP_RSA_2048; card->caps |= SC_CARD_CAP_APDU_EXT; } @@ -650,7 +655,8 @@ static int cardos_create_file(sc_card_t *card, sc_file_t *file) } else if (card->type == SC_CARD_TYPE_CARDOS_M4_2 || card->type == SC_CARD_TYPE_CARDOS_M4_3 || card->type == SC_CARD_TYPE_CARDOS_M4_2B || - card->type == SC_CARD_TYPE_CARDOS_M4_2C) { + card->type == SC_CARD_TYPE_CARDOS_M4_2C || + card->type == SC_CARD_TYPE_CARDOS_M4_4) { u8 sbuf[SC_MAX_APDU_BUFFER_SIZE]; size_t len = sizeof(sbuf); sc_apdu_t apdu; diff --git a/src/libopensc/cards.h b/src/libopensc/cards.h index 937b18ff..12627b33 100644 --- a/src/libopensc/cards.h +++ b/src/libopensc/cards.h @@ -45,6 +45,7 @@ enum { SC_CARD_TYPE_CARDOS_M4_2B, /* 4.2b is after 4.3b */ SC_CARD_TYPE_CARDOS_M4_2C, SC_CARD_TYPE_CARDOS_CIE_V1, /* Italian CIE (eID) v1 */ + SC_CARD_TYPE_CARDOS_M4_4, /* flex/cyberflex drivers */ SC_CARD_TYPE_FLEX_BASE = 2000, diff --git a/src/pkcs15init/pkcs15-cardos.c b/src/pkcs15init/pkcs15-cardos.c index 97e1df4c..0b4aa6ae 100644 --- a/src/pkcs15init/pkcs15-cardos.c +++ b/src/pkcs15init/pkcs15-cardos.c @@ -648,7 +648,7 @@ cardos_put_key(sc_profile_t *profile, struct sc_pkcs15_card *p15card, key_id = key_info->key_reference; if (key_info->modulus_length > 1024 && (card->type == SC_CARD_TYPE_CARDOS_M4_2 || card->type == SC_CARD_TYPE_CARDOS_M4_3 ||card->type == SC_CARD_TYPE_CARDOS_M4_2B || - card->type == SC_CARD_TYPE_CARDOS_M4_2C )) { + card->type == SC_CARD_TYPE_CARDOS_M4_2C ||card->type == SC_CARD_TYPE_CARDOS_M4_4)) { r = cardos_store_key_component(card, algorithm, key_id, pin_id, 0, key->p.data, key->p.len, 0, 0); if (r != SC_SUCCESS) diff --git a/src/tools/cardos-tool.c b/src/tools/cardos-tool.c index a455aba9..50cd2cd3 100644 --- a/src/tools/cardos-tool.c +++ b/src/tools/cardos-tool.c @@ -170,6 +170,8 @@ static int cardos_info(void) printf(" (that's CardOS M4.2B)\n"); } else if (apdu.resp[0] == 0xc8 && apdu.resp[1] == 0x0B) { printf(" (that's CardOS M4.2C)\n"); + } else if (apdu.resp[0] == 0xc8 && apdu.resp[1] == 0x0D) { + printf(" (that's CardOS M4.4)\n"); } else { printf(" (unknown Version)\n"); } @@ -555,8 +557,9 @@ static int cardos_format(const char *opt_startkey) } if ((rbuf[0] != 0xc8 || rbuf[1] != 0x09) && /* M4.2B */ (rbuf[0] != 0xc8 || rbuf[1] != 0x08) && /* M4.3B */ - (rbuf[0] != 0xc8 || rbuf[1] != 0x0B)) { /* M4.2C */ - printf("currently only CardOS M4.2B, M4.2C and M4.3B are supported, aborting\n"); + (rbuf[0] != 0xc8 || rbuf[1] != 0x0B) && /* M4.2C */ + (rbuf[0] != 0xc8 || rbuf[1] != 0x0D)) { /* M4.4 */ + printf("currently only CardOS M4.2B, M4.2C, M4.3B and M4.4 are supported, aborting\n"); return 1; }