diff --git a/firmware/config.c b/firmware/config.c index 980d13058..0ba7ab781 100644 --- a/firmware/config.c +++ b/firmware/config.c @@ -345,9 +345,6 @@ void config_init(void) // TODO Add salt. storage_init(&protectPinUiCallback, (const uint8_t*)"", 0); - // TODO Remove - storage_unlock(1); - uint16_t len = 0; 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); @@ -643,7 +640,7 @@ bool config_setMnemonic(const char *mnemonic) return false; } - if (sectrue != config_set_bool(KEY_INITIALIZED, true)) { + if (!config_set_bool(KEY_INITIALIZED, true)) { storage_delete(KEY_MNEMONIC); return false; } diff --git a/firmware/protect.c b/firmware/protect.c index 423c2fd98..e322c3fe6 100644 --- a/firmware/protect.c +++ b/firmware/protect.c @@ -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; @@ -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); - /* TODO - if (msg_tiny_id == MessageType_MessageType_Initialize) { - protectAbortedByCancel = false; - protectAbortedByInitialize = true; + // Check for Cancel / Initialize. + protectAbortedByCancel = (msg_tiny_id == MessageType_MessageType_Cancel); + protectAbortedByInitialize = (msg_tiny_id == MessageType_MessageType_Initialize); + if (protectAbortedByCancel || protectAbortedByInitialize) { msg_tiny_id = 0xFFFF; usbTiny(0); fsm_sendFailure(FailureType_Failure_PinCancelled, NULL); - return false; + return sectrue; } - */ + + return secfalse; } bool protectPin(bool use_cached) diff --git a/firmware/protect.h b/firmware/protect.h index eaf178276..bcabdac67 100644 --- a/firmware/protect.h +++ b/firmware/protect.h @@ -22,9 +22,10 @@ #include #include "messages-common.pb.h" +#include "secbool.h" 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 protectChangePin(bool removal); bool protectPassphrase(void); diff --git a/vendor/trezor-storage b/vendor/trezor-storage index 6d9a4962a..4429888b9 160000 --- a/vendor/trezor-storage +++ b/vendor/trezor-storage @@ -1 +1 @@ -Subproject commit 6d9a4962a427717100517d59a4dcc1012199f0f5 +Subproject commit 4429888b9325d200b699a90f7a0e1a07d08f09c0