2025-03-26 9:32 AM
Hi,
We are using an STM32U585 with the application running from external flash, on an octospi bus. We are also using external SRAM. The external memory architecture on our board is heavily influenced by the B-U585I-IOT02A design (same ports, slightly different parts used).
We have successfully experimented with the SBSFU solution here and we have a couple of questions:
Thanks,
RJH
2025-03-27 4:01 AM
Hi @rjh ,
I may not be able to answer all the questions, but here is my contribution:
1) The SBSFU is based on the Arm TF-M solution, so whatever you cannot find in the ST documentation will most probably be described in Arm TF-M documentation. The image integrity is checked by default on boot, in function bootutil_img_validate(). The MCUBOOT_USE_HASH_REF offers accelerated boot thanks to image SHA256 reference management. Image verification mainly consists of verifying the SHA256 of the image (integrity check) and then verifying the signature of this SHA256 (authentication check). If successful, the SHA256 is stored as a reference for the next boot. At the next boot, the signature verification is skipped if the SHA256 of the image matches the reference stored.
2) Yes, it's possible.
3) The problem with OTFDEC is that it only offers decryption acceleration. You'd have to manage the encryption yourself, or leave the external memory image in plain. The MCU can't set any protections on external memory besides MPU, which only applies to the CPU based access, doesn't for example apply to DMA access.
4) The external memory is generally well suited for storage of encrypted backup images. I suggest looking here mcuboot | Secure boot for 32-bit Microcontrollers!
BR,
J
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-03-27 5:07 AM
Hi @Bubbles,
Thanks for your reply.
1) That makes sense to me now! I have been drowning in documentation over the last couple of days, and so while I think I understood this at one point it got driven out of my brain again. I was thinking that the step of generating the sha256 hash of the image was being skipped, which obviously wouldn't make any sense. Skipping the signature check in this scenario does make sense.
2) I guess this is my next step so. If nothing else it should allow me get more familiar with how everything works.
3) Understood re. OTFDEC only offering decryption. I'm not on the team that is creating our end-product application, but I'm told it's already approx. 5MB, and expected to grow to approx. 8MB, so it obviously won't fit in internal flash.
We'll worry about getting the rest of the secure boot, and secure firmware update, functionality working first before diving into using OTFDEC for the application primary slot (I'm pretty sure our security review dept. will insist on it).
Presumably the encryption will only need to be performed when the bootloader is swapping the image into the primary slot, so this should be doable, right?
As only the bootloader itself will be living in internal flash we will have plenty of space available for any non-volatile data/settings that may need to be updated more regularly.
One confusion I do have is that AN5447 lists "Encrypted image execution in external Flash memory" as a top-level feature for the TF-M based SBSFU solution:
I'm not seeing evidence of this, at least not in the STM32U5 example. Am I missing something, or is this table just saying this is possible (but the actual implementation is an exercise for the reader)?
Thanks,
RJH