mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 23:48:12 +00:00
reset: distinguish between separated call and joined call, mark backup as done only when performed completely
This commit is contained in:
parent
b65068c159
commit
8fa3ce7e14
@ -453,7 +453,7 @@ void fsm_msgBackupDevice(BackupDevice *msg)
|
|||||||
CHECK_INITIALIZED
|
CHECK_INITIALIZED
|
||||||
|
|
||||||
(void)msg;
|
(void)msg;
|
||||||
reset_backup();
|
reset_backup(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsm_msgSignTx(SignTx *msg)
|
void fsm_msgSignTx(SignTx *msg)
|
||||||
|
@ -101,22 +101,19 @@ void reset_entropy(const uint8_t *ext_entropy, uint32_t len)
|
|||||||
fsm_sendSuccess(_("Device successfully initialized"));
|
fsm_sendSuccess(_("Device successfully initialized"));
|
||||||
layoutHome();
|
layoutHome();
|
||||||
} else {
|
} else {
|
||||||
reset_backup();
|
reset_backup(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char current_word[10], current_word_display[11];
|
static char current_word[10], current_word_display[11];
|
||||||
|
|
||||||
void reset_backup(void)
|
// separated == true if called as a separate workflow via BackupMessage
|
||||||
|
void reset_backup(bool separated)
|
||||||
{
|
{
|
||||||
if (!storage_needsBackup()) {
|
if (!storage_needsBackup()) {
|
||||||
fsm_sendFailure(FailureType_Failure_UnexpectedMessage, _("Seed already backed up"));
|
fsm_sendFailure(FailureType_Failure_UnexpectedMessage, _("Seed already backed up"));
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
storage.has_needs_backup = true;
|
|
||||||
storage.needs_backup = false;
|
|
||||||
storage_commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int pass, word_pos, i = 0, j;
|
int pass, word_pos, i = 0, j;
|
||||||
@ -166,14 +163,25 @@ void reset_backup(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!protectButton(ButtonRequestType_ButtonRequest_ConfirmWord, true)) {
|
if (!protectButton(ButtonRequestType_ButtonRequest_ConfirmWord, true)) {
|
||||||
storage_reset();
|
if (!separated) {
|
||||||
|
storage_reset();
|
||||||
|
}
|
||||||
layoutHome();
|
layoutHome();
|
||||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fsm_sendSuccess(_("Seed successfully backed up"));
|
|
||||||
|
storage.has_needs_backup = true;
|
||||||
|
storage.needs_backup = false;
|
||||||
|
storage_commit();
|
||||||
|
|
||||||
|
if (separated) {
|
||||||
|
fsm_sendSuccess(_("Seed successfully backed up"));
|
||||||
|
} else {
|
||||||
|
fsm_sendSuccess(_("Device successfully initialized"));
|
||||||
|
}
|
||||||
layoutHome();
|
layoutHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
void reset_init(bool display_random, uint32_t _strength, bool passphrase_protection, bool pin_protection, const char *language, const char *label, uint32_t u2f_counter, bool skip_backup);
|
void reset_init(bool display_random, uint32_t _strength, bool passphrase_protection, bool pin_protection, const char *language, const char *label, uint32_t u2f_counter, bool skip_backup);
|
||||||
void reset_entropy(const uint8_t *ext_entropy, uint32_t len);
|
void reset_entropy(const uint8_t *ext_entropy, uint32_t len);
|
||||||
void reset_backup(void);
|
void reset_backup(bool separated);
|
||||||
uint32_t reset_get_int_entropy(uint8_t *entropy);
|
uint32_t reset_get_int_entropy(uint8_t *entropy);
|
||||||
const char *reset_get_word(void);
|
const char *reset_get_word(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user