mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 03:18:09 +00:00
protect: check old PIN before requesting new PIN
This commit is contained in:
parent
ae0395f0f4
commit
2482e11112
@ -225,6 +225,18 @@ bool protectChangePin(bool removal)
|
|||||||
fsm_sendFailure(FailureType_Failure_PinCancelled, NULL);
|
fsm_sendFailure(FailureType_Failure_PinCancelled, NULL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If removing, defer the check to config_changePin().
|
||||||
|
if (!removal) {
|
||||||
|
usbTiny(1);
|
||||||
|
bool ret = config_containsPin(pin);
|
||||||
|
usbTiny(0);
|
||||||
|
if (ret == false) {
|
||||||
|
fsm_sendFailure(FailureType_Failure_PinInvalid, NULL);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
strlcpy(old_pin, pin, sizeof(old_pin));
|
strlcpy(old_pin, pin, sizeof(old_pin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user