IASECC/CPX: file selection and app enumeration

Thanks to this commit, we get the full support of:
  - ./opensc-explore
    cd 0001
    asn1 2F00
  - ./pkcs11-tool -O
  - etc.
This commit is contained in:
Vincent JARDIN 2021-02-01 21:10:23 +00:00 committed by Frank Morgner
parent acb8822444
commit 560692221b
1 changed files with 23 additions and 2 deletions

View File

@ -608,6 +608,19 @@ iasecc_init_amos_or_sagem(struct sc_card *card)
}
static int
iasecc_init_cpx(struct sc_card *card)
{
struct sc_context *ctx = card->ctx;
LOG_FUNC_CALLED(ctx);
LOG_TEST_RET(ctx, sc_enum_apps(card), "Enumerate apps failed");
LOG_FUNC_RETURN(ctx, SC_SUCCESS);
}
static int
iasecc_init(struct sc_card *card)
{
@ -634,6 +647,10 @@ iasecc_init(struct sc_card *card)
rv = iasecc_init_amos_or_sagem(card);
else if (card->type == SC_CARD_TYPE_IASECC_MI)
rv = iasecc_init_amos_or_sagem(card);
else if (card->type == SC_CARD_TYPE_IASECC_CPX)
rv = iasecc_init_cpx(card);
else if (card->type == SC_CARD_TYPE_IASECC_CPXCL)
rv = iasecc_init_cpx(card);
else {
LOG_TEST_GOTO_ERR(ctx, SC_ERROR_INVALID_CARD, "");
}
@ -956,7 +973,9 @@ iasecc_select_file(struct sc_card *card, const struct sc_path *path,
&& card->type != SC_CARD_TYPE_IASECC_SAGEM
&& card->type != SC_CARD_TYPE_IASECC_AMOS
&& card->type != SC_CARD_TYPE_IASECC_MI
&& card->type != SC_CARD_TYPE_IASECC_MI2) {
&& card->type != SC_CARD_TYPE_IASECC_MI2
&& card->type != SC_CARD_TYPE_IASECC_CPX
&& card->type != SC_CARD_TYPE_IASECC_CPXCL) {
rv = SC_ERROR_NOT_SUPPORTED;
LOG_TEST_GOTO_ERR(ctx, rv, "Unsupported card");
}
@ -977,7 +996,9 @@ iasecc_select_file(struct sc_card *card, const struct sc_path *path,
if (card->type == SC_CARD_TYPE_IASECC_OBERTHUR ||
card->type == SC_CARD_TYPE_IASECC_AMOS ||
card->type == SC_CARD_TYPE_IASECC_MI ||
card->type == SC_CARD_TYPE_IASECC_MI2) {
card->type == SC_CARD_TYPE_IASECC_MI2 ||
card->type == SC_CARD_TYPE_IASECC_CPX ||
card->type == SC_CARD_TYPE_IASECC_CPXCL) {
apdu.p2 = 0x04;
}
}