1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-10 23:40:58 +00:00

use Failure_PinMismatch where it makes sense (ChangePin, ResetDevice, RecoveryDevice)

This commit is contained in:
Pavol Rusnak 2018-02-20 17:48:19 +01:00
parent 909f158c84
commit fc7189f801
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 6 additions and 3 deletions

View File

@ -155,6 +155,9 @@ void fsm_sendFailure(FailureType code, const char *text)
case FailureType_Failure_NotInitialized: case FailureType_Failure_NotInitialized:
text = _("Device not initialized"); text = _("Device not initialized");
break; break;
case FailureType_Failure_PinMismatch:
text = _("PIN mismatch");
break;
case FailureType_Failure_FirmwareError: case FailureType_Failure_FirmwareError:
text = _("Firmware error"); text = _("Firmware error");
break; break;
@ -366,7 +369,7 @@ void fsm_msgChangePin(ChangePin *msg)
if (protectChangePin()) { if (protectChangePin()) {
fsm_sendSuccess(_("PIN changed")); fsm_sendSuccess(_("PIN changed"));
} else { } else {
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL); fsm_sendFailure(FailureType_Failure_PinMismatch, NULL);
} }
} }
layoutHome(); layoutHome();

View File

@ -415,7 +415,7 @@ void recovery_init(uint32_t _word_count, bool passphrase_protection, bool pin_pr
if (!dry_run) { if (!dry_run) {
if (pin_protection && !protectChangePin()) { if (pin_protection && !protectChangePin()) {
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL); fsm_sendFailure(FailureType_Failure_PinMismatch, NULL);
layoutHome(); layoutHome();
return; return;
} }

View File

@ -60,7 +60,7 @@ void reset_init(bool display_random, uint32_t _strength, bool passphrase_protect
} }
if (pin_protection && !protectChangePin()) { if (pin_protection && !protectChangePin()) {
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL); fsm_sendFailure(FailureType_Failure_PinMismatch, NULL);
layoutHome(); layoutHome();
return; return;
} }