Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
Hi everyone,Hi @Jocelyn RICARD, @D.Botelho @Jocelyn RICARDyou made this small bootloader example for testing H7 security features, e.g. RDP:https://community.st.com/ysqtg83639/attachments/ysqtg83639/mcu-security-forum/6051/1/STM32H753_SecureMem_ExampleV1.1.7zIs it possible to provision H5 MCUs and activate the closed product state using UART like the H7 example above?What i want is to implement a custom app that can get commands via UART and provision the device.I would like to have methods like: void setProductState(State state); void provisionDevice(const uin8_t* obkey,size_t obkey_size); // provisionDevice would then provision the device using the obkey send via UART. I see in the reference manual that the RSS offers functions that i can use for the provisioning.But i read somewhere that in PROVISIONING State the flashed application won't run and the device waits to be provisioned via debugger. If that is the case my idea described above won't work because a
Hi ST Team, I am using STM32H7S78-DK development board.I have read and tested following article:https://wiki.st.com/stm32mcu/wiki/Security:STiRoT_for_STM32H7Shttps://wiki.st.com/stm32mcu/wiki/Security:OEMiRoT_OEMuRoT_for_STM32H7Shttps://wiki.st.com/stm32mcu/wiki/Security:How_to_start_with_STiRoT_OEMuRoT_on_STM32H7SI need some help on my project.In How_to_start_with_STiRoT_OEMuRoT_on_STM32H7S wiki page, I got the correct result following "1.5 Full regression" section. But for the "3.1 Debug Opening procedure" section, I got error message after clicking "Execute". The life cycle after clicking discover is "ST_LIFECYCLE_CLOSED (Debug opened)". Any method to fix this error?10:31:36 : STM32CubeProgrammer API v2.20.0 | Windows-64Bits 10:37:49 : Start Debug Authentication Sequence 10:37:49 : SDMOpen : 624 : open : SDM API v1.0 10:37:49 : SDMOpen : 625 : open : SDM Library version v1.2.0 10:37:49 : open_comms : 513 : open : Asserting target reset 10:37:49 : open_com
Hi everyone, I was trying to port TFM + TFM_SB on my STMU575ZI-Q Nucleo following this guide: https://www.st.com/resource/en/user_manual/um2851-getting-started-with-stm32cubeu5-tfm-application-stmicroelectronics.pdf and I've managed to flash secure bootloader and TFM. I've managed to do the regression of the MCU setting the option bytes. When I finally lunched TFM_UPDATE.sh script, logs appeared on tera term as expected, but in the end it got stuck in TFM BOOT log. So I disconnected the board and tried to repeat the process, cleaning and building again the TFM SB image, TFM Appl image etc... But When I tried to mass erase the system flash, an error has occurred: DEV TARGET NOT HALTED. When I reset the board and I observe tera term logs, I can see the following:[INF] Flash operation: Op=0x0, Area=0x0, Address=0x0[INF] Starting bootloader[INF] Checking BL2 NV area[INF] Checking BL2 NV area header[INF] Checking BL2 NV Counter consistency[INF] Consistent BL2 NV Counter 3 = 0x1000000[INF] C
HelloI am developing on the STM32H7B3-DK using X-CUBE-SBSFU v2.7.0 with IAR compiler version 9.70. During the build, I encountered the following critical error:Fatal error[Li004]: file "STM32CryptographicV3.1.3_CM7_IARv8.a" is not an object or archive fileIt appears that the provided static library (STM32CryptographicV3.1.3_CM7_IARv8.a) was built with IAR v8.x and is incompatible with IAR v9.70, preventing successful linking. The static library is present in STM32CubeExpansion_SBSFU_V2.7.0\Middlewares\ST\STM32_Cryptographic\Fw_Crypto\STM32H7A3\LibCould you please advise:Is there an official version of the STM32 Cryptographic static library compatible with IAR v9.x for STM32H7B3?If not, what is the recommended procedure to rebuild or obtain a compatible library for use with IAR v9 ?Thank you for your support. @STackPointer64 @Jocelyn RICARD @Fred
Hello,I have already read the AN4758 application note and I still have a few questions regarding PCROP.I have a project for end-users where the main application provides functions (API) that users can call to develop their own code. I was originally planning to provide these functions as a static library, but since PCROP is very useful and secure, I would prefer to protect my API using PCROP instead of distributing a library with unnecessary header files.In my application, the region 0x08000000 to 0x0805DFFF contains my API code. I plan to flash this code first and then protect this area with PCROP.Here are my questions:If the end-user creates an empty project and I only provide the header files, can they still debug their own application even though the API code region is PCROP-protected?Since a PCROP-protected area cannot be read or written, is there any way to update my API code later? I have a CAN bootloader, but this region will be protected by PCROP.(I am using STM32G474RET6 with
Hi,I am using STM32H56x with OEMiROT_Boot example project, currently the swap method of the OEMiROT_Boot is "MCUBOOT_SWAP_USING_SCRATCH", can I change it to MCUBOOT_SWAP_USING_MOVE?Is there any security concern use MCUBOOT_SWAP_USING_MOVE?Regards,Snaku
I've been playing around with the TrustZone Enabled on the STM32H573 board and using this tutorial:https://wiki.st.com/stm32mcu/wiki/Security:How_to_start_with_OEMiRoT_on_STM32H573_and_563%E2%80%93TrustZone_enabledI had no trouble executing the tutorial, using the Debug Authentication, or changing the permission levels to attach the IAR Debugger to put breakpoints in the main functions of the Non Secure or Secure Applications.However, my group uses the STM32 Cube IDE, and I've been having trouble doing the equivalent using that tool. I know where to enable and set up the Debug Authentication, but I'm having trouble attaching to the running target, hitting the reset button (as instructed in the above tutorial), and having the program stop at the breakpoint I have enabled in the main function of the Secure Application (before it jumps to Non Secure Init) and displaying the associated source code. I have built all the projects (OEMiROT Boot, OEMiROT_Appli_TrustZone_Secure, and
I've been struggling with this problem for several hours.Using bare metal, I can invoke a non-secure callable from the non-secure application.When I added FreeRTOS + CMSIS RTOS v2 wrapper, and try to do the same from a thread context, I get a hard fault when I try to invoke the non-secure callable (see below)I would assume this is related to the thread stack. I am using the following:Cube MX 6.16Cube IDE Version: 2.0.0 Build: 26820_20251114_1348 (UTC)In the secure project is secure_nsc.c, I define my API: CMSE_NS_ENTRY void ToggleBackLight(void) { HAL_GPIO_TogglePin(BACKLIGHT_GPIO_Port, BACKLIGHT_Pin); } In the non-secure project, I invoke this from a thread as follows:/* Private application code --------------------------------------------------*/ /* USER CODE BEGIN Application */ typedef void (*SecureFunc_t)(void) __attribute__((cmse_nonsecure_call)); void doBlinkyThread(void *argument) { /* USER CODE BEGIN defaultTask */ SecureFunc_t secure_func = (SecureFu
HiI am using STM32L562 and sampled and flashed the Zephyr OS example for TrustMode. I could not revert back the TrustZone therefore followed the information from the link https://community.st.com/t5/stm32-mcus-security/reverting-option-byte-configuration-after-tf-m-testing-in/m-p/584225/highlight/true#M5879However, after executing the first two commands the board doesn't respond to the command. Even with the hotplug mode, I can't set RDP level back to 0 STM32_Programmer_CLI -c port=SWD mode=hotplug reset=SWrst -ob RDP=0xAA UNLOCK_1A=1 UNLOCK_1B=1 UNLOCK_2A=1 UNLOCK_2B=1 ------------------------------------------------------------------- STM32CubeProgrammer v2.20.0 ------------------------------------------------------------------- ST-LINK SN : 0046003F3137510C33333639 ST-LINK FW : V3J16M8 Board : STM32L562E-DK Voltage : 3.27V SWD freq : 8000 KHz Connect mode: Hot Plug Reset mode : Software reset Device ID : 0x472 Revision ID : Rev Z Device name : STM32L5xx Fl
Hi team, I provisioned both OEM1 and OEM2 keys. I locked the device using OEM2 key and then put the device in RDP level 2 with the below commands:STM32_Programmer_CLI.exe -c port=SWD mode=hotplug -lockRDP2 0xFEDCBA98 0x76543210Response: "Lock RDP2 password successfully done"Enable RDP2: STM32_Programmer_CLI.exe -c port=SWD mode=hotplug -ob RDP=0xCCIf you see here I used only <word1> and <word2> for password because I followed the below video for STM32U5:URL: https://www.youtube.com/watch?v=B3l6iuA7U8Q&t=752sBut STM32U3 series uses 128 bits of password rather than 64 bits used by STM32U5 series.Could anyone know/share default value that will be passed if we have missed <word3> and <word4>.
HiI am implementing the ECDSA-P256 signing for a payload.I have checked the example code https://github.com/STMicroelectronics/STM32CubeU3/tree/main/Projects/NUCLEO-U385RG-Q/Examples/CCB/CCB_Protected_ECDSA_SignatureThe example code shows that the software has an access to the private-key. Would it be possible to generate a private key using RNG which software/processor can not see and which can be used by the CCB to compute a signature. The same key can be used to get public-key. can I use this API HAL_CCB_ECDSA_GenerateWrapPrivateKey(). Would this key be persistence across reboot or do I need to store the wrapped key?
Hi teams,CPU: STM32U0Current RDP level: Level 1OEM1 RDP lock: Enabled.I had set the 128bit OEM1 key to the OEM key registers [FLASH_OEM1KEYWyR ]accordingly, and the written OEM1 key values was verified using their CRC values by reading OEM1KEYCRC register.Now I am trying to make the regression from level 1 to level 0 according to the user manual description [section: 3.5.1 FLASH read protection (RDP)]. But the operation was failed using my source code. Which is attached below#define STM32U0_DBGMCU_BASE 0x40015800 // Accessible to the software via the APB access port AP0#define STM32U0_DBGMCU_DBG_AUTH_HOST (STM32U0_DBGMCU_BASE + 0x100) // Debug authentication mailbox host register Could you please clarify the following doubts,1. The unlock sequence says, debug access port 1 has to be used for programming the 128-bit OEM1 key in the DBGMCU_DBG_AUTH_HOST register,but when I checked the DBGMCU_DBG_AUTH_HOST register base, it sa
Hello,I am trying to get the OEMiROT example projects running on STM32H563 from "STM32CubeH5\Projects\NUCLEO-H563ZI\Applications\ROT" and this page : https://wiki.st.com/stm32mcu/wiki/Security:How_to_start_with_OEMiRoT_on_STM32H573_and_563%E2%80%93TrustZone_enabled Provisioning works well, unfortunately, I'm blocked on the firmware update step through the internal bootloader. After the message 'Start download with STM32CubeProgrammer through supported interfaces (USART/SPI/I2C/USB)', when I connect CubeProgrammer with uart connection, the bootloader seems to work correctly as I received:Chip ID:0x484 Bootloader protocol version : 4.0Then, CubeProgrammer freezes for 2 mins and the device is disconnected with this message log: 09:54:32 : Error: RDP is set to level 1 or target is held under reset, try using Read UnProtect (-rdu) command in order to remove the Read Out Protection. 09:54:32 : UPLOADING OPTION BYTES DATA ... 09:54:32 : Bank : 0x00 09:54:32 : Address : 0x4
Device detailsMPU: STM32H753AII6Connection:Probe: J-Link V11.00 / SW version V7.98c STM toolset: STM32 Cube Programmer / Trusted Package Creator v2.20.0SFI programming fails with error:Error: SECURITY State FailError: Invalid state after SFI install !Error: RSS internal system error or License is invalid ! I also tried against the STM32H757I-EVAL board, which has a compatible CPU, with the same result.-----HSM provisioningHSM provisioningFor Personalization Data I chose the group with the H753 in it, and from the 4 options in dropdown list the combination of "SFI" and Device ID "45002001" which is how the STM32H753 identifies.SFI creationFor the simplified example, there is only one section of code starting from default address 0x08000000.Settings for RAM size and continuation token are default, and seem to make sense.Option bytes are, except for RDP level = 0xBB (level 1), identical to the defaults after mass erase.SFI creationSFI flashingSFI flashingComplete log:15:25:
Do all the STM32WL series MCUs support STSAFE ? If yes, how it can be done?
Hi,is there a possibility to do the complete chain to product state "closed" by non secure user code ?I have a custom bootloader which usually did a set of the old RDP Level.Now, with a STM32H57 device we have to use the new product state. I'm able to set the state to provisioning. But when i use RSSLIB_PFUNC->NSC.DataProvisioning i end up in a hard fault. I tried to set the provisioning data by ST Cube programmer later on which succeeded. But unfortunately i can not regress to open because the password is wrong. Any hints about that ? Thanks in advance.
Does ST offer an implementation of hardware acceleration of mbedtls-2021?I found this:STM32CubeL5\Projects\STM32L562E-DK\Applications\TFM\TFM_Appli\Secure\Src\ecdsa_alt.cSTM32CubeL5\Projects\STM32L562E-DK\Applications\TFM\TFM_Appli\Secure\Src\ecdsa_curves_alt.cfrom https://github.com/STMicroelectronics/STM32CubeL5.gitThis is excactly what I want (a bridge between mbedtls and the PKA_HAL driver), but it's for a 2019 version of mbedtls, and the mbedtls folks since broke the interface, so it doesn't compile. (and it doesn't look like an quick/easy fix)Is there a newer version somewhere?/Troels
I try to understand in details the way the Hash peripheral works on the STM32L552. I need to make the HASH SHA-256 with 224 blocks of 512 bits. The Hash works perfectly until the block 223. Then I enter 16 values in the FIFO (in my code below I have a loop for 15 because I entered previously another value). Then I launch the final digest. I expect the automatic digest of block 224 and the automatic padding in a block 225 to the final hash value. But I always have the wrong value in the final step. Any idea about what I'm missing?
Hello. I'm working with STM32H573. I have a question related with the use of STSAFE-A110 for TLS. I have to authenticate also the client. I've succeded stablishing TLS mutual authentication with HTTPS server and TCP server (different applications, not related) using this type of functions from NetxDuo with the correct data and test certificates: /* TCP Server */ nx_secure_tls_session_create(); nx_secure_tls_ecc_initialize(); memset(&certificate, 0, sizeof(certificate)); // Server Local certificate nx_secure_x509_certificate_initialize(); memset(&certificate_, 0, sizeof(certificate_)); // Client certificate nx_secure_x509_certificate_initialize(); nx_secure_tls_local_certificate_add(); nx_secure_tls_trusted_certificate_add(); nx_secure_tls_session_start(); /* HTTPS */ memset(&certificate, 0, sizeof(certificate)); // Server Local certificate nx_secure_x509_certificate_initialize(); memset(&certificate_, 0, sizeof(certificate_)); // Client certificate nx_secure_x
I am using mbedtls module to verify the signature of firmware using RSA and its giving MBEDTLS_ERR_PK_INVALID_PUBKEY after parsing the public key. I am using OpenSSL for generating public and private keys the public key is generated using openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048andopenssl rsa -pubout -in private_key.pem -outform DER -out public_key.derin der format and then converted to a .h file using python -c "data=open('public_key.der','rb').read(); print('const unsigned char public_key_der[] = {'); print(', '.join(f'0x{b:02x}' for b in data), end=''); print('};'); print(f'const unsigned int public_key_der_len = {len(data)};');" > public_key.hIn the mbedtls_config.h file I have enabled the following things#define MBEDTLS_PKCS1_V15#define MBEDTLS_PK_C#define MBEDTLS_PK_PARSE_C#define MBEDTLS_RSA_C#define MBEDTLS_BIGNUM_C#define MBEDTLS_ASN1_PARSE_C#define MBEDTLS_OID_CHere is the main function I am using to parse the public
Hi, I am using ADC1 on stm32H563ZI nucleo board with trustzone enabled, I am not getting proper adc values (getting adc count of 822). When trust zone is disabled I am getting proper value of around 4095 with input of 3.3Volt .I am attaching the project.Please help with this issue.
I’m using STM32WL5MOCH6STR and want to add STSAFE-A110 for security in a LoRaWAN application.I want to know:How to use STSAFE-A110 for authentication, key storage, encryption and secure boot & secure firmware update.Which software packages are needed to implement this security feature(like X-CUBE-STSAFE, X-CUBE-LRWAN, or others)?Is there any example or application note for STM32WL + STSAFE-A110 integration?Kindly let me know if there are any ways or recommended methods to achieve security with help of STSAFE-A110 with STM32WL MCUs.Thanks in advance!
Hello STM32 Community,I’ve successfully built a Zephyr RTOS blinky application for the NUCLEO-H533RE board. Flashing the zephyr.hex using west flash or STM32CubeProgrammer works perfectly — the LED blinks and the serial terminal prints the expected status messages.To enhance security, I’m now trying to encrypt and sign the firmware using STM32TrustedPackageCreator and provision the board using STiROT. I followed the STM32CubeH5 GitHub examples and used the STiROT_Code_Init_Image.xml file, modifying it to point to my zephyr.bin. Provisioning was successful, and the board state was set to PROVISIONED.However, after flashing the generated zephyr_enc_sign.hex, the board does not blink, and the serial terminal remains silent — indicating the firmware is not executing.Here’s what I’ve done:Used STiROT/Image/STiROT_Code_Init_Image.xml and modified paths to point to zephyr.bin.Generated the encrypted and signed image using STM32TrustedPackageCreator.Successfully provisioned the board and set i
Hi,I come to you about the key provisioning process for the iROT in the STM32H5.Using TrustedPackageCreator, the keys provided in the file STiROT_Config.xml for the Secure Boot (field <Authentication key>) are both the private and public keys of the .pem file. However, only the public key is needed, and will be embedded in the device. This method of provisioning is limiting for us for two reasons:- on the one hand, it doesn't allow to subcontract the provisioning task, as we don't want to give the private key to the subcontractor- secondly, the private key may be generated by an HSM and cannot leave the vault. So, is there a way to provision only the public key at this stage? Best regards,Christine
Hello,I'm using STM32F439 with LWIP, SNMPv3, and mbedTLS, without FreeRTOS. I've encountered a performance issue when using the hardware acceleration for AES and SHA1 provided by ST (aes_alt.c, sha1_alt.c).Specifically, when decoding SNMPv3 messages, the software implementation of AES128 + SHA1 from mbedTLS is significantly faster than the hardware-accelerated version. I measured the execution time of snmp_receive() using a timer:- mbedTLS software AES128 + SHA1: ~800 µs- mbedTLS + ST-provided hardware AES (aes_alt.c) + SHA1: ~2.4 msThis is a 3x slowdown when using the hardware path.Can anyone explain why the hardware implementation is slower? Is this expected behavior due to HAL overhead, lack of DMA, or something else?Thanks in advance for any insights!Best regards, Piotr
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.