Changeset View
Changeset View
Standalone View
Standalone View
scd/app-piv.c
Context not available. | |||||
(void)ctrl; | (void)ctrl; | ||||
/* An extra check which should not be necessary because the caller | |||||
* should have made sure that a re-select is only called for | |||||
* appropriate cards. */ | |||||
if (!app->app_local->flags.yubikey) | |||||
return gpg_error (GPG_ERR_NOT_SUPPORTED); | |||||
err = iso7816_select_application (app_get_slot (app), | err = iso7816_select_application (app_get_slot (app), | ||||
piv_aid, sizeof piv_aid, 0x0001); | piv_aid, sizeof piv_aid, 0x0001); | ||||
return err; | return err; | ||||
} | } | ||||
/* Check if AID is the correct one. */ | |||||
static gpg_error_t | |||||
do_check_aid (app_t app, ctrl_t ctrl, const unsigned char *aid, size_t aidlen) | |||||
{ | |||||
if (aidlen >= sizeof piv_aid | |||||
&& memcmp (aid, piv_aid, sizeof piv_aid) == 0) | |||||
return 0; | |||||
return gpg_error (GPG_ERR_WRONG_CARD); | |||||
} | |||||
/* Select the PIV application on the card in SLOT. This function must | /* Select the PIV application on the card in SLOT. This function must | ||||
* be used before any other PIV application functions. */ | * be used before any other PIV application functions. */ | ||||
gpg_error_t | gpg_error_t | ||||
Context not available. | |||||
app->fnc.change_pin = do_change_chv; | app->fnc.change_pin = do_change_chv; | ||||
app->fnc.check_pin = do_check_chv; | app->fnc.check_pin = do_check_chv; | ||||
app->fnc.with_keygrip = do_with_keygrip; | app->fnc.with_keygrip = do_with_keygrip; | ||||
app->fnc.check_aid = do_check_aid; | |||||
leave: | leave: | ||||
xfree (apt); | xfree (apt); | ||||
Context not available. |