Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
Hello,I am using the sbsfu application. Once I have implemented the SBSFU firmware to the board, when I connect the board to the STM32Cubeprogrammer, the SBSFU application is in lock status because it has detected an intrusion. I would like to add a printf warning about the intrusion as soon as possible when this situation happens or when someone unauthorized tries to update the firmware. Is it possible to do the following and where should I add it?
I'm using an STSAFE-A110 chip with SPL02 profile on a custom board and trying to get StSafeA_WrapLocalEnvelope() function working. I've already successfully paired my chip with my MCU/FW by writing the default host MAC key from the ST examples to the STSAFE chip:{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}.I generated envelope slot keys and checked for them with the StSafeA_LocalEnvelopeKeySlotQuery() function, and both key 0 and 1 slots have the envelope keys.A call to StSafeA_WrapLocalEnvelope(gStsafeHandle, keySlot, dataIn, dataInSize, &localEnvelopeInfo, STSAFEA_MAC_HOST_CMAC, STSAFEA_ENCRYPTION_NONE) returns STSAFEA_INVALID_CMAC. I don't know why that means and I'm looking to find out what this error code might mean. And perhaps more importantly, how do I debug this issue? @Benjamin BARATTE I'm on the Nordic nRF52832 platform using Nordic SDK and the version of mbedTLS they provided,
Hello,I've added the OEM2KEY AND OEM1KEY to the RDP Level 2 protection in order to perform the same steps as in the 'Getting started with STM32CubeU5 TFM application' for enabling Production Mode.Following the steps and executing the HARDENING.SH file, I'm no longer able to modify the board or revert to RDP level 0. It's showing me the following error: Error: ST-LINK error (DEV_TARGET_NOT_HALTED)If I enter Hotplug mode, it shows me the following: Error: Uploading Option Bytes bank: 0 failed Error: Initializing the Option Bytes failed. Any help?
Hi,[EDIT 3] there is no need to configure GPIOC pin 0,1 and 2 as secure to be used by ADC1 since all GPIO are secure by default when TZEN = 1. cf. RM0456 § 3.5.6 "activating TrustZone security". This is why you do not find an of this in generated code by MX. [EDIT 2] : I fixed few typo, and also fixed my explanation : I made few confusion when reporting my notes ==> both DMA channel 10 source and destination are secure, with source == ADC1 channel 10 and destination (via linked list) is a buffer in SRAM3.A bit of context: I have to start ADC conversion on 3 channels, with ADC1, and it must be done in Secure world.To do things step by step I first started with no TrustZone activated, and from STM32CubeMX I successfully generated code to use ADC1 on 3 channels, with DMA in linked list mode, without Trust Zone activated.Note: the code generated by MX does not include anything to "link" the ADC1 with the DMA linked list, so I had to take the code from the example available "ADC DMA
Hi @Jocelyn RICARD Greetingswe are trying to run TFM example (with secure and non secure project) taken from GPIO_Toggle_TZEN Example and adding SPI communication in the non secure project on our custom board mounted with STM32U585aii6q controller SPI is getting stuck at timeout error(in the transmit function/receive function. Init function is working fine).we tried the same on B-U585-IOT2A controller and the communication is working perfectly. to verify our hardware we tried the SPI communication on the same board without TFM and its working perfectly.we wanted to know if there is any other additional dependency while using TFM to add peripherals like SPI. with TFM configuration GPIO is working fine without any issues.Awaiting your valuable suggestions so that we can understand and resolve the issue.Thanks and RegardsPhilip
Hello,I'm trying to figure out how to properly use STM32WB55 PKA registers for RSA key generation and encryption/decryption. I have chosen small (63 bit) primes for generating RSA private key, which worked perfectly. However, I am having trouble with encryption. As far as I understand, simple encryption/decryption for RSA is just modular exponentiation using message as a base, public exponent for encryption, private for decryption and a modulus. However, I have wrong result for encryption and can't figure out what I do wrong.Here is pseudocode, how I set up the process: uint32_t message [] = [0x656C6C6F, 0xDD810048, 0x6D1F8EDA, 0x12327939]; uint32_t public_exp [] = [0x00010001, 0, 0, 0]; // 65537 uint32_t modulus [] = [0x1b8abb91, 0xe2c25d78, 0x5f41a975, 0x90275365]; // Calculated from primes PKA->enable(); PKA->set_mode(MontgomeryParameterComputationThenModularExponentiation); PKA->ram(0x400).write(32); // Exponent length, tried changing it already, many times PKA->ra
Hello ST Community,I'm currently working on a project using the STM32WB55 MCU and am in the process of implementing Secure Boot and Secure Firmware Update (SBSFU) in my custom application. As part of this, I decided to test the existing 1_Image_SBSFU example before integrating it into my application. However, I'm encountering some issues and would appreciate your guidance.Issues Encountered:Application Not Working:The bootloader appears to be functioning correctly. I can see the STM_OTA device in the ST BLE sensor mobile application.When attempting to perform an OTA update using the my application file, it results in an error.Conversely, using the UserApp.sfb file for OTA update works and presents multiple test options (as shown in the attached images).STM32WB Board Access Issue:After these attempts, I'm now unable to access my STM32WB board via ST-Link for flashing and debugging purposes.Can anyone provide a step-by-step guide on how to properly test this firmware? Are there any
Hi ,i am using STM32L4R9 based dev board STLINK-V3MINIE and wanted to use SBSFU, used the example code STM32L432KC_Nucleo_1_image from the library and flashed the SECoreBIN followed by SBSFU and then the userAPP code, but while flashing userAPP ,i got the below error,/*STMicroelectronics ST-LINK GDB server. Version 6.1.0Copyright (c) 2022, STMicroelectronics. All rights reserved.Starting server with the following options:Persistent Mode : DisabledLogging Level : 1Listen Port Number : 61234Status Refresh Delay : 15sVerbose Mode : DisabledSWD Debug : EnabledInitWhile : EnabledWaiting for debugger connection...Debugger connectedWaiting for debugger connection...Debugger connectedWaiting for debugger connection...-------------------------------------------------------------------STM32CubeProgrammer v2.10.0------------------------------------------------------------------- Log output file: c:\users\abinay~1.lda\appdata\local\temp\stm32cubeprogrammer_a21060.logST-LINK SN : 00350012
Hi,I have read datasheet of STM32F103VCT6, it does not mention anything about code read out protection. Does STM32F103VCT6 has this function? (a security function to protect STM32F103VCT6 from reverse engineering)Thank youDavid Kean
We managed to successfully run TFM_SBSFU example for the IOT02A board. We are using latest STM32Cube_FW_U5_V1.2.0.The problem is that we do not have access to PSRAM from NonSecure application when in memory mapped mode.We implemented PSRAM init by importing drivers from BSP package into TFM Example, and initializing PSRAM imidiately in main, adter COM_Init(). For the test, we tried without changing GTZC_TZSC_MPCWM and SAU registers from secure app.As expected, we are getting Secure Failed handler, with the information that we tried to access protected memory. All as expected.Than we implemented memory area unprotection in TFM_Appli_Secure, by adding next line of codes in function:fih_int sau_and_idau_cfg(void) { . . . . for (i = 0; i < ARRAY_SIZE(sau_init_cfg); i++) { SAU->RNR = sau_init_cfg[i].RNR; SAU->RBAR = sau_init_cfg[i].RBAR & SAU_RBAR_BADDR_Msk; SAU->RLAR = (sau_init_cfg[i].RLAR & SAU_RLAR_LADDR_Msk) | (sau_init_cfg[i].nsc ? SAU_RLAR_NSC_Msk : 0U) |
Reference: STM32CubeExpansion_Crypto_V4..1.0, MCU: STM32G474REThe cmox_ecdsa_verify(...) function is failing with a fault code of 0x6c706, which is not contained within cmox_ecc_retvals.h header file. All arguments to the cmox_ecdsa_verify(...) function have been verified and the generated signature has been verified on the development platform. Perhaps the fault code definition in the source code (not available) will provide some insight into the problem? Are there any additional steps I can take to debug this issue?
Hello,I have done a big mistake. I was testing a provisioning using the system bootloader. For that I have changed the provisioning batch files. As a result I have set the product state to closed, before the keys where loaded. Now I can not connect to the target and the standard regression does not work. Is there a way to get the device working again? Best regards,Roman Here the log:10:48:50 : Start Debug Authentication Sequence10:48:50 : SDMOpen : 602 : open : SDM API v1.010:48:50 : SDMOpen : 603 : open : SDM Library version v1.1.010:48:50 : open_comms : 495 : open : Asserting target reset10:48:50 : open_comms : 499 : open : Writing magic number10:48:50 : open_comms : 509 : open : De-asserting target reset10:48:50 : open_comms : 561 : open : Communication with the target established successfully10:48:50 : discovery: target ID.......................:0x48410:48:50 : discovery: SoC ID..........................:0x00000000_38363236_33325117_003D005E10:48:50 : discovery
I do have the document UM2262 which describes the SBSFU expansion package, but it only gives a fairly brief explanation of the prepareimage tool.
Hi Team,I hope this email finds you well. I am reaching out to inquire about documentation similar to UM2262 but specific to the STM32H5 microcontroller.We are currently working on a project that involves firmware encryption, decryption, and update processes for the STM32H5 series. To ensure the smooth execution of our project, we are seeking comprehensive documentation that outlines the procedures and best practices for implementing these processes effectively.Could you kindly provide us with any relevant documentation or resources that detail the firmware encryption, decryption, and update processes specifically tailored to the STM32H5 microcontroller?Your assistance in this matter would be greatly appreciated, as it will significantly contribute to the success of our project.Thanks & Regards,P.Hitesh
Hi All,I've got a question about the documentation and operation of the SBSFU partial image generation.The partial image feature of the image preparation tool is documented in the appendix of the getting started document here: https://www.st.com/resource/en/user_manual/um2262-getting-started-with-the-xcubesbsfu-stm32cube-expansion-package-stmicroelectronics.pdfSee here for the relevant portions of documentation:Using the readme, which is referenced above in the documentation, it explains briefly how to use the image generation tool to create a partial image, encrypt and then sign it. Shown below are the contents of the readme relevant to partial image generation: Example for partial update : ---------------------------- [0] Generate partial image python prepareimage.py diff -1 UserApp_v1.bin -2 UserApp_v2.bin UserApp_partial.bin -a 16 --poffset UserApp_partial.offset (-a 16: align partial binary on 16 bytes. Partial binary size will also be aligned on 16 bytes) [1] Generate
Hi,I am trying to write a bootloader that implements secure boot on STM32U545 or 585. Now I work on the SBSFU Example from ST on the discovery board b-u585i-iot02a as a starting point.Questions: Can I use a bootloader based on the SBSFU_Boot from STM32U5 as the unique boot entry point and configured as write protected, to achieve the aim of secure boot?If the bootloader should be updatable in field, which method can be used? Possiblity: boot from RSS with DFU. But I need to get to USB on Hardware, right?Is there other ways than using USB? Thanks in advance.
Hello, I am using the STSAFE-A110 connected to the ESP32C3 board. I referred to the service interface from this GitHub repository (https://github.com/kmwebnet/stsafe_esp32_test). I have matched the Host MAC key and cipher key exactly as in the example. The current status is that pairing is complete, and the wrap operation returns a success response. However, I am encountering a 0x11 error during the unwrap operation. Unwrap_Failed : 17 <- print decimal data
Hello,I am working on implementing secure firmware with OEMiRoT boot on the STM32H563. I have configured I2C1 and TIM1 as non-secure peripherals. While the TIM1 interrupt works as expected, I am encountering an issue where the I2C1 slave interrupt handler is never entered. (Note: The I2C slave works correctly if TrustZone is disabled.)I am wondering if the I2C1 slave interrupt handler requires special handling when configured as a non-secure peripheral with TrustZone enabled?Additionally, if I need to change the start offset and application size for secure and non-secure applications, what changes are required beyond updating flash_layout.h in OEMiROT project?Any assistance on these issues would be greatly appreciated. Thanks,Ivan
Hello, I hope you are doing well!I developed a project based on the STM32H573I-DK example with TrustZone. However, in the final board, I am using the STM32H573VI microcontroller. I migrated all the code to this microcontroller, made the necessary pin ports, and some adjustments. I managed to compile it successfully. Now that the final board is ready, I am trying to run the code, but I am facing an issue with using the provisioning_auto.bat script.Below are some logs:Apparently, I am not able to communicate with the hardware using the STLINK-V3PWR through the provisioning_auto.bat script. However, I tested using the STM32CubeProgrammer and was able to connect with the microcontroller.Can anyone help me? Thanks in advance!
board: stm32U585 + stsafe-a110 before the stm32u585 enter the low power mode ,I want to set stsafe-a110 enter the low power consumpion mode. I can't find the methods to enter Hibernate
I was trying to test the capability of the STSAFE-A110 chip to store and verify a password, but it didn't work.StSafeA_PutAttribute() returned STSAFEA_UNSATISFIED_ACCESS_CONDITION.StSafeA_VerifyPassword() returned STSAFEA_ENTRY_NOT_FOUND.I'm not sure what any of this means. When I call other functions, like StSafeA_GenerateSignature() or StSafeA_VerifyMessageSignature(), they work just fine. Why would StSafeA_PutAttribute() and StSafeA_VerifyPassword() not work? Here's my code: char* passwordStr = "banana101"; // Same as in the OpenSSL example int32_t statusCode; StSafeA_VerifyPasswordBuffer_t commandResult; // This call returns STSAFEA_UNSATISFIED_ACCESS_CONDITION instead of STSAFEA_OK statusCode = StSafeA_PutAttribute(gStsafeHandle, STSAFEA_TAG_PASSWORD_SLOT, (uint8_t*)passwordStr, strlen(passwordStr), STSAFEA_MAC_NONE); // This call returns STSAFEA_ENTRY_NOT_FOUND instead of STSAFEA_OK statusCode = StSafeA_VerifyPassword(gStsafeHandle, (uint
Hello,I am trying to port SBSFU functionality on NUCLEO STM32F767ZI board. I am referring STM32F769I Discovery board project (image 1 project: single slot variant) from the examples available. I have followed the steps mentioned in the UM2262 and AN 5056 for porting SBSFU and User application to custom board. I have successfully uploaded the SBSFU firmware to the STM32F767ZI board and able to see the "Secure boot and Secure firmware upload screen" on Tera term. I am trying to upload the firmware through the Y Modem, the file upload starts and showing 4.7% on the screen as shown in attached image and suddenly the upload window gone. I am getting "File not correctly received" message on the screen as shown attached image.Following changes I made in the use application firmware.1. Updated the BSP packet required for my STM32F767ZI board2. Updated the startup file for my STM32F767ZI board3. Modified the UART settings : used UART3 instead of UART13
I implemented a ECDSA signature generation and checking on STM32H743ZI NUCLEO using STM32CubeExpansion_Crypto_V4.2.0 library example ECDSA_SignVerify.I did similiar with Python using https://pypi.org/project/ecdsa/Unfortunately signature generated by one fail to verify with the other although using the same input for hash, private and public key and curve. I used SECP256k1 / SECP256K1 and NIST256p / SECP256R1 on Python / STM32.Any suggestions? What are the tools ST verified the libraries with?Verification on the same platform works fine in both cases.Thanks for any help.
I am implementing sbsfu on stm32h745 chipset.Ported 2images from stm32h753 sbsfu examples.Among slots 1 and 2, slot 1 is intended to be used by cm7 and slot 2 by cm4.Although cm7 is operating normally, I created a separate cm4 package, created an sfb file, and confirmed that the cm4 firmware was installed in dwl_slot2. However, the firmware needs to be moved to active slot 2, but I have no idea how to do it. How to solve this?mapping_fwimg.ld__ICFEDIT_SWAP_start__ = 0x08100000;__ICFEDIT_SWAP_end__ = 0x0811FFFF;/* Active slot #1 in Sector 1 to 7 of Bank1; 7 x 128 kbytes */__ICFEDIT_SLOT_Active_1_start__ = 0x08020000;__ICFEDIT_SLOT_Active_1_end__ = 0x0809FFFF;__ICFEDIT_SLOT_Active_1_header__ = __ICFEDIT_SLOT_Active_1_start__;/* Dwl slot #1 in sector 1 to 7 of Bank2 : 7 * 128 kbytes */__ICFEDIT_SLOT_Dwl_1_start__ = 0x08120000;__ICFEDIT_SLOT_Dwl_1_end__ = 0x081
Hello,I followed this tutorial to add an example secure partition in TF-M ( https://tf-m-user-guide.trustedfirmware.org/integration_guide/services/tfm_secure_partition_addition.html ) and then followed these instructions to flash the application to my Nucleo-L552ZE-Q board ( https://tf-m-user-guide.trustedfirmware.org/platform/stm/common/stm32l5xx/readme.html ). However, the script regression.sh returned the error: Error: Cannot connect to access port 0! If you are trying to connect to a device with TrustZone enabled please try to connect with HotPlug mode. If you are trying to connect to a device which supports Debug Authentication with certificate or password, please open your device using it. After this, I am unable to connect my board STM32Cube Programmer or to flash any application using Keil MDK ARM, CubeIDE, etc. The same error is returned every time. Before I runned the regression.sh script, the board was working a
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.