mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-20 15:08:46 +00:00
partially revert 4ce4cc5605
for smoother merge
This commit is contained in:
parent
a5e2fd9a55
commit
14aa486fa6
@ -135,36 +135,27 @@ void recovery_word(const char *word)
|
|||||||
strlcpy(words[word_pos - 1], word, sizeof(words[word_pos - 1]));
|
strlcpy(words[word_pos - 1], word, sizeof(words[word_pos - 1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (word_index + 1 < 24) { // not the last one
|
if (word_index + 1 == 24) { // last one
|
||||||
word_index++;
|
uint32_t i;
|
||||||
next_word();
|
strlcpy(storage.mnemonic, words[0], sizeof(storage.mnemonic));
|
||||||
return;
|
for (i = 1; i < word_count; i++) {
|
||||||
}
|
strlcat(storage.mnemonic, " ", sizeof(storage.mnemonic));
|
||||||
|
strlcat(storage.mnemonic, words[i], sizeof(storage.mnemonic));
|
||||||
// the last one
|
}
|
||||||
strlcpy(storage.mnemonic, words[0], sizeof(storage.mnemonic));
|
if (!enforce_wordlist || mnemonic_check(storage.mnemonic)) {
|
||||||
for (uint32_t i = 1; i < word_count; i++) {
|
storage.has_mnemonic = true;
|
||||||
strlcat(storage.mnemonic, " ", sizeof(storage.mnemonic));
|
storage_commit();
|
||||||
strlcat(storage.mnemonic, words[i], sizeof(storage.mnemonic));
|
fsm_sendSuccess("Device recovered");
|
||||||
}
|
} else {
|
||||||
|
|
||||||
awaiting_word = false;
|
|
||||||
layoutHome();
|
|
||||||
|
|
||||||
if (!mnemonic_check(storage.mnemonic)) {
|
|
||||||
if (enforce_wordlist) {
|
|
||||||
storage_reset();
|
storage_reset();
|
||||||
fsm_sendFailure(FailureType_Failure_SyntaxError, "Invalid mnemonic, are words in correct order?");
|
fsm_sendFailure(FailureType_Failure_SyntaxError, "Invalid mnemonic, are words in correct order?");
|
||||||
return;
|
|
||||||
} else { // not enforcing => mark storage as imported
|
|
||||||
storage.has_imported = true;
|
|
||||||
storage.imported = true;
|
|
||||||
}
|
}
|
||||||
|
awaiting_word = false;
|
||||||
|
layoutHome();
|
||||||
|
} else {
|
||||||
|
word_index++;
|
||||||
|
next_word();
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.has_mnemonic = true;
|
|
||||||
storage_commit();
|
|
||||||
fsm_sendSuccess("Device recovered");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void recovery_abort(void)
|
void recovery_abort(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user