Remove in PIV driver need for aid_file

Remove aid_file and aidfile variables in card-piv.c. These are not needed
as piv_select_aid parses the returned data from a SELECT AID command.

In response to e-mail from X41 group on 6/11/2018.

 On branch x41-piv-2
 Changes to be committed:
	modified:   card-piv.c
This commit is contained in:
Doug Engert 2018-06-12 19:50:31 -05:00 committed by Jakub Jelen
parent d5d15105dd
commit 3e5a9a42c3
1 changed files with 3 additions and 11 deletions

View File

@ -147,7 +147,6 @@ enum {
};
typedef struct piv_private_data {
sc_file_t *aid_file;
int enumtag;
int selected_obj; /* The index into the piv_objects last selected */
int return_only_cert; /* return the cert from the object */
@ -758,10 +757,9 @@ static int piv_select_aid(sc_card_t* card, u8* aid, size_t aidlen, u8* response,
/* find the PIV AID on the card. If card->type already filled in,
* then look for specific AID only
* Assumes that priv may not be present
*/
static int piv_find_aid(sc_card_t * card, sc_file_t *aid_file)
static int piv_find_aid(sc_card_t * card)
{
sc_apdu_t apdu;
u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];
@ -842,8 +840,6 @@ static int piv_find_aid(sc_card_t * card, sc_file_t *aid_file)
if (apdu.resp[0] != 0x6f || apdu.resp[1] > apdu.resplen - 2 )
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_NO_CARD_SUPPORT);
card->ops->process_fci(card, aid_file, apdu.resp+2, apdu.resp[1]);
LOG_FUNC_RETURN(card->ctx, i);
}
@ -2924,7 +2920,6 @@ piv_finish(sc_card_t *card)
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
if (priv) {
sc_file_free(priv->aid_file);
if (priv->w_buf)
free(priv->w_buf);
if (priv->offCardCertURL)
@ -3073,7 +3068,6 @@ static int piv_match_card_continued(sc_card_t *card)
card->type = type;
card->drv_data = priv; /* will free if no match, or pass on to piv_init */
priv->aid_file = sc_file_new();
priv->selected_obj = -1;
priv->pin_preference = 0x80; /* 800-73-3 part 1, table 3 */
priv->logged_in = SC_PIN_STATE_UNKNOWN;
@ -3100,9 +3094,7 @@ static int piv_match_card_continued(sc_card_t *card)
if (i < 0) {
/* Detect by selecting applet */
sc_file_t aidfile;
i = piv_find_aid(card, &aidfile);
i = piv_find_aid(card);
}
if (i >= 0) {
@ -3488,7 +3480,7 @@ piv_pin_cmd(sc_card_t *card, struct sc_pin_cmd_data *data, int *tries_left)
/* if access to applet is know to be reset by other driver we select_aid and try again */
if ( priv->card_issues & CI_OTHER_AID_LOSE_STATE && priv->pin_cmd_verify_sw1 == 0x6DU) {
sc_log(card->ctx, "AID may be lost doing piv_find_aid and retry pin_cmd");
piv_find_aid(card, priv->aid_file); /* return not tested */
piv_find_aid(card);
priv->pin_cmd_verify = 1; /* tell piv_check_sw its a verify to save sw1, sw2 */
r = iso_drv->ops->pin_cmd(card, data, tries_left);