1
0
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:
Andrew Kozlik 2019-02-23 02:00:16 +01:00 committed by Pavol Rusnak
parent ae0395f0f4
commit 2482e11112
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -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));
} }