fix(core): propagate SE failure when importing mnemonic - #428
Open
ldpreload wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
store_mnemonic_secret()drops the return value ofconfig.se_import_mnemonic()andconfig.se_import_slip39()in core/src/storage/device.py. The SE layer does report failure:se_set_mnemonic()returns secfalse when the THD89 APDU exchange or MAC check fails, and the modtrezorconfig binding maps that to False. But the result is discarded, soResetDevicestill answersSuccess("Initialized")even when nothing was actually stored. The device then looks uninitialized after reboot, and withno_backupthe seed is just lost.This raises on failure instead, same behavior as the classic firmware (
config_setMnemonicfailure path in firmware-classic1s).Only static analysis, I don't have hardware to force the SE fault, but the discarded return is straightforward.