Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
Hi,I am using the function STM32_AES_CBC_Encrypt from the ST library Crypto 3.1.0. I don't understand why this function doesn't give me an encrypted message which is a multiple of 64 bytes. For example, I would like to encrypt "thisisatest12345". The function returns a tab which is the same size of the original tab:Thes encrypted message is "0x1E 0xDD 0x1B 0x2A 0x8B 0xA6 0xDC 0x5E 0xBE 0xD6 0x9D 0x78 0xA4 0xA9 0xCA 0x3B ". Following the website https://www.devglan.com/online-tools/aes-encryption-decryption, the encypted message should be "1EDD1B2A8BA6DC5EBED69D78A4A9CA3B813290DF65F7ABD59239929768C8603F", which is 64 bytes. But, when I transform the encrypted message into Base 64, I have the same result as the previsous website, but there is a missing part: From website;From my code: The beginning is the same, but a part is missing, and I don't know why.Can you help me, I don't know how to solve this problem. Thanks.
Hi,I have been experimenting with secure boot on the STM32H573I-DK, but I can't perform a regression anymore.While adapting the example code (OEMiROT) to my own version, I am currently in the situation where the device is "provisioned" (0x2e), but I have lost the keys/certificates because they were accidentally overwritten during my experiments. So I can't open up the debug access port anymore. TrustZone is enabled (0xb4).Currently with the STM32CubeProgrammer I can connect to the device in hotplug mode:And I can read out the registers:After doing some research for other ST platforms (the STM32U5 for example), it seems to be possible to "unprovision" the device using the STM32CubeProgrammer. However, changing both the PRODUCT_STATE and TZEN registers to 0xED and 0xC3 respectively results in an error:Additionally, the STM32CubeProgrammer manual documents a possibility to disable TrustZone via CLI (https://www.st.com/resource/en/user_manual/um2237-stm32cubeprogrammer-software-description
I'm curious about the firewall, and want to know why firewall can improve the security level. It's easy to understand page 65 of UM2262, f1(), f2(), f3() can only be called from outside through call gate, my question is why it's more secure than calling f1() directly?
We are working on developing a host-module that requires two-way device authenticationThe controller we are planning to use is the STM32WL55 Series.We have the following Queries.1) Does STM32WL55 has a functionality to locally generate a certificate or a private public key pair that is not readable even by the FW itself ?Our goal is complete security of the device key/certificate.2) Does STM32WL55 has a secure storage functionality where it can store externally generated certificates/keys?Our goal is to store keys in unreadable form but still accessible for security operations.We need a brief explanation of how the mentioned functionality can be achieved on the STM32WL55 microcontroller.Also please share all the relevant documents and Example code explaining the security architecture of STM32WL55
1. If in RDP Level 1, can the SRAM be read?2. If starting in RDP Level 1 and transitioning to RDP Level 0, is the SRAM erased?3. Can the contents of SRAM be readout after the transition from RDP Level 1 to RDP Level 0? Thanks.
In the STM32H573-DK BOARD,How to store the public and private key in secure part ?
The Issue When my bootloader jumps to the application all `AES_ECB_Encrypt_XXX` incorrectly encrypt/decrypt the data. Once the application fails to initialize too many times it will reboot due to watchdog and the ncrypt/decrypt will continue to fail in the bootloader although it was working before it jumped to the application.BackgroundI am using the STMCryptoLib_V4.1.0 in my bootloader and application.I am using the legacy_v3 APIs. As our code was originally written with the V3 library.The module in question is `AES_ECB_Encrypt_xxx`.The bootloader uses the modules successfully but after it jumps to the application it fails to encrypt/decrypt.The CRC clock is not disable prior to the bootloader jumping to the application.The CRC clock is enable on board bring up for each applications as follows.. __HAL_RCC_CRC_FORCE_RESET(); __HAL_RCC_CRC_RELEASE_RESET(); __HAL_RCC_CRC_CLK_ENABLE(); The library is not failing it's just not encrypt/de
Hello all,Another question from SBSFU series.I'm wondering what are the available ways to clear option bytes?The option I was using so far was simply STM32CubeProgrammer GUI, but what if we don't have ST-Link on board and we have to rely on something else like FTDI?I've tried to connect to the programmed board (i.e. with SBSFU installed and securities turned on) via OpenOCD, but I'm unable to connect, here is the output:Do you think that's because of securities turned on?Thanks in advance!
Hi, need support. send_msg() is a secure area message of TF-M and I am calling it in non secure area via secure_nsc API.What I am observing here is that I am not able to call this function in _tx_initialize_kernel_enter() function after the call to TX_PORT_SPECIFIC_PRE_INITIALIZATION. Just to mention this experiment is happening from STM32U585 board. Below is the code snippet for this. VOID _tx_initialize_kernel_enter(VOID){ /* Determine if the compiler has pre-initialized ThreadX. */if (_tx_thread_system_state != TX_INITIALIZE_ALMOST_DONE){/* No, the initialization still needs to take place. */ /* Ensure that the system state variable is set to indicateinitialization is in progress. Note that this variable islater used to represent interrupt nesting. */_tx_thread_system_state = TX_INITIALIZE_IN_PROGRESS;/* Call any port specific preprocessing. */TX_PORT_SPECIFIC_PRE_INITIALIZATIONsend_msg();.....}
hello I'm using a STM32H573-DK board for engineering samples. so. I'm run a example this link but provisioning.bat files does not run at 'Step 3 : Provisioning'How to fix this problem?
Hello all,Kindly guide us how to resolve the following issue or share the sample code,We are using MCU STM32U585QII6QTR. In this TrustZone is not enabled.We are trying to change the RDP level from 0 to level 1 and from level 1 to level 0 from software.We are successfully able to change from RDP level 0 to RDP level 1 in software. But when we try to change the RDP level from level 1 to level 0 the regression is not happening.The regression is not working with and without RDP regression password(OEM1KEY). RDP level 0 to level 1 change code:void ChangeRDPLevel(FLASH_OBProgramInitTypeDef *pOptionsBytesStruct){HAL_FLASH_Unlock();HAL_FLASH_OB_Unlock(); pOptionsBytesStruct->OptionType = OPTIONBYTE_USER | OPTIONBYTE_RDP ; //Configure USER and RDP// pOptionsBytesStruct->USERType = OB_USER_nBOOT0;// pOptionsBytesStruct->USERConfig = OB_BOOT0_FROM_PIN;//Set to boot from pin (UART)pOptionsBytesStruct->RDPLevel = 0xDC; while(HAL_FLASHEx_OBProgram(pOptionsBytesStruct) != H
Hi,I need to implement things that are required to implement secure boot & secure software update STM32 H733 Microcontrollers. Trying to understand from the beginner perspective, though I have the Cube package downloaded from the st website, still like to understand the theoretical basics and implementation steps to have a basic secure boot and boot loader design.
Hello,I have a setup with two partitions (active + download) and a user application that also acts as a firmware loader.At the moment, the loader/user application downloads the new firmware to the download slot successfully and after reset the new firmware is identified and the SBSFU initiates the installation of the new firmware. The decryption succeeds and I've verified that the correct image is obtained after decryption. Hence, the installation seems to work up until the swapping phase. During swapping, no firmware data seems to be written to the active slot. After the swapping operation is completed, no firmware is present in the active slot at all. Hence, the swap seems to act more or less act as an erase operation on the active partition. Still, the SBSFU seems to consider the installation successful and complete (no error codes are returned if I check during debug). But after the subsequent reset, it starts to erase the content in the active slot, announcing: "Slot SLOT_ACTIVE_1
Hello,I use STM32WLE5 on a seed studio module LORA-E5 mini where boot0 is not accessible (completely crazy ...). The module comes with a read protection and they ask us to remove RDP (level 1 to level 0) to be able to flash it with a custom program. I was able to pass RDP from 0xBB to 0xAA in hotplug mode, all was ok exept that I cannot now erase or flash anything. I can connect in normal mode at any speed, read option bytes but no flashing. Sometimes I can erase one page but it is random ?V target is 3.16Vstlink v2 firmware : V3j37S7Masse erase output : 10:15:43:555 : MASS ERASE ... 10:15:43:555 : Flash erase... 10:15:43:558 : halt ap 0 10:15:43:558 : w ap 0 reg 15 PC (0x20000000) 10:15:43:559 : w ap 0 reg 17 MSP (0x20000500) 10:15:43:561 : w ap 0 reg 16 xPSR (0x01000000) 10:15:43:568 : w ap 0 @0x20001380 0x00000200 bytes Data 0x00000000 10:15:43:568 : w ap 0 @0x20000000 0x00000004 bytes Data 0x0000BE00 1
Hello,I'm currently working on a project that involves using the SFBU (Secure Firmware Bootloader Update) due to the limited flash size of the MCU. I've set up an external EEPROM to store the entire firmware before the update process.I've made necessary modifications to the linker files to accommodate the use of EEPROM. The complete .bin file, containing all the data, successfully boots at SFBU, and after the checks, the main code runs seamlessly.However, I'm facing an issue when attempting to update from the EEPROM. I encounter a "Fw signature check error" during this process. Upon debugging the BFU (Bootloader Firmware Update) application, I noticed that the C_DigestFinal function returns the wrong pOutputBuffer specifically when updating with a .sfb file. Interestingly, the same function returns the correct tag when we flash both the bootloaded and firmware as one image but still can't make upadate with .sfb file.Below we see that the fw_tag_output is correct and the installed image
Hi, I am looking for some API which supports chain of certificate feature for NetxSecure TLS, Just like mbedtls_ssl_conf_ca_chain() API in MbedTLS.Need help. Thanks in advance.
Hi Community, I'm in a process to combine the SBSFU and Application file into single intel hex using srec_cat.exe doesn't work.srec_cat Application.sfb -binary -offset 0x08010000 -o APP_Offset.hex -intelsrec_cat STM32G0B0RE_SBSFU.hex -intel Application.hex -intel -o Combined_App.hex -intel Combined_App.hex always executing in bootloader and not jumping to application after several power cycles. Is it because of encryption/signing?Can anyone suggest better approach to deal with this?
Hello everyone,I hope this message finds you well. I'm currently working on a project based on the STM32U575ZIT6 microcontroller and have successfully read and written to the flash memory with TrustZone disabled. Now, I am looking to enable TrustZone and perform read and write operations within the secure flash memory zone.I was wondering if anyone could provide guidance or share information on how to read and write on the secure flash memory on the STM32U575ZIT6 and if there's a way to determine the address range of the secure flash memory. Any insights or advice on this matter would be greatly appreciated.Thank you in advance for your assistance!Best regards,
Hello all,I'm working on SBSFU for the STM32F4 controller. A shell script has to be provided in the pre-build option of STMCUBEIDE. But while building the project I get the following error. c:/st/stm32cubeide_1.4.0/stm32cubeide/plugins/com.st.stm32cube.ide.mcu.externaltools.make.win32_1.4.0.202007081208/tools/bin/sh: ../test.sh../..: Permission denied
Hello,I am working with STM32F030RCTx controller. The CubeMx software is not supporting Default Polynomial State: "Disable". I wanted to use a custom CRC polynomial and need help initiating the same. Here is a screenshot for reference:Thanks.
I've been trying to set up the AES peripheral so that it's only using the hardware derived key from the SAES peripheral (without setting any clear text key). However, the only method mentioned in the reference manual on using the DHUK is through the shared-key mode, where a clear text key is encrypted and passed on to AES. I would like to know if there is a way to use AES with no clear text key (key is entirely hardware generated).Any insights or alternative approaches would be greatly appreciated.
We are using STM32H750VBT6 rev V and have encounter boards with mcus that freezes when we try to use the CRYP. So far we have seen that on failing boards the crypto registers are zeroed immediately after initialization but on a functional board there are non-zero content.What could cause this behavior?
Hello,I'm trying to use the SAES/AES shared key functionality in a Trustzone (TZEN=1, RDP = 0), using the functions provided by the HAL library. The board I use is the B-U585I-IOT02A.The only project example I found is with Trustzone disabled, but it runs correctly with my configuration (TZEN=1, RDP = 0) without any changes. Just one executable image loaded running in non-secure (without the secure - non secure switch).The code is roughly the following (I removed checks and key/IV definition):HAL_Init(); SystemClock_Config(); SystemPower_Config(); MX_ICACHE_Init(); MX_RNG_Init(); hcryp.Instance = SAES; hcryp.Init.DataType = CRYP_NO_SWAP; hcryp.Init.KeySize = CRYP_KEYSIZE_256B; hcryp.Init.pInitVect = (uint32_t *)pInitVectSAES; hcryp.Init.Algorithm = CRYP_AES_CBC; hcryp.Init.KeyIVConfigSkip = CRYP_KEYIVCONFIG_ALWAYS; hcryp.Init.KeyMode = CRYP_KEYMODE_SHARED; hcryp.Init.KeySelect = CRYP_KEYSEL_HW; hcryp.Init.KeyProtection = CRYP_KEYPROT_DISABLE; HAL_CRYP_Init(&hcryp) HAL_CRYPEx_Enc
Hi,I'm trying to encrypt and decrypt in my device, running on a STM32H753, using AES ECB.I'm initializing crypto like this: hcryp.Instance = CRYP; hcryp.Init.DataType = CRYP_DATATYPE_8B; hcryp.Init.KeySize = CRYP_KEYSIZE_256B; hcryp.Init.DataWidthUnit = CRYP_DATAWIDTHUNIT_BYTE; hcryp.Init.pKey = AESKey256; hcryp.Init.Algorithm = CRYP_AES_ECB; With following clocks: /* Enable CRYP clock */ __HAL_RCC_CRYP_CLK_ENABLE(); /* Force the CRYP Peripheral Clock Reset */ __HAL_RCC_CRYP_FORCE_RESET(); /* Release the CRYP Peripheral Clock Reset */ __HAL_RCC_CRYP_RELEASE_RESET(); After that, I just call HAL_CRYP_Encrypt & HAL_CRYP_Decrypt and everything goes fine. At least in the first two devices I used.When testing in more devices (same hardware, same firmware), I found many of them that were getting blocked inside HAL_CRYP_Encrypt. Debugging a bit, they are blocked in the actual encryption function CR
Hi everyone,I'm working in a Medical devices company and we use currently plenty of STM32s (F0,F1,F4, maybe soon H7). Until now, we didn't bother that much the cybersecurity topic for the firmwares but now the norms are forcing us :D.I checked a bit all the security features availables on STM32 products and i'm a bit confused because there is a looooot.Anyway, we currently use stm32-flasher to update our firmware via the uart interface of the bootloader. Here comes my question, how can i secure this update, we to be able to update if it's needed but to avoid/make it more difficult for anyone connecting to the device from our main CPU via our external debug interface?Thanks in advance for your answer,Thomas
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.