Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
I have a strange issue here. I'm trying to do a short, blocking, UART transmission.I have a 23 byte uint8_t array ( MSG ) that I construct before calling the HAL_UART_Transmit() function to send the data. (SLAVE_MSG_SIZE = 23, UART is a pointer to the UART4 object)HAL_UART_Transmit(UART, &MSG, SLAVE_MSG_SIZE, 1);The problem is that it never sends just 23 bytes, its sends more, sometimes less, but almost always more. Most I've seen is around 46 bytes, which is close to 2x, which may be a clue to what is going on.(The receiver side can handle extra bytes at the end because it just doesn't look at them, but when the TX packet is too short, the 2 CRC bytes are absent and the CRC check fails.)The strange thing is that if I manually set the "data size" parameter in the HAL call to 15 bytes or less, I get the expected, truncated data of the correct length. However, if the size argument is >15 bytes, the amount of transmitted data is always more than the expected value.My code is the fo
I'm porting my project(sbsfu Nucleo-h753zi to Nucleo-h745zi-q)and i checked protection my board, but i can't full chip erase../STM32_Programmer_CLI.exe -c port=swd mode=UR -ob PROT_AREA_START1=0xFF PROT_AREA_END1=0 RDP=0xAA-------------------------------------------------------------------STM32CubeProgrammer v2.16.0-------------------------------------------------------------------ST-LINK SN : 003900363137511039383538ST-LINK FW : V3J14M5Board : NUCLEO-H745ZI-QVoltage : 3.27VSWD freq : 8000 KHzConnect mode: Under ResetReset mode : Hardware resetDevice ID : 0x450Revision ID : Rev VDevice name : STM32H7xxFlash size : 2 MBytesStart Address : 8000000Device type : MCUDevice CPU : Cortex-M7/M4BL Version : 0x90UPLOADING OPTION BYTES DATA ...Bank : 0x00Address : 0x5200201cSize : 308 Bytes栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%PROGRAMMING OPTION BYTES AREA ...Warning: Option Byte: rdp, value: 0xAA, was not modified.Bank : 0x00Address : 0x5200201cSize : 308 Bytes栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢栢 100%UPLOADING OPT
Hi ChannelI have tested the TF-M Package Released by ST, on the STM32U585 and its working fine. Now i want to revert back my STM32U585 (B-U585I-IOT02A Kit) as for the testing of TF-M SBSFU there is some configuration of option bytes as given in UM2851 manual.Now i want to test some normal applications on the same board. I have made the following changeschanged RDP to to 0 and changed TZEN bit =0 at the same time to disable the trust zone controller.i have disabled wrp 1 and wrp2 bits.But now i am not able to do a full chip erase and am not able to any other program (for example led test or UART test example).Kindly help me out in the clear procedure on how to revert back the option byte configuration to the default one.Thanks for the support
Hi all,I am using STM32F769I-DISCO Board IDE : 1.12.1CubeMx : 6.10.0 ST CUBE programer version 2.15.0I am not able to flash, I am getting following error during flash,I tried changing SWD freq and Connect mode: Under_reset Log output file: C:\Users\MQSTEC~1\AppData\Local\Temp\STM32CubeProgrammer_a11412.logST-LINK SN : 0673FF555551847167202052ST-LINK FW : V2J43M28Board : 32F769IDISCOVERYVoltage : 3.22VSWD freq : 4000 KHzConnect mode: Under ResetReset mode : Hardware resetDevice ID : 0x451Revision ID : Rev ADevice name : STM32F76x/STM32F77xFlash size : 2 MBytesDevice type : MCUDevice CPU : Cortex-M7BL Version : 0x93Memory Programming ...Opening and parsing file: ST-LINK_GDB_server_a11412.srecFile : ST-LINK_GDB_server_a11412.srecSize : 2.11 MBAddress : 0x08000000Erasing memory corresponding to segment 0:Erasing internal memory sectors [0 6]Error: failed to erase memoryError: failed to erase memoryEncountered Error when opening C:\ST\STM32CubeIDE_1.12.0\STM32CubeIDE\plu
Hello,I try to build the STM32CubeExpansion_SBSFU_V2.6.2 for STM32H750B-DK. I use STM32CubeIDE Version: 1.9.0 on Windows 10.The build result is suspicious: More details: The first section is overflown by 3479%. What I did wrong? How to fix it? The next question is about loading the code to the CPU's flash memory.On the page 47 of the UM2262 explained the procedure of three components: "The following steps describe a dual-slot SBSFU scenario executed on the NUCLEOL476RG board with the default cryptographic scheme, further illustrated in Figure 17:1. Download the SBSFU application2. SBSFU is running: download UserApp #A3. UserApp #A is installed4. UserApp #A is running, download UserApp #B5. UserApp #B is installed then running" Which tool should I use to download apps? ST-LINK? YMODEM? The example I used (for STM32H750B-DK) has 5 components: Loader application. SECoreBin application. SBSFU application. UserApp Loader application. UserApp application. Where
Am testing the x-cube-sbsfu on H7A3 (using H7B3 project with OTFDEC disabled). After enabling SFU_MPU_PROTECT_ENABLE, I always ran into mem manage fault when the function HAL_RCC_GetPCLK1Freq is called during HAL_UART_Init: An MPU or Execute Never (XN) default memory map access violation has occurred on an instruction fetch (CFSR.IACCVIOL, MMFAR). The MPU setting for RCC is as below:/*** @brief Region 1 - Enable the read/write operations for RCC peripheral area in privileged mode.* Execution capability disabled* Inner region inside the Region 0*/#define SFU_PROTECT_MPU_PERIPH_2_RGNV MPU_REGION_NUMBER1#define SFU_PROTECT_MPU_PERIPH_2_START RCC_BASE#define SFU_PROTECT_MPU_PERIPH_2_SIZE MPU_REGION_SIZE_1KB#define SFU_PROTECT_MPU_PERIPH_2_SREG 0x00U /*!< All subregions activated */#define SFU_PROTECT_MPU_PERIPH_2_PERM MPU_REGION_PRIV_RW#define SFU_PROTECT_MPU_PERIPH_2_EXECV MPU_INSTRUCTION_ACCESS_DISABLE#define SFU_PROTECT_MPU_PERIPH_2_TEXV MPU_TEX_LEVEL0#define SFU
Hello communityGreetingsi have a requirement to write and read data from the SRAM2 and Backup RAM from the TFM Application example. please suggest how can i write and read an array of bytes(10 byte) from the SRAM2 and Backup RAM in the above mentioned applicationThanks and RegardsPhilip Jose
Hello,I would like to setup a secure area on the h755 board. My setup is as follows:I have a secure app that runs permanently on the m7, and on the m4, there is a non-secure app running.I want to configure all but the last sector of the m7 as secure.I followed this example, and it seems to work, until I want to flash the secure area configuration (start 0x000, end 0xffe). Then the cube programmer starts loading forever, until I reconnect the board or go to some other tab.What am I missing?
Hello,We are currently facing issues using cipher suites that use AES-GCM in conjunction with the Secure Manager.Our understanding is that in order to make use of Secure Manager functionalities, we should use PSA APIs, however they currently only implement AES-CBC algorithms.As gathered in this other post, it seems that we need to implement a PSA version of the GCM algorithm. We appreciate this is a very technical task, involving a deeper knowledge of cryptographic algorithms and were hoping ST could offer their knowledge and support in developing such function. In particular the `NX_CRYPTO_KEEP UINT _nx_crypto_method_aes_psa_gcm_operation(...)` function, that needs to be added to Projects\STM32H573I-DK\Applications\ROT\Nx_Azure_IoT\NetXDuo\psa_crypto_ciphersuites\nx_crypto_aes_psa.c. Many thanks,Alex
@Guillaume K, @Jocelyn RICARD Since my previous question on the same topic (see here) I have reviewed probably all the MCUboot/TF-M-based solutions available for ST MCUs. There are currently four options that I am aware of:TrustedFirmware-M (TF-M) using the latest MCUboot, implements well-documented PSA-API, actively developed and maintained by community.Regretfully, this solution appears to be no longer actively supported by ST, STM32U5xx HAL version is 1.0, so no support for new ST MCUs.ST's TFM, described in AN5447 and UM2851, still available as a part of the STM32Cube_FW_U5_V1.4.0 package under /Projects/B-U585I-IOT02A/Applications/TFM folder, probably abandoned, removed from GitHub for this reason.Secure Boot and Secure Firmware Update (SBSFU), described in UM2262 and partially in AN5447, STM32U5G9 supported, based on relatively old TF-M 1.3 (current version is 2.0, version 2.1 to b
hi all,I am trying to implement a TCP echo device on STM32U585 controller. here the TCP/IP communication is over ethernet as well as USB (CDC ECM). The communication channel is protected using TLS encryption.here am using NetX stack as the TCP/IP stack and using the NetX secure for the TLS implementation's can able to establish a secure connection between the TLS client(my board) and server (OpenSSL server running on host PC).the problem is when am using ECC ciphers(scep521r1) my TLS handshake is taking around 24 seconds and the same code when using RSA certificates taking max of 1 to 2 seconds.am using self signed certificates created using the OpenSSL(for both RSA and ECC).while reading the documentation its mentioned that ECC is supporting the NetX secure. And am using the scep521r1 curve for creating the keys adn certificates. am using the APIs as mentioned in the documentation adding root ca certificate for the verification ps:am using chain of cert
Hi There, I am trying to get our product working using the SBSFU on our product. The latest problem I have is that the UART works when the application runs standalone - i.e. our code within the user app using the ST link, however, when I try to use the SBSFU, it doesn't work.Here is some code to demonstrate the problem: CLEAR_BIT(RCC->APB1ENR1, RCC_APB1ENR1_USART2EN); //Disable the UART before writing to MODER as a precautionfor(i=0; i<30000000; i++) //Crude delay (no systick available){WRITE_REG(IWDG->KR, IWDG_KEY_RELOAD);}CLEAR_BIT(GPIOA->MODER, GPIO_MODER_MODER2_0); //Set Alternative mode for both USART RX and TX (RA3 and RA2)SET_BIT(GPIOA->MODER, GPIO_MODER_MODER2_1);CLEAR_BIT(GPIOA->MODER, GPIO_MODER_MODER3_0);SET_BIT(GPIOA->MODER, GPIO_MODER_MODER3_1);while(1){} When I execute this code as a standalone (user project only), the UART and rest of the program works fine, but when I use the boot
Hello,I'm trying to run the X-CUBE-IOTA1 v3.0 on the B-U585I-IOT02A board, but after following the tutorial in UM2606 I get the following error when trying to send L2Sec Stream:What can be the reason of the pairing_stsafe result failing, please?Best regards,@Jocelyn RICARD @Benjamin BARATTE
Hi,I'd like to ask if any example code for Azure IoT Hub group enrollment is available.I found examples for individual enrollment in X-CUBE-AZURE-v2-3-0 only.I try to follow the Just-in-time registration method and it fails when trying to connect to the endpoint/scopeID.I can read out the leaf certificate from STSAFE, but I don't understand where it fails. The CA root has been uploaded to DPS as well. Probably the enrollment process is different for group enrollment and individual enrollment as it might need some kind of challenging or key exchange?Any guidelines will be much appreciated. Best regards,Thang
I am adapting the NUCLEO-H753ZI single-slot project to work on a NUCLEO-H745ZI-Q board.My development environment is linux and I am using minicom for the ymodem upload.When flashed, the binary seems to function perfectly, but when I corrupt the image and attempt to upload a new sfb file the board keeps failing the download saying that the firmware is too big.The project I am working on is largely unmodified other than setting the flags for the minicom communication in app_sfu.h and the workaround for the double include for the userapp.Below are screenshots of the problem:I have verified that minicom is indeed configured correctly as the guide requires:Is there something I am missing? Yes, I have read the integration guide and I have modified the project to support the dual core board.
Hi experts,I need to implement the storage of a security key (upgradable) on STM32H7A3. After reading the example code of KMS under project B-L475E-IOT01A in x-cube-sbsfu, and a few posts in the forum (KSM support on STMH7 and 2-images-kms-port-to-stm32f756zgtxx ), I have the following questions:Can a mcu without firewall, e.g. H7A3, still uses KMS? After comparing the SBSFU code between B-L475E-IOT01A and STM32H7B3I-DK, there are a lot of differences which means major adaptation needs to be done?If I use MPU + PCROP level 1 to protect the flash sector which contains the key, how can the key being upgraded?
I want to use AES peripheral for encryption in ECB mode (256). I am able to encrypt and decrypt on the same MCU, but if I compare the encryption results, the HW peripheral has a different result than the SW library AES.c or encryption in Python - the last two have the same result.hcryp.Instance = AES;hcryp.Init.DataType = CRYP_DATATYPE_32B;hcryp.Init.KeySize = CRYP_KEYSIZE_256B;hcryp.Init.pKey = (uint32_t *)aAES256key;hcryp.Init.Algorithm = CRYP_AES_ECB;hcryp.Init.DataWidthUnit = CRYP_DATAWIDTHUNIT_BYTE;hcryp.Init.HeaderWidthUnit = CRYP_HEADERWIDTHUNIT_BYTE;hcryp.Init.KeyIVConfigSkip = CRYP_KEYIVCONFIG_ALWAYS;if (HAL_CRYP_Init(&hcryp) != HAL_OK)I use it like that: HAL_CRYP_Encrypt(&hcryp,(uint32_t*) plain_text, 16,(uint32_t*) tmp_encrypt,0xffff); uint8_t aAES256key[32] = { 0x4d, 0xf0, 0x2c, 0x47, 0x64, 0xa4, 0x28, 0xd9, 0xe5, 0x36, 0x83, 0x38, 0x4c, 0x3e, 0x69, 0xfa, 0x14, 0x4d, 0xb9, 0xb4, 0xdf, 0x4d, 0x77, 0x43, 0x4c, 0xf3, 0xf6, 0xff, 0x5d, 0x5c, 0xde, 0x
Hi,I am currently using the M3_CryptoFW_RngHW_2_0_6.lib for MDK-ARM. However, I must adhere to this specific library version, and I now need it for IAR, meaning that the required library is M3_CryptoFW_RngHW_2_0_6.a. How can I obtain this version for IAR?Thank you,Ari
Here is my attempt at background as I understand it... iROT is a ROM program in the STM32H563. It contains a P256 EC algorithm, and checks some section of FLASH that you define as a program for a signature, then jumps to it. The definition of the program and sig are stored Option Bytes. In my case, I would be asking iROT to check my secondary bootloader for authenticity, in STM32 terms, this becomes the uROT in some cases or OEMuROT in others (terrible naming). Level1 Secure iROT checks my Level2 Secure bootloader, my bootloader checks my Non-secure application. The signature format is confusing, and I think the tools are greatly lacking clarity, but I think I get the idea. 1. What if I change my bootloader in the field? I OTA download a new bootloader. My Non-Secure application stores the update to the secondary bootloader, confirms it's signature with my OTA process, decrypts. Now... My secondary bootloader will update itself on next boot - BUT - If my Level2 secondary boot
I have STM32U5 MCU and the TrusZone is disabled. Is it possible to have secure boot or not. If yes, please can you explain to me how I can achieve this. Thanks a lot0 Kudos Reply
I have a problem with merge SBSFU .elf file and application .elf.I prepared:SBSFU.elf - addresses in linker script: 0x08000000 - 0x08020000application.elf - 0x08020400 - 0x081FFFFFheader.bin - size: 1024BSo I suppose, that like in SBSFU example header.bin will jump into space between SBSFU and application (0x08020000 - 0x08020400), but in my case result .elf file is corrupted. After merge application begin from 0x08020034 and header is placed at the end of application.I use command: STM32_Programmer_CLI -ms application.elf header.bin SBSFU.elf
The call to "cmox_rsa_pkcs1v15_encrypt" requires a "Random buffer" and a "Random Length (in Bytes)" as input parameters. It will return error code CMOX_RSA_ERR_WRONG_RANDOM if "Random material too short or not valid for the functionality".I keep getting this error code, but I cannot find any details on how I am SUPPOSED to choose or set the buffer size or contents etc.The example uses a 36 byte message and a 20 byte random seed. I am trying to encrypt a 16 byte message with a 20 byte seed, but get the result "material too short or not valid". So, what shall I do? Any documentation on that parameter except for "it is a random seed that can be too short or not valid under certain untold circumstances"?
Hi all,we would implement SBSFU (Secure Boot and Secure Firmware Update) on STM32U585.Our goals are:application do not use TrustZone feature (TZ_EN = 0)we want to avoid access to MCU on field (Device protection, for exapmle RDP = 1)question: if on field MCU is protected with RDP = 1 or 2 or whatever how could a firmware update take place? we need a regression before firmware update?at start up "mcu boot" check the security/integrity of application firmware: is that right?we want to upload the new firmware via USB connection: we think we should develop our custom bootloader. Correct?in our understading we will develop 2 projects (one project for application + bootloader and one project for mcu boot)how we could "join" the two binaries into a single one? is it possible?A possible scenario for our could be that one:user connects to our device via USB.user want to update the firmware: then from the application we start our custom bootloader.bootloader copy new firmware into a dedicate "upd
Hello all.I have a question about how to use KMS_GenerateKeyPair() function. There are no examples in the code, and API description is not really enough for my little brain. Could somebody provide me an example on how it should be used? What kind of parameters, how to initialize them and so on. I would be grateful!
Hi,My question is about project structure.To implement SBSFU what is the best or correct approach if I have a project that I would like to flash to a target incorporating SBSFU?Import four project folders (SBSFU, SECoreBin, UserApp and MyProject) into a workspace in SMM32CubeIDE / Eclipse, compile individually to confirm clean builds then copy the source and header files into the UserApp project folder, then alter my project code and edit the makefile to blend the projects?OrSetup SBSFU for serial comms only (as detailed in - MOOC - Security Part6: STM32 security ecosystem)and use Y-modem to flash MyProject.bin to the target (having signed MyProject.bin) using external tools.AlsoIn the tutorial, batch scripts are used for post build processing which fail to run if the project folder setup is incorrect and requires a lot of editing. Is it best to start with the SBSFU folder structure and import MyProject into the “2_Images�? folder (presuming a 2 image bootloader is required)?Any help/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.