Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
hiplease only ST Employee answer this questioni use this code for enable RDP LEVEL 1 for STM32H743 and STM32F407Can this code alone protect the program in the flash from any type of attack to read the program in the microcontroller?Will it be possible to read the program through the bootloader or the program in the sram?FLASH_OBProgramInitTypeDef OBInit; OBInit.OptionType = OPTIONBYTE_RDP; OBInit.RDPLevel = OB_RDP_LEVEL_1; HAL_FLASH_OB_Unlock(); HAL_FLASH_Unlock(); HAL_FLASHEx_OBProgram(&OBInit); HAL_FLASH_OB_Launch(); HAL_FLASH_OB_Lock(); HAL_FLASH_Lock();
I am using the STM32H7B0VBT6 microcontroller, which has limited internal flash memory. To implement Secure Boot and Secure Firmware Update (SBSFU), I have connected an external W25Q256JVIQ flash memory to the MCU via Quad SPI. Is it possible to store the bootloader in the internal flash memory and application firmware store into external flash memory? Please provide any guidance, documents, or articles to help implement this setup?
Hello,I am trying to use below file to enable RDP 2 on an STM32 L552 controller.wiki.segger.com/images/7/78/STM32L5_Lock.jflash This has exit step "ExitStep21_Action" that set the DRP Level 1, However, I need to set RDP Level 2 by setting the value as "0x000000CC". But It may also required to lock the FLASH_OTPR so, the value cannot be changed. Here I need to SEGGER J-Flash software program the option bytes to enable RDP Level 2.I tried to refer the RM0438, but unable to corelate the address defined in the .jflash file and the FLASH_OTPR address given.Kindly support, to understand how this .jflash file is organized; and proceed further to change RDP Level 1 to Level 2 and lock the FLASH_OTPR, so revert of RDP L2 is not possible. Thank you,
I'm using a STM32F103RCT6Flash contains my own boot loader in pages 0 thru 10 and main application in 11 thru 61.When the device is flashed in manufacturing, protection is set to prevent reading and writing via the jtag port.I need to update the bootloader. I can do that for product in inventory, but product in the field, in customers hands, I wrote a specific application that contains the new BL image and can load THAT application via a special communication process I have in place.All my testing on the bench was with a device that is unprotected.I executed the process in the field and the product reported that erasing pages 0 thru 10 failed. I suspect the reason is the protection bits are set.I've read PM0075 - sections that talk about "unprotection" - and I think it states that to unprotect a mass chip erase must take place. I can see that if trying to use a tool via jtag.Can I (via my revised application) unprotect flash memory without causing a mass erase?&n
I am using an STM32L4S9ZIJX part and attempting to encrypt a 256KB buffer (actually 262,144 - 16 = 262,128 bytes) using AES256 CTR mode in polling mode.I created a wrapper function to perform the encryption: int encrypt_CTR_mode(uint8_t* key, uint8_t* IV, uint8_t* plaintext, uint32_t pt_length, uint8_t* ciphertext) { // Deinit old parameters if (HAL_CRYP_DeInit(&hcryp) != HAL_OK) { LOG(error, "ERROR: HAL_CRYP_DeInit() failed\n"); return -1; } // Setup new params hcryp.Init.DataType = CRYP_DATATYPE_32B; hcryp.Init.KeySize = CRYP_KEYSIZE_256B; hcryp.Init.OperatingMode = CRYP_ALGOMODE_ENCRYPT; hcryp.Init.ChainingMode = CRYP_CHAINMODE_AES_CTR; hcryp.Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE; hcryp.Init.pKey = key; hcryp.Init.pInitVect = IV; // Init new parameters if (HAL_CRYP_Init(&hcryp) != HAL_OK) { LOG(error, "ERROR: HAL_CRYP_Init() failed\n"); return -1; } // Encrypt plaintext HAL_StatusTypeDef rc; rc = HAL_CRYPEx_AES(&hcryp, plaintext, pt_le
I'm working on integrating the latest SBSFU (v2.6.2) onto an STM32L4A6 platform. I've reviewed both the user manual and application note for the SBSFU, as well as the examples provided.In my use case:I have an external attached MMC flashI'm not planning to use the internal MCU flash dual-bank capability (so I can have an image larger than half the 1MB flash size)I don't need rollback/swap capabilityFor OTA updates, my user application will download the encrypted image to a location in the external MMC flash. The SBSFU on boot will check for a valid image in that location, and if so, it will copy it to the MCU flash active slot. I was able to get the B-L475E-IOT01A 2_Images_ExtFlash example to boot and run on my board, and it executes the UserApp. For porting the SBSFU to integrate with my custom UserApp I have:Started from the B-L475E-IOT01A 2_Images_ExtFlash example because it seemed like the closest for what I needed.Replaced the example QSPI driver with an MMC flash d
Hello,I only have 2 GPIOs activated, and the SMPS, not yet any code written from me...The function HAL_PWREx_ControlVoltageScaling times out in NonSecure (somehow works if debugging and stepping into.. but then HAL_RCC_OscConfig get HAL_Error).For some reason there is not problem if I call that SystemClock_Config in Secure main.c...Any idea why this is happening ? Here is the auto generated SystemClock_Config from the NonSecure main.c: ** * @brief System Clock Configuration * @retval None */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; /** Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { Error_Handler(); } /** Initializes the CPU, AHB and APB buses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI; RCC_OscInitStruct.MSIState = RCC_MSI_ON; RCC_OscInitStruct.MSICalibrationValue = RCC_
Hi, I am using stm32l496 for sbsfu. I followed the tutorial and it ran the example code but they gave me their scripts for that project. how do we make our own script for my project which converts project binary into .sbsf file? and how to configure or edit the given script.
I want to modify option bytes to set up readout protection. I am programming this device with my own programming tool (UART+BOOT0+RESET pin). Programming works fine using bootloader protocol. Setting readout protection doesn't. After setting it up it doesn't boot, reset doesn't work, only powercycle works.We cannot powercycle on this device as it will have large hybrid capacitor already soldered before programming. "powercycling" by shorting it for a moment may result in explosion ;)So i tried to add a function to firmware that set readout protection leve.Writing option bytes to flash works just as described - no problem. But they need to be reloaded.AS instruction states on page 92 option bytes are reloaded whena) BOR reset happens or exit from standby/shutdown mode.And yes powercycling do work.b) setting OBL_LAUNCH bit in FLASH_CR. As instruction states it should force system reset.But it forces system hang instead which can only be resolved by powercycling - which we cannot do.How t
Hello,I am programming with the STM32U575ZIT6 microcontroller, and I am trying to update the firmware in the secure zone. However, when I try to update the firmware in the secure zone, the function ret_arm=LOADER_FLASH_DEV_NAME.EraseSector(sector_address) in FW_UPDATE_DownloadNewFirmware(&fw_image_dwl_area) returns a value less than 0, which causes the update to fail. Performing the update in the non-secure zone works without any issues. I suspect the problem might be that LOADER_FLASH_DEV_NAME does not work properly in the secure zone, or that the firmware image area cannot be read correctly in the secure zone. Is there anything specific that needs to be enabled or configured for the secure firmware update to work?
I am working to generate the CRC for the flash memory, During this I am facing hard fault when the CRC module tries to read from certain flash locations, to debug it I made a small loop which assigns the value of each 4 byte. I found that reading at certain locations results in hardfault.I tried with different starting address, I found thatwhen starting address is 0x08000000 hardfault occurred at 0x08000440when starting address is 0x08001000 hardfault occurred at 0x0800144cwhen starting address is 0x08004000 hardfault occurred at 0x080044ccuint32_t *d1 = 0x08000000; while(length){ uint32_t temp = *d1; d1++; length -= 4; }Any Idea of what is causing this issue?
Hello,I am using the SBSFU application on the U575 microcontroller and have created my own program, which is stored in the secure area and accessed via NSC. I am trying to send data via ultrawideband, but the interrupt is not triggered. I have tested it in a normal project before integrating it into the SBSFU application, and it was correctly configured and worked fine. However, now I’m sending via UWB, but the interrupt I designed to notify when the transmission is complete is not triggered, and the transmission loop doesn't exit.I have also tried adding two RTC alarms and reading their flags via interrupts, but nothing is being read. Do I need to configure any interrupts or settings in the secure boot part or for remote updates? If so, what should be done?
Hi I am working on SBSFU Application project from STM32U585 project. And I am trying to use mbed-crypto APIs like SHA512 APIs as below mbedtls_platform_setup(NULL);mbedtls_sha512_init(&sha512_context);mbedtls_sha512_starts(&sha512_context, 0); // 0 for standard SHA-512mbedtls_sha512_update(&sha512_context, data, data_len);mbedtls_sha512_finish(&sha512_context, sha512_hash);for(int i =0;i<64;i++){ printf(" %x",sha512_hash[i]);}/printf("\n SHA512 Computed");mbedtls_sha512_free(&sha512_context);What I am experiencing here is that I am seeing frequent reset of the controller during execution. I would like to know the possibility of same situation ever faced by other person also. Or is their any other configuration I have enable in default config file.Need help, thanks in advance...@Jocelyn RICARD
Hi,We are going for mass production of our device and we are using STM32H563IIK6 chip. And We need JTAG need to be Locked.And in our production we are using Segger JLINK .Can you provide how to implement PRODUCT_STATE using Segger JLINK.
Hello,We are planning to integrate the STSAFE110 into our device, which runs on Ubuntu. Since we’ll be developing our own code to retrieve the unique ID, I wanted to ask if there is any reference manual or documentation available for this. I couldn’t find one online.Thank you!
In OEMiROT_BOOT project compilation, first we are checking if the is recognized or not. Before that "Project.eww" needs to be opened and then we are creating the Project.bin binary file under EWARM. So how to do that. My purpose is to perform OTA via UART in Nucleo-H563Zi. So is there any bootloader for that or do we have create our custom bootloader.
Hi,I am working on the wiki "How to start STiRoT".Actually, my board in in CLOSE state and the DA returns the error "Debug Authentication failed" after Discovery (see below). The key and certificate used is the deafult ones.The connection through STLink returns the error "No STM32 target found" (BOOT0 on System "1").The connection through UART returns the error : " Activating device KO. Please verify the boot mode configuration and check the serial port configuration. Reset your device and try again..." (BOOT0 on Flash "0").How can I recover the connection to the board and the state OPEN ?Discovery:12:15:09:766 : Start Debug Authentication Sequence12:15:09:766 : SDMOpen : 609 : open : SDM API v1.012:15:09:766 : SDMOpen : 610 : open : SDM Library version v1.1.012:15:09:766 : open_comms : 501 : open : Asserting target reset12:15:09:766 : open_comms : 505 : open : Writing magic number12:15:09:766 : open_comms : 515 : open : De-asserting target reset12:15:09:766 : open_comms : 567 : open :
I am working with SAES on STM32U585. I am trying to make use of wrapping/unwrappinng my encryption key with hardware-secret key DHUK . This in the SAES initialization I am using hcryp.Instance = SAES; hcryp.Init.DataType = CRYP_BYTE_SWAP; hcryp.Init.KeySize = CRYP_KEYSIZE_128B; hcryp.Init.pInitVect = (uint32_t *)iv; hcryp.Init.pKey = (uint32_t *)key; hcryp.Init.Algorithm = CRYP_AES_CBC; hcryp.Init.DataWidthUnit = CRYP_DATAWIDTHUNIT_WORD; hcryp.Init.KeyIVConfigSkip = CRYP_KEYNOCONFIG; hcryp.Init.KeyMode = CRYP_KEYMODE_WRAPPED; hcryp.Init.KeySelect = CRYP_KEYSEL_HW; hcryp.Init.KeyProtection = CRYP_KEYPROT_DISABLE; I make the encryption key available to SAES with HAL_CRYPEx_WrapKey(&hcryp, key, encrypted_key, 100); HAL_CRYPEx_UnwrapKey(&hcryp, encrypted_key, 100); If I make a simple test with HAL_CRYP_Encrypt(&hcryp, (uint32_t*)test, 4, (uint32_t*)wbuf, 100); HAL_CRYP_Decrypt(&hcryp, (uint32_t*)wbuf, 4
I am having trouble to get OBK data reading working on the STM32H562 / H563 (which do not support secure storage because they are lacking hardware crypto support).My plan is to store keys in the OBK area, (encrypted with some storage key of my own) and use HDPL to make sure the application cannot access the bootloader keys.I am not really using the TrustZone, but I need to enable it in order to get HDPL support.So my secure application is very small, it configures nonsecure access for GPIO's, most of the flash (apart from the area where the secure application resides), and all IRQ's, then it jumps to my nonsecure bootloader.When I have TrustZone disabled, I can write and read OBK data like expected.As soon as I enable TrustZone, I can no longer read OBK data in my nonsecure bootloader or application, instead I'm reading all zeros.The HDP level matches the area I'm trying to read.But to be sure I'm trying to read all HDP areas, just in case I'm in an unexpected level. I expect that
I am trying to get SBSFU (1_image) running on the STM32H755. I'm working from um2262 and this post https://community.st.com/t5/stm32-mcus-security/sbsfu-porting-to-a-custom-board/m-p/200240/highlight/true#M2917 My setup is a NUCLEO-H755zi, STM32CubeToolchain and I'm starting from the NUCLEO-H753 example.For now I am just trying to get the M7 running and will aim to add the M4 later. (M4 boot is disabled in the option bytes). Looking back at my diff all that has changes I've made from the example are:- defines removed STM32H753xx and added STM32H755xx and CORE_CM7.- replace system_stm32h7xx.c with system_stm32h7xx_dualcore_bootcm7_cm4gated.c- app_sfu.h I've uncommented SFU_VERBOSE_DEBUG_MODE and SECBOOT_DISABLE_SECURITY_IPS Having flashed the SBSFU.elf via CubeProgrammer and gone through the steps in 8.3 of um2262, there is no obvious UART connection or sign of life from the firmware.I'm sure I'm missing something basic he
Using MX created an app utilizing Secure Manager 1.2 on STM32H573, after running 'provisioning.py --sfi-gen', the generated sfi image does not include the non-secure app image; after 'provisioning.py --sfi-flash', the product-state is set to TZ-CLOSED, and the non-secure app image can be loaded using 'project.py download', and the product-state can be changed to Closed manually using CubeProgrammer. I'd like to simply it to a single step by calling 'provisioning.py --sfi-gen --sfi-flash -a', which will not only provision the secure manager, but also program the non-secure image and set the product-state to Closed, is it possible?
We are developing this on st-cube-matter.We are using the STM32WB5MMG-DK evaluation board, but is there a recommended device for the security chip that stores the certificates for the DAC, NOC, etc.?
I'm starting from the X-CUBE-SBSFU release v2.6.2, using the B-L475E-IOT01A - 2_Images_ExtFlash as a reference. I've done the minimum porting required to run this on an STM32L4A6 target.I'm seeing an inconsistent issue where the SBSFU boots up and attempts to verify the Active Slot fw header signature, but fails. The inconsistency seems tied to the build process, specifically the final step of building the UserApp + postbuild script to generate the combined SBSFU_UserApp.bin.On a 'good' build, I can flash the SBSFU_UserApp.bin onto the target and it will consistently boot successfully, regardless of the number of re-flash or reboot attempts.On a 'bad' build, I can flash the SBSFU_UserApp.bin onto the target and it will consistently fail to boot successfully, regardless of the number of re-flash or reboot attempts.= [SBOOT] SECURE ENGINE INITIALIZATION SUCCESSFUL= [SBOOT] STATE: CHECK STATUS ON RESETINFO: A Reboot has been triggered by a Software reset!= [SBOOT] STATE: CHECK
Does the STM32H753ZI microcontroller provide a built-in unique key or mechanism to ensure that the chip cannot be unlocked, and firmware cannot be flashed, read, or erased without the correct key, effectively preventing unauthorized access or modification?
STM32H573 with Secure Manager provisioned, the non-secure app cannot access the RNG anymore. Will it be ok to use Secure Manager API psa_generate_random() to replace HAL_RNG_GenerateRandomNumber()?
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.