Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
HiI've been trying to understand what level of support is available for the H573 security features in Zephyr RTOS with mcuboot but either can't find any information or no one replies to my comments.I have a Zephyr sysbuild build working where mcuboot starts, validates the singed application in slot0 and proceeds tp boot from slot0.What I can't find or confirm is if that security features of the STM32H573 are being used or not. There doesn't seem to be any configuration relating to enabling or disabling the features.Are the security features enabled in Zephyr for the H573?I'm using the latest 4.2 version of Zephyr.CheersDave
Dear Community, dear STMicro, I'm trying to encrypt data on an STM32WL55JC device using the STM32CubeExpansion_Crypto_V4.5.0 library and then using Python on the PC to decrypt it again.I've taken the example code for RSA encryption from the librarySTM32CubeExpansion_Crypto_V4.5.0/Projects/NUCLEO-WL55JC/Applications/RSA/PKCS1v2.2_EncryptDecryptand adapted it.I've created an RSA 2048 bit key on my PC using this code:private_key = rsa.generate_private_key( public_exponent=65537, key_size=2048) pem = public_key.public_numbers() public_exponent = ["0x%02s" % e[i:i+2] for i in range(0, len(e), 2)] n = "%X" % pem.n n = "0" + n if len(n) % 2 == 1 else n modulus = ["0x%02s" % n[i:i+2] for i in range(0, len(n), 2)] f = open("pub.c", "w") f.write("public_exponent[] = {%s}\n" % ", ".join("%s" % s for s in public_exponent)) f.write("modulus[] = {%s}" % ", ".join("%s" % s for s in modulus)) f.close() From this code I get something like thispublic_exponent[] = {0x01, 0x00, 0x01} modulus[]
I am trying to integrate Crypto lib to NUCLEOF303RE Board, Any guide or any suggestions would help
Hi all,I'm trying to replay the demo from this video https://www.youtube.com/watch?v=Kn6JHVcY7hA The provisioning and debug authentication works fine, but the application hangs.I never passes the MX_ICACHE_Init() function. And sometimes in the MPU init or config function. The project is standard generated code, I'm using STM32H573I-DK but empty chip project like in the video.Project settings : Select STM32H573IIKxQ Click yes on enabling ICACHE and MPU Enable trustzone Secure project only Generate DA folder Bootpath : STiRot + Secure Application (offset 0, offset 0x100000, size 0x100000) PI9 as output and PC13 as input Generate project Add loader.h and loader.c and add blinky like in the video The project was imported in STM32CubeIDE 2.1.1 and build fine.I've used provisioning.bat to provision my board to CLOSED. LD1 on the board turns on but doesn't blink.After connecting to the board with Debug Authentication it seems to hang in MX_ICACHE_Init -> if (HAL_ICAC
Hi All!I'm trying to wrap my head around STM32H573 with trustzone, STiRoT etc in STM32CubeMX and I'm missing some information on the firmware sizes.The STM32H573 has 2MB flash, secure part is from 0x0C00_0000 to 0x0C1F_FFFF. When I select STiRoT + Secure partition and open OBkey settings I want to use maximum firmware size, which is 1MB in my understanding (download area must be same size as application area). So I set firmware offset to zero, firmware download area offset to 0x0010_0000 and firmware area size also to 0x0010_0000. When I generate obkey it gives me firmware slots 0 with address 0x0C00_0000 with size 0x10_0000 and slot 1 with address 0x0C10_0000 with size 0x10_0000. But the mapping says Start address 0x0C00_0400 and End address 0xC0F_FFFF which is different from the configured address/size.If tried going to Tools -> Memory Management but that gives a different image again!That gives a size of 123kB and address range 0x0C00_0400 - 0x0C01_EFFF, which appears t
I got an error when downloading the .sfi file to STM32H753II using the STM32Programmer_CLI, my HSM version is V2AE.The error message is as follows: What its mean?V2AE cannot support STM32H753,and must use HSM_V1?or H753 cannot support SFI ?I’m a new use about SFI.Looking forward to your reply.
Hello All,I have a certain STM32H7 that I can't erase sector 0 using STM32CubeProgrammer.I think it is because PROT_AREA_START1 and PROT_AREA_END1 are not correct. I am trying to get back to default values of PROT_AREA_START1 =0xFF (0x0800ff00)PROT_AREA_END1 = 0x00 (0x080000ff) to disable the protection.However I cant Actually change the option bytes through the programmer. I get:an error: "Expected Value for option byteP: "PROT_AREA_START!: 0xFF, fount 0x00"RDP is level 0 (AA)I am using ST-link. Thanks for any help,Trevor
Hi EveryoneRequesting clarification on one topic:Does STM32U585 have support for PQC algorithm with any software library that has been validated on the same controller, as there is a requirement for PCI PTS 7, that the device should support PQC Algorithm and we need an evidence to show the same for the same controller. On searching XCube-PQC Library supported devices mentions STM32H563ZI only.Requesting confirmation in this regardThanks and RegardsPhilip
Hello ST team,We are working with the STM32WL5MOC6HTR module for a LoRaWAN end-device design.We understand that the STM32WL5MOC6HS variant includes an STSAFE-A110 secure element, but our custom module (MOC6HTR) does not include STSAFE.Our question is about securely storing LoRaWAN keys such as:AppKeyNwkSKeyAppSKey We are exploring options like:Using the LoRaWAN Crypto middleware (Middlewares/Third_Party/LoRaWAN/Crypto) with the internal AES peripheral,Leveraging SBSFU (Secure Boot and Secure Firmware Update) for Flash protection (RDP/PCROP),Or possibly using KMS-MW (Key Management Services Middleware). Could you please confirm:What is the recommended approach for securely storing LoRaWAN keys in the STM32WL5MOC6HTR, where STSAFE is not present?Can KMS-MW or SBSFU be used on this device to provide a secure key storage area or API abstraction similar to a secure element?Are there reference examples or application notes for integrating LoRaWAN key storage with SBSFU or KMS on ST
Hello.I'm having trouble transfer the UserApp to SBSFU. Here's the description of the issue.I am working on SBSFU on STM32H753-Eval, So i altered the given sample for my UART to map to ST-LINK VCP. I am able to see logs post this changes. Later I Dissabled all security stuffs with below macro and fully erase the board (by setting RDP level 1->0 ).I'm using the 2-Image example code, All security feature were disabled by#define SECBOOT_DISABLE_SECURITY_IPS in app_sfu.h. I loaded SBSFU.elf onto the board and transferred the UserApp.sfb via YMODEM. However the program went into a infinite reset loop. It is rebooting every time i send UserApp.sfb. I tried Increasing the Download Timeout from 3000 to 10000 from this macro, same issue /* Teraterm YMODEM */ /* #define SFU_COM_YMODEM_DOWNLOAD_TIMEOUT ((uint32_t)3000U) */ #define SFU_COM_YMODEM_DOWNLOAD_TIMEOUT ((uint32_t)10000U) /* IIs there any specific step i need to follow ?... kindly guide me here.&nb
Left commented out SFU_NO_SWAP and defined ENABLE_IMAGE_STATE_HANDLING in app_sfu.h, but when trying to build SECoreBin and SBSFU errors appear:/Middlewares/ST/STM32_Secure_Engine/Core/se_fwimg.h:47:61: error: unknown type name 'SE_FwStateTypeDef'Is there something I am missing? I selected AES-GCM crypto schemeI have followed https://www.st.com/resource/en/application_note/an5056-integration-guide-for-the-xcubesbsfu-stm32cube-expansion-package-stmicroelectronics.pdf (Chapter 8.5)
Hello everyone,I'm working with the STM32L562E-DK board and the STM32Cube_FW_L5_V1.5.0 firmware. I want to integrate my own code (which reads a sensor MPU6050 via I2C) into the STM32CubeL5 TFM (Trusted Firmware-M) application, running it in the Non Secure environment. The base project I'm using is TFM_Appli, which comes in the package, and I've added my source code to the NonSecure section.I created a separate project in STM32CubeMX using the board's I2C1, which utilizes pins PB6 (SCL) and PB7 (SDA). I then generated the code and copied the I2C communication initialization code into the "main.c" file of my "TFM_Appli_NonSecure" project. Specifically:/* This is before "int main (void)"-----------------------*/ I2C_HandleTypeDef hi2c1;/*------------- I'm calling these function from "int main(void)" ------------*/ static void MX_GPIO_Init(void) { /* USER CODE BEGIN MX_GPIO_Init_1 */ /* USER CODE END MX_GPIO_Init_1 */ /* GPIO Ports Clock Enable */ __HAL_RCC_GPIOB_CLK_ENABLE(); __H
Hello,I am using STM32H750 and X-Cube-Crypto lib. I am working on a secure boot and want to calculate the app Hash value to check integrity. The library works fine for STM32L5 Mcu (Already tested) but not with STM32H750. I verified that I am using the correct lib libSTM32Cryptographic_CM7.a.The issue I get is a Hardfault triggered by a function in the lib. When I investigated more, I found that The Mcu tries to load data from a Peripheral Register not mapped for STM32H750 MCU.What do yo think could be the issue? Thanks,Ayoub
Hi, I am working with the SBSFU_Boot on the STM32U5A9 chip. After the SBSFU_Loader has written the update image into internal memory, a reset happens in order for the SBSFU_Boot to write the image to be booted. When performing the update, it ends up in a process where it has to do some encryption. The SAES engine is initialized successfully, and then AES_Encrypt is called. This keeps on failing because a read error is reported in the SAES->SR reports a read error upon enabling the SAES peripheral. It should be noted that the initialization and encryption sequence is strictly followed per instructions in RM0456 Rev 6 sections 50.4.4 (Initialization of SAES) and 50.4.8 (ECB/CBC encryption sequence) respectively. What am I missing?
Hello,I am following the blog "Implementing Debug Authentication on STM32H5 using CLI tools" (https://community.st.com/t5/stm32-mcus/implementing-debug-authentication-on-stm32h5-using-cli-tools/ta-p/622308) to provision my STM32H533RE based custom board on which i have configured secure word only(All the peripherals configured as secure) and i have disabled Non Secure Project from "Project Manage" tab of STM32CubeMX, and I am now stuck with the device in CLOSED state with no way to regress.Environment:Board: NUCLEO-H533RE (STM32H533RET6)STM32CubeProgrammer: v2.22.0STM32CubeH5 Firmware: v1.6.0ST-LINK FW: V2J47S7SFSP Version: v1.2.0OS: WindowsWhat I did (step by step):Step 1 — Flashed secure firmware (succeeded with mode=UR):STM32_Programmer_CLI.exe -c port=SWD mode=UR -e all -d C:\H5\Binary\Sec_FP_Sensor_v1_2_Secure.elf -vResult: :white_heavy_check_mark: Download verified successfullyStep 2 — Set product sta
Hi,I am setting up SBSFU on our STM32H750. I want to test the RDP and WRP security protections.Steps taken so far:I have enabled WRP and RDP Level 1 by setting the option bytes through cubeprogrammer and enabling SFU_WRP_PROTECT_ENABLE & SFU_RDP_PROTECT_ENABLE in app_sfu.hI have enabled SFU_TEST_PROTECTION in app_sfu.h Note:There are several test cases in sfu_test.c that I am using. The tests in questions are attached below:TEST_ERASE_FLASH is failing. Output:I am not sure why this would be. Does anyone have any advice?
When we provision the Secure Manager on the STM32H5 and there is no non-secure application available (yet), then the Secure-Manager-Demo-Application currently starts flashing all LEDs on the STM32H573I-DK.Now we wonder how this would affect our project-specific hardware if the provisioned Secure Manager configures some ports and starts toggling PF1, PF4, PI8 and PI9.So, what peripheral does the Secure Manager configure/use? And how are they configured?Is it possible to suppress/remove this Secure-Manager-Demo-App (SMAK_Appli)? => no port configuration, no LED togglingbr, Oliver
Hi,I have a question regarding STiRoT provisioning on the STM32H573.As I understand, during the Secure Boot provisioning process, the public key hash is injected into the OBKeys area of the device to establish the root of trust. However, I would like to clarify where the original public key itself is stored and how it is handled during runtime verification.Based on our current design, we are planning the following approach:The firmware image is signed using our own external HSM, not STM32HSM.The corresponding public key hash is provisioned into the device OBKeys during manufacturing.At boot time, STiRoT checks that the public key contained in the firmware image matches the provisioned public key hash, and then uses that public key to verify the firmware signature.From this perspective, our understanding is that the device does not store the full public key in its internal non-volatile memory (e.g., OBKeys or other secure areas), but instead relies on the provisioned public key hash in
I am trying to understand SMiRoT and SMuRoT for product development based on the STM32H573 and Secure Manager, but from the public documentation they both look mostly like black boxes.Since they seem to be built on top of STiRoT / STuRoT, I am currently trying to understand STuRoT first.For STiRoT, AN6007 Appendix A / Figure 11 is very useful because it provides a clear high-level startup sequence.It helps explain the logic of reset, runtime protection activation, secure firmware update handling, uRoT image verification, bootloader fallback, and jump to uRoT.But for STuRoT, I cannot find any equivalent public document that shows its internal startup sequence or high-level state flow.At the moment I can only infer that after STiRoT verification, STuRoT runs in HDPL2 secure mode, reconfigures its secure context/MPU, verifies the user application, and then executes it. But I have not found an official flowchart or sequence description.So I would lik
Hello, I am working with the STM32H745 using a Lauterbach TRACE32 debugger and i am evaluating ways to control Readout Protection (RDP). I am able to configure RDP levels using STM32CubeProgrammer, however I would like to achieve the same using a TRACE32 (.cmm) script, without relying on the ST programmer. Is there any recommended or reference TRACE32 PRACTICE (.cmm) script for setting and reverting RDP levels (Level‑0 to Level‑1) and (Level‑1 to Level‑0) on STM32H7 devices? I could not find any official examples demonstrating direct RDP control using .cmm script. Is it supported or recommended to control RDP level changes from firmware on STM32H745? While setting RDP from Level‑0 to Level‑1 is possible, reverting from Level‑1 to Level‑0 results in a mass erase. When reverting RDP from Level‑1 to Level‑0, is the mass erase automatically triggered by the hardware as part of the RDP regression, or is there an additional register or command that must be explicitly programmed t
Hi,I am trying to create a trustzone application for my board, but suddenly I could no longer flash to non-secure memory. Secure memory flashing still works fine. What am I doing incorrectly?Thank you in advance,Michalthe failing flash (fails even if I flash template trustzone project from CubeIDE)PS C:\Users\test> STM32_Programmer_CLI.exe -c port=SWD mode=HotPlug -d test16.bin 0x08020000 -v ------------------------------------------------------------------- STM32CubeProgrammer v2.22.0 ------------------------------------------------------------------- ST-LINK SN : " ST-LINK FW : V2J47S7 Board : -- Voltage : 3.28V SWD freq : 4000 KHz Connect mode: Hot Plug Reset mode : Software reset Device ID : 0x455 Revision ID : Rev Y Device name : STM32U535/STM32U545 NVM size : 256 KBytes Device type : MCU Device CPU : Cortex-M33 BL Version : -- Debug in Low Power mode enabled ------------------------------------------------------------------- Choose flashing speed for Cortex M33 series.(
Hello. I am trying to encrypt/decrypt data in secure area of stm32h563 (Trustzone application), using code from one of the examples (using cmox_cipher_encrypt function). Running the function in non-secure area, everything works fine. Trying to run that in secure area immediatly hardfaults. It seems like problem might be that the library tries to access something in the non secure area. Initial thought was CRC engine, but in cubemx i specificly initialized that to secure area because it will be used in there. Is there some known workaround or updated libraries to use cmox_cipher_encrypt in secure area?
Hello everyone.I'm novice in cryptografic,I'm developing a project with STM32H7.I have a file on uSD and I can read it using FatFs.I have to crypto this file using CRYP_AES_GCM.I setup IOC in this wayThe IOC build this file for meMy file has 98MByte of size but I cannot fit the whole size in a Heap Buffer because free space in Heap is 60KByte but I can prefer to reserve at least 32KByte to have some space available for other c++ objects.So I develop a code that reads 32KByte-chunks from the source file and crypto this chunk before to write in the crypted file.But I have a dubt: to crypt this chunk of file I call HAL_CRYP_Encrypt(&hcryp, (uint32_t*)ptr, (byteRead+3)/4, (uint32_t*)ptr, 1000UL);But if I inspect this API I notice that it resets some sort o f counter So I think that I'm wrong because probably I have to not reset this counter and, instead, put the next chunk to the crypt. Is my doubt a certainty ? And there is a way to check, once the file i
Hello everyone!I’ve been struggling for a while with TrustZone projects on the NUCLEO-U575ZI-Q. I’ve tried both the STM32CubeU5 example projects (Templates/TrustZoneEnabled/ and Examples/GPIO/GPIO_IOToggle_TrustZone/) and my own CubeMX-generated project, but I can’t get any of them to run successfully. I'm using STM32CubeIDE.I've tried running the example projects, this is the error I get when building:make: *** No rule to make target '/home/Drivers/STM32U5xx_HAL_Driver/Src/stm32u5xx_hal.c', needed by 'Drivers/STM32U5xx_HAL_Driver/stm32u5xx_hal.o'. Stop.I've set the Option bytes correctly, Secure Area 2 is set to NonSecure and TZEN bit is set to 1.I've also generated a project with CubeMX:Enabled TrustZone, applied Application Regions Settings to Linker files/Peripherals.When the non-secure world calls NonSecure_ResetHandler(), I get a HardFault at address 0x08100d81.Questions:How can I fix the Makefile error in the GitHub examples?Why would calling NonSecure_ResetHandler() from a Cube
I'm recently working on benchmarking a various implementations and configurations of cryptographic algorithms such AES-GCM on STM32. Two of these tested function are the following :void test_aes_hardware(void) { uint32_t plaintext[DATA_SIZE/4]; uint32_t ciphertext[DATA_SIZE/4]; uint32_t decrypted[DATA_SIZE/4]; uint8_t key_bytes[32]; uint8_t iv_bytes[16]; uint32_t key[8]; uint32_t iv[4]; uint8_t ikm[4]; uint8_t salt[4]; uint8_t info1[] = "HW_AES_KEY"; uint8_t info2[] = "HW_AES_IV"; uint32_t rnd; /* RNG */ HAL_RNG_GenerateRandomNumber(&hrng, &rnd); memcpy(ikm, &rnd, 4); HAL_RNG_GenerateRandomNumber(&hrng, &rnd); memcpy(salt, &rnd, 4); /* KDF */ xkdfBlake(key_bytes, 32, ikm, 4, salt, 4, info1, sizeof(info1)); xkdfBlake(iv_bytes, 16, ikm, 4, salt, 4, info2, sizeof(info2)); memcpy(key, key_bytes, 32); memcpy(iv, iv_bytes, 16); for (int i = 0; i < DATA_SIZE / 4; i++) { uint32_t w = (i*4 + 1) |((i*4 + 2) << 8) |((i*4 +
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.