You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Smartcard-HSM installed into a token with an ATR unknown to OpenSC should be possible. Card recognition should be based on Applet selection instead of ATR restrictions.
Actual behaviour
OpenSC limits Smartcard HSMs to the following ATRs, because it leaves card->type uninitialized:
/* Known ATRs for SmartCard-HSMs */
static struct sc_atr_table sc_hsm_atrs[] = {
/* standard version */
{"3B:FE:18:00:00:81:31:FE:45:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:FA", NULL, NULL, SC_CARD_TYPE_SC_HSM, 0, NULL},
{"3B:8E:80:01:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:18", NULL, NULL, SC_CARD_TYPE_SC_HSM, 0, NULL},
{NULL, NULL, NULL, 0, 0, NULL}
};
/* Known ATRs for JavaCards that qualify for SmartCard-HSMs */
static struct sc_atr_table sc_hsm_jc_atrs[] = {
/* standard version */
{"3b:f8:13:00:00:81:31:fe:45:4a:43:4f:50:76:32:34:31:b7", NULL, NULL, SC_CARD_TYPE_SC_HSM, 0, NULL}, // JCOP 2.4.1 Default ATR contact based
{"3b:88:80:01:4a:43:4f:50:76:32:34:31:5e", NULL, NULL, SC_CARD_TYPE_SC_HSM, 0, NULL}, // JCOP 2.4.1 Default ATR contactless
{NULL, NULL, NULL, 0, 0, NULL}
};
...
static int sc_hsm_match_card(struct sc_card *card)
{
sc_path_t path;
int i, r;
i = _sc_match_atr(card, sc_hsm_atrs, &card->type);
if (i >= 0)
return 1;
i = _sc_match_atr(card, sc_hsm_jc_atrs, &card->type);
if (i < 0)
return 0;
This limitation is present at least since 0.16.0. When forcing the card driver in 0.16.0 for a non-builtin ATR, initialization of the sc-hsm PKCS#15 emulator fails.
The text was updated successfully, but these errors were encountered:
- don't use private data on card matching
- instead, return 1 for every known ATR and only select the applet if the ATR is unknown.
- card initialization always selects the applet.
Advantage: decouples memeory management in matching from initializing the card.
Disadvantage: Applet is selected twice in case of an unknown ATR (once for matching and a second time for initializing the card).
FixesOpenSC#1042
Expected behaviour
A Smartcard-HSM installed into a token with an ATR unknown to OpenSC should be possible. Card recognition should be based on Applet selection instead of ATR restrictions.
Actual behaviour
OpenSC limits Smartcard HSMs to the following ATRs, because it leaves
card->type
uninitialized:...
This limitation is present at least since 0.16.0. When forcing the card driver in 0.16.0 for a non-builtin ATR, initialization of the sc-hsm PKCS#15 emulator fails.
The text was updated successfully, but these errors were encountered: