mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-17 09:28:05 +00:00
Adding check for device options whether it can reset retry counter with PIN or without.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
b1121718db
commit
85ff92c4de
1 changed files with 5 additions and 0 deletions
|
|
@ -478,6 +478,7 @@ static int cmd_verify() {
|
|||
}
|
||||
|
||||
static int cmd_reset_retry() {
|
||||
uint16_t opts = get_device_options();
|
||||
if (P1(apdu) == 0x0) {
|
||||
if (P2(apdu) == 0x81) {
|
||||
if (!file_sopin || !file_pin1) {
|
||||
|
|
@ -488,6 +489,8 @@ static int cmd_reset_retry() {
|
|||
}
|
||||
if (apdu.cmd_apdu_data_len <= 8)
|
||||
return SW_WRONG_LENGTH();
|
||||
if (!(opts & HSM_OPT_RRC))
|
||||
return SW_COMMAND_NOT_ALLOWED();
|
||||
uint16_t r = check_pin(file_sopin, apdu.cmd_apdu_data, 8);
|
||||
if (r != 0x9000)
|
||||
return r;
|
||||
|
|
@ -513,6 +516,8 @@ static int cmd_reset_retry() {
|
|||
}
|
||||
if (apdu.cmd_apdu_data_len != 8)
|
||||
return SW_WRONG_LENGTH();
|
||||
if (!(opts & HSM_OPT_RRC) || !(opts & HSM_OPT_RRC_RESET_ONLY))
|
||||
return SW_COMMAND_NOT_ALLOWED();
|
||||
uint16_t r = check_pin(file_sopin, apdu.cmd_apdu_data, 8);
|
||||
if (r != 0x9000)
|
||||
return r;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue