Skip to content

Commit

Permalink
Simplify CardOS 5.0 support (removing explicit 5.3 marker since the b…
Browse files Browse the repository at this point in the history
…ehavior should be the same)
  • Loading branch information
Jakuje committed Apr 7, 2017
1 parent 8f33305 commit 7356ee7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
19 changes: 6 additions & 13 deletions src/libopensc/card-cardos.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static struct sc_atr_table cardos_atrs[] = {
/* CardOS v5.0 */
{ "3b:d2:18:00:81:31:fe:58:c9:01:14", NULL, NULL, SC_CARD_TYPE_CARDOS_V5_0, 0, NULL},
/* CardOS v5.3 */
{ "3b:d2:18:00:81:31:fe:58:c9:03:16", NULL, NULL, SC_CARD_TYPE_CARDOS_V5_3, 0, NULL},
{ "3b:d2:18:00:81:31:fe:58:c9:03:16", NULL, NULL, SC_CARD_TYPE_CARDOS_V5_0, 0, NULL},
{ NULL, NULL, NULL, 0, 0, NULL }
};

Expand All @@ -84,8 +84,6 @@ static int cardos_match_card(sc_card_t *card)
return 1;
if (card->type == SC_CARD_TYPE_CARDOS_V5_0)
return 1;
if (card->type == SC_CARD_TYPE_CARDOS_V5_3)
return 1;
if (card->type == SC_CARD_TYPE_CARDOS_M4_2) {
int rv;
sc_apdu_t apdu;
Expand Down Expand Up @@ -180,7 +178,7 @@ static int cardos_init(sc_card_t *card)
flags = SC_ALGORITHM_RSA_HASH_NONE
| SC_ALGORITHM_ONBOARD_KEY_GEN
;
if (card->type != SC_CARD_TYPE_CARDOS_V5_3)
if (card->type != SC_CARD_TYPE_CARDOS_V5_0)
flags |= SC_ALGORITHM_RSA_RAW
| SC_ALGORITHM_NEED_USAGE;
else
Expand All @@ -201,8 +199,7 @@ static int cardos_init(sc_card_t *card)
|| card->type == SC_CARD_TYPE_CARDOS_M4_2B
|| card->type == SC_CARD_TYPE_CARDOS_M4_2C
|| card->type == SC_CARD_TYPE_CARDOS_M4_4
|| card->type == SC_CARD_TYPE_CARDOS_V5_0
|| card->type == SC_CARD_TYPE_CARDOS_V5_3) {
|| card->type == SC_CARD_TYPE_CARDOS_V5_0) {
rsa_2048 = 1;
card->caps |= SC_CARD_CAP_APDU_EXT;
}
Expand Down Expand Up @@ -237,8 +234,7 @@ static int cardos_init(sc_card_t *card)
_sc_card_add_rsa_alg(card, 2048, flags, 0);
}

if (card->type == SC_CARD_TYPE_CARDOS_V5_0
|| card->type == SC_CARD_TYPE_CARDOS_V5_3) {
if (card->type == SC_CARD_TYPE_CARDOS_V5_0) {
/* Starting with CardOS 5, the card supports PIN query commands */
card->caps |= SC_CARD_CAP_ISO7816_PIN_INFO;
}
Expand Down Expand Up @@ -789,10 +785,8 @@ cardos_set_security_env(sc_card_t *card,
if (card->type == SC_CARD_TYPE_CARDOS_CIE_V1) {
cardos_restore_security_env(card, 0x30);
apdu.p1 = 0xF1;
} else if (card->type == SC_CARD_TYPE_CARDOS_V5_3) {
apdu.p1 = 0x41;
} else {
apdu.p1 = 0x01;
apdu.p1 = 0x41;
}
switch (env->operation) {
case SC_SEC_OPERATION_DECIPHER:
Expand Down Expand Up @@ -1249,8 +1243,7 @@ cardos_logout(sc_card_t *card)
|| card->type == SC_CARD_TYPE_CARDOS_M4_2C
|| card->type == SC_CARD_TYPE_CARDOS_M4_3
|| card->type == SC_CARD_TYPE_CARDOS_M4_4
|| card->type == SC_CARD_TYPE_CARDOS_V5_0
|| card->type == SC_CARD_TYPE_CARDOS_V5_3) {
|| card->type == SC_CARD_TYPE_CARDOS_V5_0) {
sc_apdu_t apdu;
int r;
sc_path_t path;
Expand Down
1 change: 0 additions & 1 deletion src/libopensc/cards.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ enum {
SC_CARD_TYPE_CARDOS_CIE_V1, /* Italian CIE (eID) v1 */
SC_CARD_TYPE_CARDOS_M4_4,
SC_CARD_TYPE_CARDOS_V5_0,
SC_CARD_TYPE_CARDOS_V5_3,

/* flex/cyberflex drivers */
SC_CARD_TYPE_FLEX_BASE = 2000,
Expand Down

0 comments on commit 7356ee7

Please sign in to comment.