Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncomment version check when moving a key #464

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/ykpiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2206,16 +2206,16 @@ static ykpiv_rc _ykpiv_auth_deauthenticate(ykpiv_state *state) {
return res;
}

//static bool check_version(ykpiv_state *state, uint8_t major, uint8_t minor) {
// return state->ver.major > major || (state->ver.major == major && state->ver.minor >= minor);
//}
static bool check_version(ykpiv_state *state, uint8_t major, uint8_t minor) {
return state->ver.major > major || (state->ver.major == major && state->ver.minor >= minor);
}

// if to_slot is set to 0xff, the key will be deleted
ykpiv_rc ykpiv_move_key(ykpiv_state *state, const unsigned char from_slot, const unsigned char to_slot) {
// if(!check_version(state, 5, 7)) {
// DBG("Move key operation available with firmware version 5.7.0 or higher");
// return YKPIV_NOT_SUPPORTED;
// }
if(!check_version(state, 5, 7)) {
DBG("Move key operation available with firmware version 5.7.0 or higher");
return YKPIV_NOT_SUPPORTED;
}
ykpiv_rc res = YKPIV_OK;
unsigned char data[256] = {0};
unsigned long recv_len = sizeof(data);
Expand Down
Loading