-
-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(legacy): don't erase firmware and storage in intermediate firmware ... #1600
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, best as I can tell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, but I didn't get chance to test it on device.
Switching back to draft - we need to polish the details before merging this one in. |
24859f4
to
044cda4
Compare
legacy/intermediate_fw/trezor.c
Outdated
@@ -67,16 +74,15 @@ erase_firmware_and_storage(void) { | |||
FLASH_KEYR = FLASH_KEYR_KEY1; | |||
FLASH_KEYR = FLASH_KEYR_KEY2; | |||
|
|||
// Erase storage sectors to prevent firmware downgrade to vulnerable version | |||
// Erase storage sectors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the comment - downgrade is already prevented, because the firmware has a whitelist of recognized bootloaders (in check_and_replace_bootloader
below), so it halts before proceeding if an unknown bootloader is found (a bootloader from the future would be unknown).
Open question is - do we event want to delete the storage here? Bootloader will take care of deletion when an unofficial firmware (or a non-firmware) is found during the firmware update. I guess this does not hurt, but probably causes the storage erasure twice (once here and once the bootloader performs a firmware update).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are correct that we don't need to erase the storage here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, addressed in another fixup - b4c7d22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use fixup commits. They make it easier to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
if the storage has been already initialized
b4c7d22
to
b1f5c49
Compare
... if the storage has been already initialized
Possible fix for #1597