Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
Hello ST Community,Can we apply Secure Boot on the STM32C031 family? I didn't find anything on the documentation. If not, what are the product series where we can apply Secure Boot?Thank you.
Hello,I'm willing to use the SBSFU in order to securely update the firmware on a custom board using an STM32G0 MCU.The example used in the MOOC with the simpleAPP is confusing, using the script to patch SBSFU with user code was straightforward and without details, i couldn't adapt it to my application.What is the best way to integrate my own code on the SBSFU ?Shall i edit the code in the UserAPP and add the code that i want to be executed on the board in the main function of the UserApp ? Shall i edit the script to merge the SBSFU with my code ? How ? what should be changed in the script ?Thanks,
Hi, I am going through the firmware protection hands on in Part 4 of the STM32 Security MOOCs located here :https://www.youtube.com/watch?v=RahlfYJ1gDs&list=PLnMKNibPkDnF0wt-ZI74SflnsBV4yKzkO&index=5&t=782sThe instructor in this hands on asks to specifically download "PATCH CRYPTOLIB" v 3.1.3 or higher and gives a URL for the downloadin the video, however , this URL only provides access to a package called en.STM32CubeExpansion_Crypto_V4.0.1. When I use the CryptoLib from this download in the hands on, I get the following compilation error - ../Src/hashcheck.c:23:10: fatal error: crypto.h: No such file or directory 23 | #include "crypto.h"This header file (crypto.h) does not exist in:en.STM32CubeExpansion_Crypto_v4.0.1\STM32CubeExpansion_Crypto_V4.0.1\Middlewares\ST\STM32_Cryptographic\includerather, it exists in a "legacy" folder: C:\Users\rkhera\workspace\en.STM32CubeExpansion_Crypto_V4.0.0_v4.0.0\STM32CubeExpansion_Crypto_V4.0.0\Middlewares\ST\STM32_Cryptograp
HW: NUCLEO-H563ZIHello, can someone explain the following behavior to me? Is this a bug or am I using the HAL incorrectly?Thanks a lot. Code snippetThe resultThe result is correct, but the behavior is strange. I receive two error callbacks also.First IRQSecond IRQ HAL_HASH_InCpltCallbackThird IRQFourth IRQHAL_HASH_DgstCpltCallbackHAL_HASH_ErrorCallbackHAL_HASH_ErrorCallback My analysisFirst HAL_HASH_ErrorCallback due to:state = READYcalling WriteData_ITREADY state leads to ErrorCallback Second HAL_HASH_ErrorCallback due to:With __HAL_HASH_ENABLE_IT starts the process described above (four IRQ’s)Then, calling WriteData_IT and the READY state leads to ErrorCallback again
Flash Memory is divided in different zones Secure (also protected by watermark), NCS and NS. All of such zone are defined in the the partition_stm32U575xx.h and SAU is enabled.MCU is in secure mode and want to write in the non secure area.Erasing return without errors, writing return without errors, but reading back what have been wrote doesn't match with the original data.We had similar issue on the L5 and in that case we had to promote the flash to secure using HAL_FLASHEx_GetConfigBBAttributes, perform all write operations then demote all blocks to non secure. Unfortunately the same trick here doesn't work.Any suggestion or minimal example?Thanks in advance
Good day!I am working with the STM32H753 product. I am trying to understand the sequences and state machines for RSS activation. The reference manual (RM0433) does not provide enough information to grasp the full picture. Additionally, there are no examples for setting up and activating RSS. Could you please provide the most detailed description for the correct setup of the secure user memory?I would also appreciate a comprehensive guide on the description and configuration of the Secure access modeSpecifically, I'm unsure about the sequence of steps: should I configure the secure user area first or should I activate the secure mode EN bit first? The documentation doesn't make this clear. Could you please provide guidance on the correct sequence of these operations?I would appreciate any assistance or additional resources you could provide on this topic. Thank you in advance.
I am Missing the Option Security>RNG in my the .ioc tool. Does the F446RE does not have a RNG?i experience identical problems to Implementation of ECC on STM32f446 (Page 1) — wolfSSL — wolfSSL - Embedded SSL Library
Hi,When trying to run a simple TrustZone+UART project generated by STM32CubeMX, the chip raises a HardFault when switching to NonSecure mode. In the HardFault handler, the Cortex-M33 CFSR registrer is set to 0x400, indicating an instruction bus error, and lr set to 0xffff_ffa9 (i.e. raised from non-secure code).The NonSecure code area's access flags (using the TT instruction etc.) is 0x02be0100 (i.e. should allow NS access) and the MPU is disabled, so that doesn't seem to be the issue. This thread details a similar problem, where the GTZC is protecting some regions of RAM from NS access. However, I've set all entries of MPCBB_SecConfig_array to zero (in the autogenerated MX_GTZC_S_Init() function), and that doesn't solve the issue.Does anyone know what could cause this, and how to fix it?Thanks.
Hello,We have a cybersecurity requirement to protect against unauthorized firmware uploads during data load operations or shop load using JTAG. Is there a feature available in the STM32F7xxx family Microcontroller that complies with cybersecurity standards to prevent unauthorized firmware uploads?Any guidance or documentation on how to achieve this would be greatly appreciated. Regards,-Manju
Hello happy taxpayers[EDIT #1]I forgot to say that what is really working is that is, from non secure app, I try to write in secure SRAM, then I end in the secure fault handler of my secure app. So, in this direction it's really clear the expected behaviour, but not in the other direction.[END EDIT #1] I'm completely lost with this definition from the STM32U5 reference manual, in paragraph 5.4.2 of the GTZC:"illegal secure access : Any secure transaction trying to access nonsecure block in internal block-based SRAM or watermarked memory is considered as illegal. Correct TZIC settings allows the capture of the associated event and then generates the GTZC_IRQn interrupt to the NVIC. This applies for read, write and execute access. Concerning the MPCBB controller, there is an option to ignore secure data read/write access on nonsecure SRAM blocks, by setting the SRWILADIS bit in the GTZC_MPCBBz_CR register." From my point of view, what I understand is that if, from my secure app
I am trying to get application level RDP progression into my bootloader to kind of self protect my firmware once it has started. I have set level 1 and the firmware still runs and I can no longer read out flash or debug, so that's the positive side.But now I want to continue debugging the board, so I want to get back to level 0. I already found out that (for whatever reason) the only way to at least start a connection is now to use Hotplug and only release the reset of the board by hand once Hotplug is selected.But I can not read or write the option bytes or use the specific downgrade command. What I tried and didn't work via CLI: ./STM32_Programmer_CLI.exe -c port=swd mode=HOTPLUG -rduDisabling memory Read Protection... Error: Disabling memory Read Protection failed./STM32_Programmer_CLI.exe -c port=swd mode=HOTPLUG -ob rdp=0xAAUPLOADING OPTION BYTES DATA ...Bank : 0x00Address : 0x40022040Size : 36 Bytes▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ 0%Error: Up
Hi,I want to add a function in the code to update the option bytes and set the read protection to level 1. However, this version sometimes bricks the MCU (STM32G030K8) after flashing, making it unable to connect with the J-Link.Q1: Why am I unable to reconnect to the J-Link? Shouldn't it be possible to connect if it enters the system flash (as long as the MCU is not physically damaged, it should theoretically be reprogrammable)?Q2: Is there any way to recover the MCU from the bricked state?Q3: Is this issue caused by a flaw in my code, or is it a problem with the MCU itself?===========Here are my reproduce steps:I added optionByteInit() during the initialization phase in the code.Built for Debug and generated a Hex file.Flashed it using J-Link SWD (using STM32CubeProgrammer).After successful flashing, I powered off the MCU and then tried to connect using STM32CubeProgrammer.Failed to connect.void optionByteInit(void){ FLASH_OBProgramInitTypeDef pOBInit; /* Read the original Op
Hello,Unless I'm wrong, the architecture of the TFM application as described in UM2851 seems not to allow the assignment of a peripheral (e.g. a LED pin) to the Secure context of TrustZone as it is the case with simple TrustZone applications. The UM2851 states that the user can "Replace the nonsecure TFM application example delivered in the STM32CubeU5 MCU Package by its own product nonsecure application", without raising this possibility for the secure application too.Moreover, I couldn't find on the Internet such example of customization of the Secure context of the TFM application to assign peripherals to the Secure part of the application.Is there a way to do so? If yes, how?Thanks a lot.@STea @Jocelyn RICARD @Benjamin BARATTE
Hello,I enabled STSAFE in the TFM app on a B-U585I-IOT02A board following the instructions shown in UM2851, by adding the PSA_USE_SE_ST compile switch in the TFM_Appli secure and non-secure projects, and I enabled the USE_PAIRING switch.When I run the TFM app, I get an error on the console saying: "Secure Element driver initialization failure", and the portion of application shown below loops infinitely without starting. [INF] Flash operation: Op=0x0, Area=0x0, Address=0x0 [INF] Starting bootloader OEMiROT [INF] Checking BL2 NV area [INF] Checking BL2 NV area header [INF] Checking BL2 NV Counter consistency [INF] Consistent BL2 NV Counter 0 = 0x1000000 [INF] Consistent BL2 NV Counter 1 = 0x1000000 [INF] Consistent BL2 NV Counter 2 = 0x1000000 [INF] Consistent BL2 NV Counter 3 = 0x1000000 [INF] Swap type: none [INF] Swap type: none [INF] Swap type: none [INF] Swap type: none [INF] Starting validation of primary slot(s) [INF] verify counter 0 1000000 1000000 [INF] counter 0 : ok [IN
Hello,I am trying to run OEMiRoT on STM32H503 (NUCLEO-H503RB - MB1814B).I followed the instructions specified: https://wiki.st.com/stm32mcu/wiki/Security:How_to_start_with_OEMiRoT_on_STM32H503In step 6 ("Flash new User application in CLOSED state") after choosing option 1 ("Start Bootloader") in the terminal emulator, I cannot connect the board via UART/USB to the STM32CubeProgrammer.To connect the board via UART to the STM32CubeProgrammer I had to perform a reset (RESET button). However, I cannot connect the board to the STM32CubeProgrammer via USB (User USB connector - CN3). The board with the USB cable connected performs continuous restarts.
hi i'm new in stm32.i'm using stm32 cryptographic library (cmox) for encrypt my data.while using the library, i'm experiencing some strange.I'm trying to encrypt data after initializing the library and generating the encryption key, but the encryption is getting weird on the very first call to the encrypt function.After the initial call, both encryption/decryption are working fine.What can I do to resolve it? - mcu: STM32F401RDTxstruct crypto_ { uint8_t key[16]; uint8_t iv[16]; } crypto; void crypto_init(void) { cmox_init_arg_t cmox_arg; cmox_arg.target = CMOX_INIT_TARGET_F4; if (cmox_initialize(&cmox_arg) != CMOX_INIT_SUCCESS) { return; } crypto_generate_key(); uint8_t data[16] = { 0x00, }; for (uint8_t i = 0; i < sizeof(data); i++) { data[i] = 10 + i; } printf("data: "); for (uint8_t i = 0; i < sizeof(data); i++) { printf("0x%02x ", data[i]); } printf("\n"); uint8_t enc_1[16] = { 0x00, }; uint8_t enc_2[16] = { 0x00, }; size_t enc_1_byte
Hello,I am developing a new product with the STM32h753, and we are trying to use both SBSFU and SFI. The secure boot implementation was already integrated and working before tackling SFI. When tackling SFI, I first tested it with a simple program without secure boot. This worked perfectly, exactly as advertised. Then I tried using SFI on our debug binary. This binary was the combined SBSFU + User application binary where the bootloader exists at the normal program counter and the user application exists in the first slot. This version of our bootloader had all the protections disabled. (RDP 0 WRP 0 etc.). This is the working firmware of our application, and I tested it with normal programming before testing SFI. So finally I build the SFI image to test the SFI and the STM32CubeProgrammer had some errors, but it seems to complete correctly. Then the device became inaccessible. I tried accessing the device with USB and UART while enabling boot 0 as well as STLINK and the device just does
Hi Team,Is there roadmap for implementation hardware cryptography acceleration for NetX Secure using CRYP peripheral at STM32H7?I am using STM32H735@520MHz and I am not able achieve more than 800kBit/sec for HTTPs connection (TLS 1.2 TLS_RSA_WITH_AES_128_GCM_SHA256). With HTTP only I ave no issue to achieve to 80Mbit/sec. I use 100Mbit PHY (DP83826). From this reason I think that bottleneck is a software cryptography at NetX secure.I am try to implement AES GCM support into _nx_crypto_method_aes_gcm_operation() inside nx_crypto_aes.c but without success yet.Thanks for answer or any hint.Regards,Jan
Hi ST, What tool generated the following data?Can you send me this tool? thanks. https://www.st.com/en/embedded-software/x-cube-cryptolib.htmlSTM32 cryptographic firmware library software expansion for STM32Cube. The path of the code is as follows:.\STM32CubeExpansion_Crypto_V4.2.0\Projects\NUCLEO-G474RE\Applications\ECC\ECDSA_SignVerify\Src\main.c
I want to use SBSFU for a SW Update OTA Project , i try to compile the example project from SBSFU-Projects: NUCLEO-G474RE_2_Images_SBSFUNUCLEO-G474RE_2_Images_SECoreBin (first, this project will be compile)NUCLEO-G474RE_2_Images_UserApp by try to compile the "NUCLEO-G474RE_2_Images_SECoreBin Project", i get following error: 09:36:29 **** Build of configuration Debug for project NUCLEO-G474RE_2_Images_SECoreBin ****make all "../prebuild.sh" "../"prepareimage with python scriptpython /prepareimage.py conf ..//../Inc/se_crypto_config.hpython: can't open file 'C:\\prepareimage.py': [Errno 2] No such file or directoryselected../prebuild.sh: line 55: can't create ..//Application/Startup/se_key.s: nonexistent directory../prebuild.sh: line 56: can't create ..//Application/Startup/se_key.s: nonexistent directory../prebuild.sh: line 57: can't create ..//Application/Startup/se_key.s: nonexistent directory../prebuild.sh: line 136: can't create ..//Application/Startup/se_
Hello, I am trying to use AES-GCM from the STM32 cryptographic library V4.2.0 to encrypt data.When running the example program, encryption and decryption work smoothly.However, when I integrate the library and function into my existing program, the encrypted ciphertext differs from expected_ciphertext.Additionally, using this incorrect ciphertext and incorrect tag still decrypts to the correct plaintext.Could you please advise where the error might be causing this result? const uint8_t Key[] = { 0x46, 0x3b, 0x41, 0x29, 0x11, 0x76, 0x7d, 0x57, 0xa0, 0xb3, 0x39, 0x69, 0xe6, 0x74, 0xff, 0xe7, 0x84, 0x5d, 0x31, 0x3b, 0x88, 0xc6, 0xfe, 0x31, 0x2f, 0x3d, 0x72, 0x4b, 0xe6, 0x8e, 0x1f, 0xca }; const uint8_t IV[] = { 0x61, 0x1c, 0xe6, 0xf9, 0xa6, 0x88, 0x07, 0x50, 0xde, 0x7d, 0xa6, 0xcb }; const uint8_t Plaintext[] = { 0xe7, 0xd1, 0xdc, 0xf6, 0x68, 0xe2, 0x87, 0x68, 0x61, 0x94, 0x0e, 0x01, 0x2f, 0xe5, 0x2a, 0x98, 0xda, 0xcb, 0xd7, 0x8a, 0xb6, 0x3c, 0x08, 0x84, 0x2c, 0
Hello,I have a B-U585I-IOT02A board, and I followed the tutorial at Getting started with STM32CubeU5 TFM application - User manual. Unfortunately, I couldn't get it to work and I tried to rollback, following the steps described in Section 10.6 STM32U5 device reinitialization, but I couldn't get my device reinitialized to the RDP=0 level.The default password that I used in regression.sh is 0xFACEB00C 0xDEADBABE, switch SW1 (BOOT0 pin) is on position 1, and I connected TAMP_IN8 (PE4 on CN3 pin 11) and TAMP_OUT8 (PE5 on CN3 pin 14) as suggested in Solved: STM32U585 DOES NOT RETURN TO RDP=0. - STMicroelectronics CommunityBut I still get the same errors: C:\WINDOWS\system32>STM32_Programmer_CLI.exe -c port=swd mode=UR -unlockrdp2 0xFACEB00C 0xDEADBABE ------------------------------------------------------------------- STM32CubeProgrammer v2.16.0 ------------------------------------------------------------------- ST-LINK SN : 002600303432511630343838
Hello,I followed the instructions provided in the UM2851 to run the TFM application contained in the latest STM32CubeU5 1.6.0 Firmware projects folder, but the application does not run, it enters an infinite loop instead.Any help please?@Jocelyn RICARD @Guillaume K
Hi all,we are developing a product with the STM32H573. The idea is to use the STiRoT for secure firmware update. The MCU is connected to a Linux CPU via SPI. Now we plan to do the provisioning during the production using the Linux CPU that has a ethrnet connection to the outside world. The question is: Is that possible? Is the boot pin required or is a jump to bootloader sufficient?I have modified the provisioning scripts to use UART and I have tested it using the H573DK eval board, but it failed. This is because after programming the option bytes the bootloader is not starting again, as STiRoT gets activated. Maybe the sequence can be modified?What are the detailed steps? E.g. what is the RSS doing and how? Thx,Roman
I am using USB peripheral on the STM32U5 with TrustZone enabled. I met a problem. In Non-Secure area, USB_DRD_FS->CNTR, USB_DRD_FS->CHEP0R can be set correctly. In Secure area, I can set "USB_DRD_FS->CNTR = 0x9D00;".But I can not set the "USB_DRD_FS->CHEP0R = 0x8280;". The register value remains at 0. How can I use the USB peripheral in Secure area?
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.