boot: zephyr: support encrypted images over USB DFU on a single slot - #2750
boot: zephyr: support encrypted images over USB DFU on a single slot#2750benner wants to merge 1 commit into
Conversation
|
Tested on |
nordicjm
left a comment
There was a problem hiding this comment.
this doesn't look like the right place? It should decrypt after the image has been received, not after the board is rebooted
4a14868 to
8ac7cd3
Compare
With a single application slot MCUboot jumps directly to the primary slot, so an encrypted image from USB DFU (which, unlike serial recovery, has no decrypt-on-upload) is never decrypted and faults. Decrypt during validation: if the primary slot fails validation while still flagged encrypted, decrypt in place via boot_handle_enc_fw() and revalidate; an already-decrypted slot passes and is not decrypted again. This happens on the same boot, right after wait_for_usb_dfu() returns, so no reboot is needed. Relax the BOOT_ENCRYPT_IMAGE single-slot dependency for USB DFU, which requires slot validation since that gates the decrypt, and build boot_serial_encryption.c. Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
8ac7cd3 to
4a933a5
Compare
|
I tried the post- On the "decrypt after reboot" point — that was a leftover reference in the commit/PR message from earlier work, not part of this PR. Moving the decrypt out of (A clean "image received" signal would need exposing it from Zephyr; the legacy USB stack has none and is deprecated, the new stack does, so mcuboot would need porting there first.) |
That is a good point, does the new stack have such a callback? Because nothing should be using the legacy stack anymore, someone needs to port MCUboot to use the new stack |
Yes — the new USB device stack's DFU class publishes
Agreed. Once I'm unblocked on the rest of this DFU work, I'm happy to look into the migration. |
With a single application slot MCUboot jumps directly to the primary
slot, so an encrypted image from USB DFU (which, unlike serial recovery,
has no decrypt-on-upload) is never decrypted and faults.
Decrypt during validation: if the primary slot fails validation while
still flagged encrypted, decrypt in place via boot_handle_enc_fw() and
revalidate; an already-decrypted slot passes and is not decrypted again.
This happens on the same boot, right after wait_for_usb_dfu() returns,
so no reboot is needed. Relax the BOOT_ENCRYPT_IMAGE single-slot
dependency for USB DFU, which requires slot validation since that gates
the decrypt, and build boot_serial_encryption.c.