Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
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()?
The file is under X-CUBE-SEC-M-H5_V1.2.0\Middlewares\ST\secure_manager_api; it can be opened without any error, but the right panel is always empty.
I am using the X-CUBE-CRYPTOLIB (V4.2.0) in a project for STM32F207.I am successfully able to generate ECC key pair using cmox_ecdsa_keyGen() and generate ECDSA signature using cmox_ecdsa_sign() but I am now needing to generate a shared secret using cmox_ecdh() function. The problem I have is that the cmox_ecdh() function expects the public key in raw data format (64 bytes) but I only have the public key available in compressed format (33 bytes) where 32 bytes is the x component and the other byte indicates if the y component is odd or even. The y component can be derived from this information but I could not find a function within the X-CUBE-CRYPTOLIB that does this which means I am unable to generate the shared secret.Is there a way of achieving this with the X-CUBE-CRYPTOLIB?
Hello,I want to change target of BFU_2_Slots (1_Image_BFU, 1_Image_SECoreBin and also 1_Image_UserApp) from STM32CubeWL v1.3.0 (STM32Cube_FW_WL_V1.3.0/Projects/NUCLEO-WL55JC/Applications/BFU_2_Slots) from STM32WL55JC to STM32WLE5C8, but I do not know how should I do that properly, since CubeMX file is not available in this project.Could anybody help me, please?Thank you.
Hallo together,i`m working with the STM32H573I-DK EvalBoard to check if the Chip fits our project needs.I was working with the template STiROT_Appli from the STM32Cube_FW_H5_V1.3.0 Firmware. Full path to the template: STM32Cube_FW_H5_V1.3.0\Projects\STM32H573I-DK\Templates\ROT\ STiROT_Appli.I followed the steps within the readme.md, entered the provisioning state (0x17) and provided the OBK delivered with the firmware. (As I have done in the previous tutorials security tutorials)Full path to OBK: STM32Cube_FW_H5_V1.3.0\Projects\STM32H573I-DK\ROT_Provisioning\DA\Binary\ DA_ConfigWithPassword.obkThen i continued the development and now i wanted to restore the product_state back to OPEN using the regression process. Now the Board is in CLOSED State.However, since this template used TrustZone, regression is not working with the password.bin, but with certificates. Is there a way to recover this EvalBoard?As I understand it, I would need a Certificate matching the DA_ConfigWithPas
Hello everyone,Thank you for clicking this post. I am new to the community and ecosystem. Here's my task, I am trying to use the X-CUBE-SBSFU libraries to perform a secure firmware update procedure. I am using the STM32L496ZG-NUCLEO-144 board to test before applying it to our hardware.There exists the 32L496G discovery project in the XCUBE-SBSFU example projects. I was able to flash the NUCELO board with this and use the project over UART and an FTDI to usb serial adaptor. Great.Now I want to rewrite the communication layer in the SBSFU example to use the USB_OTG_FS virtual com port using the USB CDC libraries instead of UART.I have an example project build with the ".ioc" graphical tool where I can successfully print hello world over the virtual com port. I noticed some Middlewares/ST/STM32_USB_Device_Library and USB_DEVICE folders in the hello world project so I copied them into the SBSFU application folder.I also selected project->properties->MCU GCC Compiler and added the fol
H5 has Secure Manager provisioned, and got exception when trying to access UID_BASE to retrieve device ID. #define UID_BASE (0x08FFF800UL) /*!< Unique device ID register base address */
To secure my bootloader against erroneous writes from the application I want to enable write protection on it. But since for some things the bootloader needs to modify data inside its partition (security counter update and key invalidation), I can not just enable write protection and be done with it. I would need to disable it at some point and reenable it again. Best case without rebooting in between.Now what I am trying to understand ist when the WRP setting actually takes effect, so how dynamic I can use it. The reference manual says:"To validate the WRP options, the option bytes must be reloaded through the OBL_LAUNCHbit in Flash memory control register"But validation is not enabling. So when can the register be written and when does the change take effect?I think my question is quite similar to the following, but that was never solvedhttps://community.st.com/t5/stm32-mcus-security/about-read-out-protection-write-protection/m-p/162290
Hi, I wish to know is there any example program for calculating CRC for flash Bank using "HAL_FLASHEx_ComputeCRC() " HAL driver.
# Overview I am looking into secure bootloader options for the STM32U5G9J-DK2 that support application updates. For now, I just wanted to run a demo that showed updating the application over UART.Initially I thought to start with SBSFU since that is what I am familiar with, but seems various posts here and elsewhere guide toward TFM for the Cortex-M33.After trying both options using STM32CubeIDE 1.15.1 and STM32CubeProgrammer 2.17.0 in Windows, neither demo project seemed to work out-of-the-box and I am now unsure what to do next. # What I Tried (SBSFU) I initially downloaded and adjusted the U585 SBSFU example to the STM32U5G9 as described in the README:https://github.com/STMicroelectronics/STM32CubeU5/tree/main/Projects/B-U585I-IOT02A/Applications/SBSFUThe 5 projects compiled and appeared to load OK, but doesn't run the external loader if holding the User Button at boot; the serial terminal prints a single message "[INF] Flash operation: Op=0x0, Area=0x0, Address=0x0"b
Hello,I’m working with the STM32H735, and I need to enter bootloader mode to program the microcontroller. I modify the SYSCFG->UR2 register to set the address to 0x1FF00000, then perform a software reset. I use this method because I have no control over the BOOT0 pin (it's directly connected to GND) and the reset pin. After the reset, I use STM32_Programmer_CLI.exe to program the microcontroller with the following python script: import subprocess # Define the path to STM32_Programmer_CLI.exe stm32_cli_path = "STM32_Programmer_CLI.exe" # Define the commands to be executed command1 = [stm32_cli_path, "-c", "port=COM7", "br=115200", "-rdu"] command2 = [stm32_cli_path, "-c", "port=COM7", "br=115200", "-e", "all", "-w", "Test.hex", "-v", "-ob", "rdp=0xBB"] try: # Execute the first command result1 = subprocess.run(command1, capture_output=True, text=True, check=True) print("Command 1 Output:") print(result1.stdout) # Execute the second command result2 = subproc
Hello, Actually am using STM32H5 board am able to load the secure manager using ST-Link Debugger but i would like to load the secure manager using usb dfu mode, is there any possiblity to load it.
Hi,I am working on regression from RDP1 to RDP0 with OEM1KEY but made from inside and not by external debugger.I want device to be able to make self unlocking.As I read in documentation RM0456, OEM1KEY unlock sequence requires:Shift OEM1KEY[31:0] then OEM1KEY[63:32] through JTAG or SWD in theDBGMCU_DBG_AUTH_HOST.Questions:1. Is it possible to do OEM1KEY unlock sequence (write DBGMCU_DBG_AUTH_HOST register) from firmware code ?2. Lets assume simpler scenario. OEM1KEY has been never programmed. Does it possible to do regression RDP1->RDP0 from internal Firmware ? I've got stuck on SET_BIT(FLASH->NSCR, FLASH_NSCR_OPTSTRT) and I had to make manual POR and manually change RDP level using debugger. Flash probably was erased.I've read the topicSolved: How to process RDP regression from appplication co... - STMicroelectronics Communitybut this topic doesnt answer on given questions!!! Movie on youtube also doesnt give the answers.Please explain it in details.Thanks
Hi everybody,I am using a platform that is based on STM32. The developers of this platform have provided to me the firmware image as an encrypted .bin file. When I flash it via USB everything is fine.Then I change their code and recompile everything using STM32CubeIDE. The produced binary is not encrypted. When I try to flash it, the flashing to the microcontroller fails. Could it be due to the fact that it is not encrypted? Note: when I flash my code using the .hex and an st-link everything works well. Thank you in advance.
The OEMiRoT project uses ExitSecureMemory V1.1 to enable 1 MPU region and start the application. This automatically enables the configured HDP region, so application cannot access the bootloader. The default OEMiRoT project allows for 2 tiny 64kB applications, but I need >128kB for my application, so I added support for external SPI flash for the download location and removed unneeded data areas.My goal is to fit the bootloader in the first 64kB and have the application use the remaining 192kB. However, an MPU region located at 64kB offset cannot be larger than 64kB itself (offset multiple of size). From a security point of view the bootloader cannot enable anything outside its own scope, but given this limitation (pass a single region to be enabled) it cannot instruct the ExitSecureMemory function to allow all flash from 64kB-256kB to be accessed.In the documentation (like AN2606) I couldn't find if the application is still allowed to enable another MPU region to allow ex
Hello ST,I am using stm32u575 board for secure flash access, When TZEN is enabled i am able read and write to Secure flash(0x0C00 8000), but unable to read/write to non secure area(0x08100 0000). Then I used User Option BytesSECWM1_PSTRT/SECWM1_PEND to set the secure area SECWM1_PSTRT = 0x02 and SECWM1_PEND =0x02 but value of SECWM1R1 isn't setting to 0xFF02FF02 but value remains to it 0xFFFF FF80 below is a snippet of my code, Not sure what I am doing wrong to set the SECWM1_PSTRT/SECWM1_PEND. Any help will highly be appreciated.Regards,Shafi
I am working with the NUCLEO-H563ZI, and I'm trying to write an application that verifies an ECDSA Certificate. I have already successfully done the verification using the HAL_PKA_ECDSAVerif() function provided with all the parameters. My problem is that the public key that I get is in the compact form (I only have the X part and a bit to indicate which Y part to choose) so I have to calculate the Y part separately before running the verification. To get the Y part I must use the ECC curve function y = modular square root of (x^3 + a.x + b). The parameters are 192 bits long so I can't just directly calculate everything so I tried using the PKA Arithmetic function but I cannot get them to work. The function just gets stuck until timeout. With the HAL_MAX_DELAY it just stays stuck forever. Here is the code below: //Just a mockup of the actual code uint32_t number1[6] = {0x12345678, 0x9ABCDEF0, 0x13579BDF, 0x2468ACE0, 0x02468ACE, 0x13579BDF}; uint32_t number2[6]
Hello,I have implemented most of the functions required for decompressing the public key using the PKA arithmetic functions. But, I'm encountering a timeout error with HAL_PKA_ModExp, even when setting a high delay with HAL_MAX_DELAY. Additionally, the output data is incorrect. Here is a simplified version of my code:uint8_t data[96] = {0x9c, 0x29, 0xec, 0x4b, 0xd7, 0x69, 0xf4, 0xe9, 0x30, 0xc7, 0xb0, 0x14, 0x2e, 0x51, 0x81, 0xff,0x98, 0x8c, 0xb1, 0xa0, 0x3e, 0x66, 0xf8, 0xcc, 0x62, 0x13, 0xb5, 0xed, 0xf6, 0x89, 0xfc, 0x9d,0x37, 0x0e, 0xa0, 0x94, 0xfe, 0x9e, 0x8d, 0xd5, 0x64, 0xf9, 0x05, 0x28, 0x22, 0x42, 0xfd, 0x87,0xec, 0xb2, 0x99, 0x5c, 0xaf, 0x3c, 0x0d, 0x9d, 0xd7, 0xcf, 0x2f, 0x35, 0xda, 0xf0, 0xcb, 0xc7,0xb8, 0xcd, 0x7c, 0xc1, 0xe0, 0xed, 0xa6, 0x13, 0xe5, 0xbd, 0x07, 0xfb, 0x81, 0x80, 0xb6, 0x4a,0x1a, 0x27, 0x80, 0xd9, 0xd8, 0xc5, 0x28, 0xa0, 0xae, 0xe2, 0xb2, 0xef, 0x93, 0x37, 0x91, 0xa3};uint8_t exponent[32] = {0x3f, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
Hello,I am implementing Secure Manager V1.2.0 from X-CUBE-SEC-M-H5 in my firmware. I am following the instructions provided in the "How to start with Secure Manager (customized configuration) on STM32H5" page.Is it possible to configure Option Bytes outside of the specific registers described on that page?To clarify, I am developing firmware for the STM32H573VI and plan to incorporate Secure Manager V1.2.0. My non-secure application requires High-Cycle Data, which can be set through the EDATA1R_PRG register.
Hi all!I’m starting with secure zone projects using the STM32U575RIT6 microcontroller. First, I want a project with the secure zone active, and that jumps to the non-secure zone to print a message. However, when jumping to the secure zone (NonSecure_ResetHandler();) , it enters to error function (void HardFault_Handler(void)) .I have created a empty project, with this IOC: In secure zone, main.c: #define VTOR_TABLE_NS_START_ADDR 0x08100000ULAnd in NonSecure flash:MEMORY{RAM (xrw) : ORIGIN = 0x20040000, LENGTH = 512K /* Memory is divided. Actual start is 0x20000000 and actual length is 768K */SRAM4 (xrw) : ORIGIN = 0x28000000, LENGTH = 16KFLASH (rx) : ORIGIN = 0x08100000, LENGTH = 1024K /* Memory is divided. Actual start is 0x08000000 and actual length is 2048K */}Does anyone have an idea of what might be happening? Think you in advance! :)
Hello Team,We are developing a bootloader for STM32H745 MCU. Follwoing are requirements, 1. SDcard will contain the images for M7, M4 and External QSPI flash connected to H745 MCU2. Planning to use Secure boot such as SBSFU. Please suggest if this is fine or any other option for secure boot considering available reference codes etc.3. Bootloader will have touchGFX for displaying firmware upgrade progress Please suggest reference codes available which can be refered for SBSFUThanks & Regards, Anuj
The STM32U585 chip comes with a pre provisioned device unique public / private key pair which can be used for SFI.Is there a way to be able to work with this key pair outside of SFI for our own custom use case?I know that we can export the device certificate from the stm32u585 using cubeprogrammer's getcertificate (-gc) command and this certificate would contain the device unique public key.Is there an API that allows us to work with the private key? Not looking to export or read the private key, but if I were to encrypt using the public key, is there an API that we could use to decrypt using the device unique private key?
I have a board with an STM32U575CGTx on it and I am trying to execute a simple Trust Zone Enabled program. I have 2 sample projects attached 1.) Trust Zone Disabled, 2.) Trust Zone Enabled. The project with TZ Disabled runs perfectly, toggling a GPIO line. The Trust Zone Enabled project hard faults in NonSecure_Init (). It is trying to read location 0x08100000 while executing the__TZ_set_MSP_NS((*(uint32_t *)VTOR_TABLE_NS_START_ADDR))line and hard faults there.I did this when the TZ=0 as show by the programmer tool.I tried setting the TZ=1, but now the debugger fails to fully launch when it tried to load the non-secure side with the following messageError in final launch sequence:Failed to execute MI command:load C:\\...\\STM32U5_TZ_Enabled\\NonSecure\\Debug\\STM32U5_TZ_Enabled_NonSecure.elfI am still able to program the non-secure file with the programmer however. I did add the non-secure side as a 'startup' project in the secure project's debug configura
Hi there,My STM32H573I-DK demo board is stuck in PROVISIONING state, probably as the result of a failed or aborted provisioning operation. I was doing hand-on training with the How to start with STiRoT on STM32H573 wiki. Now, I cannot regress it to OPEN, or run the provisioning.sh script again to proceed to CLOSED. Any attempt ends up in a Debug Authentication Failed error.I am aware of the importance of providing DA credentials to avoid locking the device in CLOSED state. But I don't think I missed this step, and my device is not CLOSED. Any idea how I can unlock this board ?Thanks for any support.Christian R FYI, here is the log of a regression attempt using STM32Programmer:09:34:22 : STM32CubeProgrammer API v2.17.0 | Linux-64Bits 09:34:40 : Start Debug Authentication Sequence09:34:40 : SDMOpen : 609 : open : SDM API v1.009:34:40 : SDMOpen : 610 : open : SDM Library version v1.1.009:34:40 : open_comms : 501 : open : Asserting target reset09:34:40 : open_com
Hello,I am using the STM32U575ZIT6 microcontroller and have created a simple TrustZone project where all applications run in the non-secure zone. However, when the program attempts to switch to the non-secure zone, it triggers a hard fault handler error, showing the message "no signal source available for 0xfffffff9." I have configured the secure zone as follows: #include "main.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ /* USER CODE BEGIN PTD */ /* USER CODE END PTD */ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ /* Non-secure Vector table to jump to (internal Flash Bank2 here) */ /* Caution: address must correspond to non-secure internal Flash where is */ /* mapped in the non-secure vector table */ #define VTOR_TABLE_NS_START_ADD
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.