yubico-piv-tool: use ykpiv_util_reset()
This commit is contained in:
+2
-13
@@ -253,18 +253,7 @@ generate_out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool reset(ykpiv_state *state) {
|
static bool reset(ykpiv_state *state) {
|
||||||
unsigned char templ[] = {0, YKPIV_INS_RESET, 0, 0};
|
return ykpiv_util_reset(state) == YKPIV_OK;
|
||||||
unsigned char data[0xff];
|
|
||||||
unsigned long recv_len = sizeof(data);
|
|
||||||
int sw;
|
|
||||||
|
|
||||||
/* note: the reset function is only available when both pins are blocked. */
|
|
||||||
if(ykpiv_transfer_data(state, templ, NULL, 0, data, &recv_len, &sw) != YKPIV_OK) {
|
|
||||||
return false;
|
|
||||||
} else if(sw == SW_SUCCESS) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool set_pin_retries(ykpiv_state *state, int pin_retries, int puk_retries, int verbose) {
|
static bool set_pin_retries(ykpiv_state *state, int pin_retries, int puk_retries, int verbose) {
|
||||||
@@ -2000,7 +1989,7 @@ int main(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
case action_arg_reset:
|
case action_arg_reset:
|
||||||
if(reset(state) == false) {
|
if(reset(state) == false) {
|
||||||
fprintf(stderr, "Reset failed, are pincodes blocked?\n");
|
fprintf(stderr, "Reset failed, are pincodes blocked?\n");
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Successfully reset the application.\n");
|
fprintf(stderr, "Successfully reset the application.\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user