Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
Our current product uses the STM32H533 microcontroller and password based Debug Authentication. We have a need to generate a large number of different DA passwords and corresponding OB Keys provisioning data. This is possible by creating our own tool to generate OB Keys .xml files and passing those into the STM32TrustedPackageCreator_CLI.exe tool, but it would be nice to cut out the .xml files and need to use the Trusted Package Creator tool. Given that the input .xml file contains a 'hash' tag and that output .obk file contains 512 bits of seemingly random data, I suspect this is a SHA-512 of the password, however I cannot manually re-create the same hash. I've attempted padding the password to various different lengths, with various different values, additionally including the additional bytes that are included in the created 'password.bin' file that accompanies the .obk file. What process/data goes into creating the contents of the .obk file? Is
OTP portion of FLASH is a valuable asset in some STM32 families and represents a convenient place to store things like security keys. For this, it is desirable - and, as it's part of FLASH, also quite logically expected - that setting read-out protection to any level above 1 prevents the debugger from reading it.In RM0444 Rev.5 and RM0454 Rev.5 (the current 'G0 manuals), the following text indicates that this should be the case:The following table appears to indicate the same behaviour:However, user @DAlbe.3 reported, that he was able to read out OTP using debugger, while RDP was set to Level1.This, together with the fact, that the above table has changed across RM revisions, rises questions about the OTP's security.Can ST please comment? Thanks,JW
Hello everyone,I'm trying to disable the TrustZone (TZEN bit) on an STM32L562E-DK development board to leave it in a completely clean state (without protections) so I can use it as a standard MCU. However, I'm encountering errors when trying to modify the Option Bytes with STM32CubeProgrammer, and I would appreciate your help.My configuration:Board: STM32L562E-DKSoftware: STM32CubeProgrammer v2.21.0Connection: Integrated ST-LINK (SWD at 8000 kHz)Current Option Bytes status (initial read):TZEN = 0x1 (Trust Zone enabled)RDP = 0xAA (Level 0, no readout protection)SECWM1_PSTRT = 0x0, SECWM1_PEND = 0x7F (Safe area defined)Screenshots of the complete configuration are attached.The problem:From the STM32CubeProgrammer graphical interface, I can modify and apply changes to almost all Option Bytes (such as safe areas or write protection) without issue. However, when I try to uncheck the TZEN box (to set it to 0) and click "Apply," I get the following errors:Error: Option Byte Programming failed
Hello everyone,I am working on a custom board based on the STM32U575RGT6 (1MB Flash). I am encountering a hard fault (SecureFault) during the initialization of the Non-Secure application after integrating the SBSFU.Context:Hardware: Custom board with STM32U575RGT6.Initial Project: A working application using TrustZone active + FreeRTOS (generated via CubeMX). The Option Bytes were set to a default 50/50 split (Secure/Non-Secure).Goal: Implement a Secure Boot / Firmware Update mechanism.What I did:I used the ST example for B-U585I-IOT02A as a reference.I integrated SBSFU_Boot and SBSFU_Loader into my project folder.I adapted the linker scripts (.ld), postbuild.sh, and flash_layout.h to match the 1MB Flash size of the U575RGT6 (vs 2MB on the B-U585I).In my original application, I replaced the .ld files and startup_xx.s files with those provided in the SBSFU_Appli example.Configur
I have been looking at the CRA Q&A and was wondering what you you are meaning with the reporting of security incidents 2026-12-11. Do you mean the reporting according to article 14 that enters into force 2026-09-11?
Hi, I'm starting to play with the SBSFU examples provided by ST. I'm trying to build the SBSFU (mcuboot based) example for the STM32L5 which can be found in the STM32SecuWS provided here . I'm stuck trying to build the TFM_SBSFU_boot (partial console output):arm-none-eabi-gcc "C:/STM32SecuWS/TFM/STM32Cube_FW_L5_V1.3.0/Projects/STM32L562E-DK/Applications/TFM/TFM_SBSFU_Boot/Src/low_level_com.c" -mcpu=cortex-m33 -g3 -DSTM32L562xx -DUSE_HAL_DRIVER -DNDEBUG -DTFM_DEV_MODE '-DMCUBOOT_TARGET_CONFIG=<flash_layout.h>' '-DMBEDTLS_CONFIG_FILE=<config-boot.h>' -DMCUBOOT_DOUBLE_SIGN_VERIF -DBL2 -c -I../../Inc -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/CMSIS/Device/ST/STM32L5xx/Include -I../../../../../../../Drivers/STM32L5xx_HAL_Driver/Inc -I../../../../../../../Middlewares/Third_Party/trustedfirmware -I../../../../../../../Middlewares/Third_Party/trustedfirmware/platform/ext/common -I../../../../../../../Middlewares/Third_Party/trust
Hi Community,I am porting STM32Cube_FW_U5_V1.8.0\Projects\B-U585I-IOT02A\Applications\SBSFU example to be used with USB port for firmware upgrade instead of Uart. I use B-U585I-IOT02A board with U585. Because of some requirements I need to use bare metal USB stack and I successfully ported the classic STM one according to article How to use STMicroelectronics classic USB device middleware with new STM32 families . I have used it SBSFU example and the usb stack works fine when I use it in non secure environment and run Loader binary or Appli_NonSecure as separate application with TZEN=0 without bootloader - I was able successfully send fw image over usb using ymodem. But when I used it in full secure original setup as in the example, I mean TZEN=1, booting with bootloader, using Appli_Secure/Appli_NonSecure - I experienced board restarting when connecting board's USB to the PC - it looks like something goes wrong during USB enumeration process. I have checked that US
Hello ST, I am working with STM32WBA52 and I am no longer able to connect to the device using STM32CubeProgrammer. When trying to connect, I got the following error: The interface firmware FAILED to reset/halt the target MCU A fail.txt file is also generated. The connection fails even when trying: Connect under reset. Different SWD frequencies. PH3 (BOOT) pin forced high. The issue appeared after changing security-related option bytes (TZEN / RDP). The device seems to boot normally, but debug access is blocked. I suspect the MCU enters Secure state early and prevents the debugger from halting the core. Is this expected behaviour on STM32WBA when TZEN = 1 and RDP = 1 without Debug Authentication configured? Does STM32WBA block SWD access by default in Secure mode? Best Regards,Dhia
Hello,I used the SBSFU 2.6.2 and it's STM32L432KC 1_Image example.Everything was cool, so I modified the UserApp and removed the demonstration application menu (a potential way to select a new download, this could save me...) Then, I unfortunately found out, I can't erase the chip so I can't flash a new firmware ... and finally I realized, I left most (or all) of the security macros enabled...I'm trying over the STM32CubeProgrammer play with RDP, WRP PCROP. Biggest issue to me seems PCROPas MCU rejects changes. The RDP I could set to level 0 easily (AA) and WRP protection also seem fine.Is there any chance to unlock my STM32L432KC nucleo back ?Thank youC:\Users\Vladimir.Sustek>STM32_Programmer_CLI.exe -c port=swd -ob displ ------------------------------------------------------------------- STM32CubeProgrammer v2.20.0 ------------------------------------------------------------------- ST-LINK SN : 0673FF515152827187223922 ST-LINK FW : V2J46M31 Board : NUCLEO-L432KC Voltage : 3.24
Need help? Is it possible to disable RDP2 and return to AA mode when I did not set a password before setting up RDP2? Is there a default STM password? Thanks
Using STM32TRUSTEE-SM framework, the non-secure application is built by the project.py script which in turn callsSTM32TrustedPackageCreator_CLI.exe -pb SM_Code_Image_bin.xmlto generate the application .bin file in MCUboot format.The xml file has <Param> <Name>Security Counter</Name> <Value>auto</Value> <Type>Data</Type> <Command>-s</Command> <Hidden>1</Hidden> <Default>auto</Default> </Param>It is my understanding that with this setting, an incrementing counter should be placed in the image header's ih_ver.iv_build_num field. But this field stays 0 no matter what I put under <Value>, auto or direct number.There is a command "-s" which according to the documentation would be passed on to the imgtool executable, which, however, is described as thisand therefore would have nothing to do with any counter.Could anybody shed some light on it, please? I am using the latest version 2.20.
We have a board with an STM32H7S3, using STiROT and OEMuROT to run our own application. The application runs in place from external flash, and uses external RAM for data.The process has proven extremely challenging, but we have been able to get the application to run...up to the point where it needs to initialise a peripheral which uses a PLL-dependent clock.OEMuROT does some clock initialisation, but we need to change some of those settings, including turning on additional PLLs.I've tried adding clock setup code to the app (originally generated by CubeMX), but it fails because you can’t change PLL settings while they’re running. So I added a call to the HAL function to reset the clocks first – but that also doesn’t work because we’re running from the external flash at this point, which relies on a PLL!I then tried moving the clock setup code into the bootloader – in the code which runs at the end of proceedings, or at the start – but they also failed.This code has to run from internal
Hello , I am aiming to demonstrate secure storage operation SST using PSA APIs using STM32U585. To verify that TF-M services are operational and Secure/Non-Secure communication works. However I dont find any more stm32cube TFM ready solutions/examples. So i have started from SBSFU examples and cloned TFM Source code from trusted firmware m git and trying to integrate the lib I need . Is this the right way to do so ? is there better starting point? Also it make more sens to put this in secure world however not sure if there is any considerations to think of while doing this . This is what I am trying to do one Secure Storage lifecycle: Write data to Secure Storage using psa_ps_set() Read the data back using psa_ps_get() Verify data integrity using memcmp() Remove the stored object using psa_ps_remove()
I'm using the link below to select boot path and do secure boot device provisioning for my STM32H563 board:https://wiki.st.com/stm32mcu/wiki/Security:How_to_start_with_STM32CubeMX_OEMiRoT_Boot_path_on_STM32H563Boot path is configured as follows:I have run provisioning.bat, the product state was set to PROVISIONED. The provisioning was successfull, with logs at the end of ob_flash_programming.log:OPTION BYTE PROGRAMMING VERIFICATION:Option Bytes successfully programmedTime elapsed during option Bytes configuration: 00:00:01.334Programming successHowever, inside ob_flash_programming.log, it also shows:PROGRAMMING OPTION BYTES AREA ...Warning: Option Byte: boot_ube, value: 0xB4, was not modified.Warning: Option Byte: hdp2_end, value: 0x0, was not modified.Warning: Option Byte: secbootadd, value: 0xC0000, was not modified.Warning: Option Byte: secwm2_end, value: 0x0, was not modified.Warning: Option Byte: sram2_ecc, value: 0x0, was not modified.Warning: Option Byte: sram2_rst, va
Hello,I have written a custom bootloader for my stm32u5 project and have been testing it for the last few months with multiple working firmware updates. To give some context, I transfer an encrypted firmware image to an external flash chip over CANfd from the currently running firmware. The next time the device boots, the bootloader looks for a new encrypted image on the external flash and if found it will decrypt the image, delete the internal flash where the application lives and then flashes the decrypted image. It will then de-init some peripherals and jump to the new application, fairly standard implementation. All of this has been working flawless until I set RDP = 1(DC) in stm32cubeprog. Also need to mention that I have set both passwords for RDP regression a while ago, I just have not been setting the RDP level beyond 0.With RDP = 1 the device will boot as it should, and I can send it a firmware update. I will power cycle the device and it will per
In STM32Cube_FW_H7RS_V1.3.0, file Projects/STM32H7S78-DK/Applications/ROT/STiROT_iLoader/STM32CubeIDE/prebuild.bat:As currently written, it fails in a couple of places. Here are the changes necessary for it to run:(The system won't let me upload the edited batch file.)
I am attempting to make a previously developed design run with Trustzone enabled. I have been unable to get the HSPI1 PSRAM to function.I've set the peripheral's GTZC's attributes to NSEC|NPRIV.I've set the appropriate GPIO pins' attributes to NSEC.I've set the MPCWM Config to consider the memory as NSEC|NPRIVI've set the appropriate/associated DMA channels as NSEC|NPRIV.None of these seem to have any effect. The Initialization code hangs/timesout in:BSP_HSPI_RAM_Config16BitsOctalRAM in stm32u5a9j_discovery_hspi.c.RCC->AHB2ENR2 shows the HSPI clock enabled.Can anyone point to a minimal working example of using the AP512 on the STM32u5A9J-DK with trustzone enabled?
I am currently working with the STSAFE-A110 and I have noticed a significant lack of documentation for those who need to implement or understand the driver logic.For instance, when generating ECC asymmetric key pairs, the official datasheet mentions the Generate Key command (¶ 4) but does not document its I2C syntax or semantics.Although I am using the STSELib middleware, I have found that its APIs, such as stse_generate_ecc_key_pair() also lack exhaustive documentation. A specific example is the PLAT_UI16 usage_limit parameter; its purpose is never explained.By digging into the STSELib source code, it appears usage_limit parameter is passed directly to the STSAFE-A110 via I2C.Furthermore, in the Doxygen documentation there is an example where usage_limit is set to 100,while the STSAFE-A120 examples use 255. /* ## Generate key pair in slot 1 */ uint8_t slot_1_public_key[stse_ecc_info_table[STSE_ECC_KT_NIST_P_256].public_key_size]; stse_ret = stse_generate_ecc_key_
Hello, everyone.Can the STM32F407VE encrypt multi-byte messages to maintain the confidentiality of messages between the host and client (stm32)? If so, what type of encryption can be run on this processor?Thank you:)
I'm working with the STM32U385/375 for a project, and have started my investigation into how to convert it to a secure root of trust application by working with the OEMiROT examples.In stock form it works well. The provisioning works, the update over the y-modem link works just fine, etc. However, I want to build a combined binary and not deal with separate non-secure and secure binaries to apply for an update.Accordingly, I changed MCUBOOT_APP_IMAGE_NUMBER in OEMiROT_Boot/Inc/flash_layout.h from 2 to 1, like so:#define MCUBOOT_APP_IMAGE_NUMBER 1 /* 1: S application only if FLASH_NS_PARTITION_SIZE = 0 , else S and NS application binaries assembled in one single image. 2: Two separated images for S and NS application binaries. */The build works fine, the first part of the provisioning script works fine, the appropriate value is updated in appli_flash_layout.h, and the programming begins. However, it fails with this error:========== Error while executing "Programming the option bytes and
Hi,I'm developing a secure boot application for STM32H563ZI microcontroller. I started with a very simple application following ST template code and tutorials like this one: https://wiki.st.com/stm32mcu/wiki/Security:How_to_start_with_STM32CubeMX_OEMiRoT_Boot_path_on_STM32H563 Everything runs as expected when I try to run my application using the NUCLEO-H5 board. However, this is not true when I do the same provisioning process in my H5 custom board. The only difference I can see between the two tests is that in the custom board I'm using the STLink-V2 programmer, while the Nucleo is programmed by the embedded STLINK-V3EC.Here are some additional points:1) in both cases the provisioning script reaches the end, saying "The board is correctly configured".2) in the custom board, I see the flash full of zeros after provisioning; I checked it with stm32CubeProgrammer3) I have no problems in flashing firmware through stm32CubeProgrammer or stm32CubeIde in my custom board
I've downloaded archive "en.STM32CubeExpansion_Crypto_v4.0.1.zip", now I'm trying to install it in STM32CubeMX with "From Local..." feature, but I'm getting error. How can I install the library in CubeMX?Thank you.
What I want to achieve:During startup all code is verified, starting with SMiRoT (as root-of-trust) then SMuRoT, then SecureManager then non-secure application.If the application has been modified (vberification fails) the startup shall end in system bootloader.Unfortunately, this does not work as our tampered/modified non-secure application is still started/executed instead of jumping into bootloader.Secure manager is installed with the provisioning script. We have modified the BOOT_UBE setting via TrustedPackageCreator from 0xB4 (OEM-iRoT - user flash) to 0xC3 (ST-iRoT - system flash) and re-generated Option_Bytes.csvWhat I see is that when connecting the STM32CubeProgrammer, the value for BOOT_UBE still shows 0xB4.And in the log during SFI flashing (provisioning.py -v --sfi-flash) it shows this:DEBUG - Warning: Option Byte: BOOT_UBE, value: 0xB4, was not modified.DEBUG - Warning: Option Bytes are unchanged, Data won't be downloadedDEBUG - Time elapsed during option Bytes config
Hello, I have a problem with setting readout protection in the STM32L496 device in software. The protection is set to "BB". After setting and power on reset, the microcontroller seems to not work (it looks like as if it was "stuck up"). I connected the ST-Link programmer and run STM32Cube programmer and it shows option byte RDP set correctly to BB value. Also, in the FAULT ANALYZER section it displays "CPU: LOCKUP". I don't know why it happens and how to solve it. The software code that sets the RDP protection is shown below: __disable_irq(); while (FLASH->SR & FLASH_SR_BSY); FLASH->KEYR = 0x45670123; FLASH->KEYR = 0xCDEF89AB; FLASH->OPTKEYR = 0x08192A3B; FLASH->OPTKEYR = 0x4C5D6E7F; FLASH->OPTR = 0xFFEFF8BB; FLASH->CR |= FLASH_CR_OPTSTRT; while (FLASH->SR & FLASH_SR_BSY); FLASH->CR |= FLASH_CR_OBL_LAUNCH;
ST Community highlights – April to June 2026
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.