1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-27 10:22:34 +00:00

Support interruption of the PIN wait dialog by Cancel and Initialize messages.

This commit is contained in:
andrew 2019-02-06 19:01:06 +01:00 committed by Pavol Rusnak
parent e49e84ea5a
commit 03e9ea4f5c
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 12 additions and 13 deletions

View File

@ -345,9 +345,6 @@ void config_init(void)
// TODO Add salt. // TODO Add salt.
storage_init(&protectPinUiCallback, (const uint8_t*)"", 0); storage_init(&protectPinUiCallback, (const uint8_t*)"", 0);
// TODO Remove
storage_unlock(1);
uint16_t len = 0; uint16_t len = 0;
if (sectrue == storage_get(KEY_UUID, config_uuid, sizeof(config_uuid), &len) && len == sizeof(config_uuid)) { if (sectrue == storage_get(KEY_UUID, config_uuid, sizeof(config_uuid), &len) && len == sizeof(config_uuid)) {
data2hex(config_uuid, sizeof(config_uuid), config_uuid_str); data2hex(config_uuid, sizeof(config_uuid), config_uuid_str);
@ -643,7 +640,7 @@ bool config_setMnemonic(const char *mnemonic)
return false; return false;
} }
if (sectrue != config_set_bool(KEY_INITIALIZED, true)) { if (!config_set_bool(KEY_INITIALIZED, true)) {
storage_delete(KEY_MNEMONIC); storage_delete(KEY_MNEMONIC);
return false; return false;
} }

View File

@ -147,7 +147,7 @@ const char *requestPin(PinMatrixRequestType type, const char *text)
} }
} }
void protectPinUiCallback(uint32_t wait, uint32_t progress) secbool protectPinUiCallback(uint32_t wait, uint32_t progress)
{ {
(void) progress; (void) progress;
@ -166,16 +166,17 @@ void protectPinUiCallback(uint32_t wait, uint32_t progress)
} }
layoutDialog(&bmp_icon_info, NULL, NULL, NULL, _("Wrong PIN entered"), NULL, _("Please wait"), secstr, _("to continue ..."), NULL); layoutDialog(&bmp_icon_info, NULL, NULL, NULL, _("Wrong PIN entered"), NULL, _("Please wait"), secstr, _("to continue ..."), NULL);
/* TODO // Check for Cancel / Initialize.
if (msg_tiny_id == MessageType_MessageType_Initialize) { protectAbortedByCancel = (msg_tiny_id == MessageType_MessageType_Cancel);
protectAbortedByCancel = false; protectAbortedByInitialize = (msg_tiny_id == MessageType_MessageType_Initialize);
protectAbortedByInitialize = true; if (protectAbortedByCancel || protectAbortedByInitialize) {
msg_tiny_id = 0xFFFF; msg_tiny_id = 0xFFFF;
usbTiny(0); usbTiny(0);
fsm_sendFailure(FailureType_Failure_PinCancelled, NULL); fsm_sendFailure(FailureType_Failure_PinCancelled, NULL);
return false; return sectrue;
} }
*/
return secfalse;
} }
bool protectPin(bool use_cached) bool protectPin(bool use_cached)

View File

@ -22,9 +22,10 @@
#include <stdbool.h> #include <stdbool.h>
#include "messages-common.pb.h" #include "messages-common.pb.h"
#include "secbool.h"
bool protectButton(ButtonRequestType type, bool confirm_only); bool protectButton(ButtonRequestType type, bool confirm_only);
void protectPinUiCallback(uint32_t wait, uint32_t progress); secbool protectPinUiCallback(uint32_t wait, uint32_t progress);
bool protectPin(bool use_cached); bool protectPin(bool use_cached);
bool protectChangePin(bool removal); bool protectChangePin(bool removal);
bool protectPassphrase(void); bool protectPassphrase(void);

@ -1 +1 @@
Subproject commit 6d9a4962a427717100517d59a4dcc1012199f0f5 Subproject commit 4429888b9325d200b699a90f7a0e1a07d08f09c0