Douglas E. Engert wrote:

The attached change to card-piv.c is need to recognize a
valid PIV card applet. All of the previous test cards would
return in response to a SELECT the full AID where as they
should have returned the the PIX portion of the AID. The newest
test cards are now doing this correctly.

This change will recognize either as a PIV applet.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2885 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aj 2006-04-11 20:50:13 +00:00
parent 435d8ac62b
commit 0222683058
1 changed files with 10 additions and 2 deletions

View File

@ -440,10 +440,12 @@ static int piv_find_aid(sc_card_t * card, sc_file_t *aid_file)
if (pix != NULL ) {
sc_debug(card->ctx,"found PIX");
/* early cards returned full AID, rather then just the pix */
for (i = 0; piv_aids[i].len_short != 0; i++) {
if (pixlen >= piv_aids[i].len_short &&
if ((pixlen >= 6 && memcmp(pix, piv_aids[i].value + 5, 6) == 0)
|| ((pixlen >= piv_aids[i].len_short &&
memcmp(pix, piv_aids[i].value,
piv_aids[i].len_short) == 0) {
piv_aids[i].len_short) == 0))) {
if (card->type > SC_CARD_TYPE_PIV_II_BASE &&
card->type < SC_CARD_TYPE_PIV_II_BASE+1000 &&
card->type == piv_aids[i].enumtag) {
@ -637,6 +639,11 @@ static int piv_read_binary(sc_card_t *card, unsigned int idx,
r = piv_get_data(card, priv->selected_obj, &rbuf, &rbuflen);
if (r >=0) {
/* if tag is 0, assume card is telling us no object on card */
if (rbuf[0] == '0') {
r = SC_ERROR_FILE_NOT_FOUND;
goto err;
}
sc_debug(card->ctx, "DEE rbuf=%p,rbuflen=%d,",rbuf, rbuflen);
body = (u8 *) sc_asn1_find_tag(card->ctx, rbuf, rbuflen, 0x53, &bodylen);
if (body == NULL) {
@ -680,6 +687,7 @@ static int piv_read_binary(sc_card_t *card, unsigned int idx,
break;
}
}
err:
if (rbuf)
free(rbuf);
SC_FUNC_RETURN(card->ctx, 1, r);