From ccf9d01027fbb4231581ebcf3d343f432324155d Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Wed, 29 Oct 2014 08:09:17 +0100 Subject: [PATCH] fix broken unblock-pin action the unblock pin action misstakenly used pin reference 0x81 (unblock) instead of 0x80 (pin) --- tool/yubico-piv-tool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tool/yubico-piv-tool.c b/tool/yubico-piv-tool.c index 6c9b62e..9786afc 100644 --- a/tool/yubico-piv-tool.c +++ b/tool/yubico-piv-tool.c @@ -883,7 +883,7 @@ static bool verify_pin(ykpiv_state *state, const char *pin) { * since they're very similar in what data they use. */ static bool change_pin(ykpiv_state *state, enum enum_action action, const char *pin, const char *new_pin) { - unsigned char templ[] = {0, YKPIV_INS_CHANGE_REFERENCE, 0, 0x81}; + unsigned char templ[] = {0, YKPIV_INS_CHANGE_REFERENCE, 0, 0x80}; unsigned char indata[0x10]; unsigned char data[0xff]; unsigned long recv_len = sizeof(data); @@ -899,8 +899,8 @@ static bool change_pin(ykpiv_state *state, enum enum_action action, const char * if(action == action_arg_unblockMINUS_pin) { templ[1] = YKPIV_INS_RESET_RETRY; } - else if(action == action_arg_changeMINUS_pin) { - templ[3] = 0x80; + else if(action == action_arg_changeMINUS_puk) { + templ[3] = 0x81; } memcpy(indata, pin, pin_len); if(pin_len < 8) {