Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
Hello,Can we run STM32CubeU5 TFM Application (UM2581) on U575 since it has not crypto hw like U585?Thank you in advance!Best Regards!
I'm aiming to use the OEMiRoT sample project as a concept for secure updating of a large single-slot application in STM32U083 (need application size at least 160kB for migration from STM32L071). For that I need to give the bootloader a driver for external SPI flash where the encrypted updates can reside that the application downloads. The How_to_start_with_OEMiRoT_on_STM32U0 manual doesn't address the concept of debugging OEMiRoT at all. The provisioning procedure works, using RDP level 0 (even with modified code, as I can see an error printout that I added in the bootloader init).Starting a debugging session after this provisioning results in the debugger not being able to erase the sectors, on the other hand after erasing the chip beforehand (using ob_flash_programming.bat upto the erase part) it succeeds and I can debug, but immediately run into the protection mechanisms generating errors.Is there any manual how to debug this project and which defines to disable/modify to
Hi,I'm trying to get started with the SBSFU (2.6.2) on my custom board running an STM32L4A6. I've got a large external SDMMC flash chip (4GB) connected to the STM32 that I use for user application purposes. I'd like to allocate a small section of this chip to act as the download slot for the SBSFU, but I want to understand the implications, if any, for the SBSFU.I've read through the SBSFU User Manual and Integration Guide, but I'm still not completely sure on the following:1. I'd like to be able to use the full STM32 internal flash space for a single image, and have my download slot be in the external flash. So basically a 2_Images config with external flash.2. I saw one of the examples in SBSFU package is a 2_Images config with external SPI flash, so I think I'd just be modifying this example to include the drivers for the SDMMC flash instead of SPI?3. Will I still be able to store the downloaded image as an encrypted image in the external flash, even though my chip
Hello.I'm having trouble transfer the UserApp to SBSFU. Here's the description of the issue. Any help is appreciated!I prepared the NUCLEO-H753ZI board by disabling all the security and fully erase the board (by setting RDP level 1->0 ).I'm using the 1-Image example code, All security feature were disabled by #define SECBOOT_DISABLE_SECURITY_IPS in app_sfu.h. I loaded SBSFU.elf onto the board and transferred the UserApp.sfb via YMODEM. At first attempt the user application transferred without issue. At later attempts, the transfer stuck at first couple of packets until it failed. This also happened to a second board.Using the debugger, it seems to be failing at SE_CRYPTO_ReadKey_Pub() inside the SE_CRYPTO_Authenticate_Metadata() function. I have no clue for the reason. I tried a different approach by loading the final image "SBSFU_UserApp.bin" directly to the board and the program went into a infinite reset loop. From the debug, it failed at the same place.Becaus
It seems perfectly possible, under Level 2, to have a "boot block" which accepts a firmware block (say via USB MSC or via HTTP), encrypted with a key stored in the boot block, and you have a product whose firmware can be upgraded but can't be extracted. You can even publish the firmware block but with say AES256 "nobody" can decipher it. And obviously there would also be a CRC or a hash inside the encrypted block. Superficially there does not appear to be a vulnerability in this basic scheme. Internal software can freely program the CPU FLASH even with L2 set.That's if Level 2 doesn't have a back door.Googling yields various success stories but only for the 32F0 e.g.www.usenix.org/system/files/conference/woot17/woot17-paper-obermaier.pdf (STM32F051R8T6)www.aisec.fraunhofer.de/en/FirmwareProtection.html (32F0 general)community.st.com/t5/stm32-mcus-security/readout-protection-cracked-on-stm32/td-p/387997 (ambiguous but 32F0 again AFAICT)community.st.com/t5/stm32-mcus-secur
We are doing updates on a project which uses STM32H747 and ST cryptographic library (CMOX) / X-CUBE-CRYPTOLIB. It encrypts and decrypts data using these two functions:cmox_cipher_encrypt(CMOX_AES_CBC_ENC_ALGO, ....cmox_cipher_decrypt(CMOX_AES_CBC_DEC_ALGO, ...The project requires some refactoring and while doing that, odd things appeared, such as:There is an "initialization sequence" of doing a dummy encrypt and decrypt. No real initialization function is called.The key is 256 bit and data is aligned to 256 bits / 32 bytes, but IV is 128 bits.But the main problem is that sometimes encryption creates bad cipher. I compared it with AES tools on the PC. It tends to happen on the first real encryption, not during "initialization". I know that when refactoring code, it is likely that something break it, but a lot has been done to figure it out, such as:Code review of changes.Googling.Upgrading the library to latest v4.2.0 (but only header files changed, precompiled library was same).Verifyi
We are using the STM32H563IIK6 in our Device.I want to Enabled CRP protection. We are thinking use Level1only. Please can you share any test code.
Hi, I've decided to create a new post based on the similar one (https://community.st.com/t5/stm32-mcus-security/solved-stm32u5-tfm-example-b-u585i-iot02a-memory-mapped-psram/td-p/108722) which has been solved but doesn't work for me.The problem is as follows:- I want to run my application on the B-U585I-IOT02A board that uses the BSP_OSPI_NOR (OSPI2) with the external flash memory with the following parameters: BSP_OSPI_NOR_Init_t init_params = { .InterfaceMode = BSP_OSPI_NOR_OPI_MODE, .TransferRate = BSP_OSPI_NOR_STR_TRANSFER }; BSP_OSPI_NOR_Init(0, &init_params); - When using the standard application (TZEN=0, no SBSFU), everything works correctly - the BSP_OSPI_NOR_Init returns 0 and writes/reads works correctly- When using the SBSFU application (https://github.com/STMicroelectronics/STM32CubeU5/tree/v1.0.2/Projects/B-U585I-IOT02A/Applications/SBSFU version 1.0.2) I can't initialize the OSPI in the NonSecure application. I always get the "-5" return value
HiI am using the SBSFU application on the stm32u585 board and I am trying to use the crypto library as explained in the CRYP_SAES_ECB_CBC example but the error_handler is triggered when the MX_SAES_AES_Init is initialized.Any help?
I tried CRP protection for STM32H563IIK6. But is it not working. This is the code.#define OB_RDP_LEVEL_0 ((uint8_t)0xAA)#define OB_RDP_LEVEL_1 ((uint8_t)0x55)#define OB_RDP_LEVEL_2 ((uint8_t)0xCC)HAL_StatusTypeDef FLASH_If_WriteProtectionConfig(uint32_t modifier){FLASH_OBProgramInitTypeDef OptionsBytesInit= {0};u32 lu32_ReadValue =0; if(modifier == OB_RDP_LEVEL_2 ){return 2;} HAL_FLASH_Unlock();HAL_FLASH_OB_Unlock(); lu32_ReadValue = FLASH->OPTSR_PRG;if(((lu32_ReadValue >>8) & 0xFF) == modifier ){return 1;} FLASH->OPTSR_PRG |= (modifier <<8); //HAL_FLASHEx_OBProgram(&OptionsBytesInit);/* Launch Option Bytes Loading */HAL_FLASH_OB_Launch();HAL_FLASH_OB_Lock();HAL_FLASH_Lock();return 0;}I'm calling this function with argument FLASH_If_WriteProtectionConfig(OB_RDP_LEVEL_1 )
Hi, I'm quite familiar with STM32 trustzone features. Also I know due to there's a random number generator it should be ANSSI capable. But I can't find anywhere a text "ANSSI". Have you as a ST already applied a ANSSI certificate for STM32U545 or any plan to apply?
Hi, good morning, sir/madam.We are using a STM32F423ZHT6 MCU for Smart Lock in our project.We have some security purposes for our lock and need security boot options.So please clarify this MCU has secure boot options. If this MCU has secure boot options, please explain how to use them.
Hello We are testing the SBSFU project on STM32U585 released in the cubeu5 project and came to see that the secure project uses 14kb of size and non secure approximate 1.2MB. Our requirement is to add some modules into the secure area and we need to increase the space in the secure area from 14 kb to 300kb (the modules will be called from the nonsecure application as well - so any changes in the secure nsc area required ?)and the corresponding size in the non secure size can be reduced as well. How can we increase the space in the secure application(the secure .ld file without causing any conflict in the address range after the change has been made).could anyone suggest the steps required to adjust the spacingany inputs are preferredThanks
Hello, I am confused in finalizing a secure chip for my iot gateway(linux). I read all the documents for ST SAFE-A110. My gateway has an mqtt broker which is bridged to another broker in cloud. In order to Implement TLS for mqtt i need to provide key and certificate path in the mosquitto broker configuration file. Which is impossible since key is stored in the chip and is not user readable.question:1. How to implement tls over mqtt using STSAFE-A110? I have read that there is a challenge given to the chip to authorise a connection from cloud is it generically said in the case of tls or any additional program needs to be run in cloud to acheive this or this will only work in case of clouds like Azure or AWS ? is it possible to do secure authentication using oem cloud?? i am new to this security kind of application any help would be much appreciated.
Is this the right way? if (FLASH_OB_GetRDP() != OB_RDP_LEVEL_2) { HAL_FLASH_Unlock(); // Unlock the flash memory HAL_FLASH_OB_Unlock(); // Unlock the option bytes *(__IO uint8_t*) OPTCR_BYTE1_ADDRESS = OB_RDP_LEVEL_2; // Set RDP2 HAL_FLASH_OB_Launch(); // Activate it HAL_FLASH_OB_Lock(); HAL_FLASH_Lock(); } You have to test if RDP2 is already set otherwise you get a hard fault - and a bricked unit unless you have some recovery mode.The above uses existing ST-provided Cube IDE code. There are other examples which are more direct e.g.HAL_FLASH_Lock() is written as FLASH->CR |= FLASH_CR_LOCK but it is the same code. Lots of people going around in circles e.g.https://community.st.com/t5/stm32-mcus-embedded-software/what-causes-hal-flash-ob-unlock-to-call-hardfaulthandler-it/td-p/59977/page/3Can anyone see a problem with my code? I've tested it and it appears to set RDP2 (the debugger stops working with error 19 or some such) but not yet with the IF statement around
Hi,I've developed a custom board and I want to leave an encrypted signature using the STSAFE-A110 chip. However, I'm coding my board in Python, and I'm having trouble figuring out how to interact with the chip. I found the "STSAFE-A complete set of API built on STM32Cube," but since it's in C, I haven't been able to integrate it into my Python code. Is there a version of this content written in Python, or how can I convert it myself? I'd appreciate any help you can provide.Best Regards
Hello,I would like to be able to debug the SBSFU application of the STM32U5 microcontroller series. What steps do I have to follow to be able to do it? Thanks in advance
Hello,I am using the stm32u5 SBSFU application and I am trying to implement my own 64 MHz clock. But when I change it from 160 Mhz to 64 Mhz the application does not work. Can the SBSFU clock work with less than 160 MHz or does it have to work only with that frequency?
Thissuggests that one cannot execute code from SRAM. Is that really correct?Also there is ambiguity on whether the OTP area (512 bytes plus the control block) is readable in RDP2. Why say "512 bytes" and not just all-OTP?The OTP area must remain usable under RDP2 and readable by internal code, but not accessible externally (with a debugger).Above is fromhttps://www.st.com/resource/en/application_note/an5156-introduction-to-security-for-stm32-mcus-stmicroelectronics.pdf
Hello, I have a ARM Keil MDK project with STM32H563ZI and want to protect it against readout. So I want to use the Debug Authentication. The trustzone is not activated. The first time programming is done over UART and then over USB by an own tool and IAP. In the firmware IAP routine I can switch the product sate to "Provisioning", but I am not sure how to program the SHA256 key into the HDP memory. Am I on the right way with this ? OBInit.OptionType = OPTIONBYTE_HDP;OBInit.HDPStartSector = ???; // OBKeys address FLASH_OBK_HDPL1_BASE_S = 0x0ffd0100 OBInit.HDPEndSector = ?????;status = HAL_FLASHEx_OBProgram( &OBInit ); RegardsAxel
STM32U585xx SBSFU source code examples do not build properly.Nice to meet you.If you download and check the en.stm32cubeu5-v1-6-0.zip file (including patch), it contains an example for STM32U585 SBSFU.If you try to build the 'SBSFU' example for 'B-U585I-IOT02A' board according to the instructions in readme.html, it does not build properly and 'Build failed' occurs, and even if it is built properly, 'SBSFU_Appli\Binary\sbsfu_app.bin' ', etc. are not created.I would like to solve the problem for some reason, so please give me some advice.*****Example source: Refer to STM32Cube_FW_U5_V1.6.0/Projects/B-U585I-IOT02A/Applications/SBSFU/readme.html.Tools: IAR EWARM 9.50.1situation :'SBSFU_Appli\Binary\sbsfu_app.bin' not created.'SBSFU_Appli\Binary\sbsfu_app_init.bin' not created.'SBSFU_Appli\Binary\sbsfu_app_enc_sign.bin' not created.'SBSFU_Appli\Binary\sbsfu_app_sign.bin' not created.'SBSFU_Loader Non Secure Project' Build failed.We are unable to proceed because this issue has not been resol
I have 2 x SMT Electric Feeders (Same Model --- HGWC Yamaha YMH-EF8-000 8mm) with STM32F030K6 MCU that are having issues with Core/CPU lock up. NOTE: I know that when the STM32F030K6 chip is configured for either RDP Level 1 (Read Protection) or RDP Level 2(Chip Protection), *ANY* attempted access via JTAG/SWI/SWD will lock the core. This is by design, and it is how RDP1/2 prevent outside access to FLASH and RAM. The programmer is trying access the chip after reset, which triggers the lock. This is normal behavior. You always need to power cycle after programming RDP1 or RDP2. i have tried everything to unlock Core or CPU with STM32 Cube Programmer using ST-LINK V3 Set (Also tried ST-LINK V2 ) but in vain. I have several SMT electric Feeders which are working fine but i don't have the original .bin file from the manufacturer who seem to have gone out of business. No response from them anymore. My intention is to extract or download
Hi Team,I am seeking information regarding key storage in ITS memory. Specifically, I would like to know if ST provides any PSA Secure Storage API that automatically stores keys encrypted with RHUK to ITS memory. Additionally, I am interested in understanding whether this API can retrieve the key in plaintext when needed.Thanks&RegardsP.Hitesh
Hi Team,Am using STM32H573I-DK boardCan i get any document or explanation that how SFI is processing and what are the keys involved in encryption and authentication.I already referred AN4992 and wiki pages but the process is not so clear.
Hi Everyone! I am trying to understand why I cannot get the result of the AES in GCM mode HAL_CRYP_Encrypt on the F439ZI board to match the AES in GCM result anywhere else. I am using Python's pycryptodome library for result comparison. I have previously seen this very informative post: https://community.st.com/t5/stm32-mcus-security/a-guide-to-the-hal-of-the-aes-accelerator-or-how-to-fix-it/m-p/134252However, I am still stuck somewhat. I am also using the default AES-256 key together with the default IV provided by the CubeMX: CRYP_HandleTypeDef hcryp; __ALIGN_BEGIN static const uint32_t pKeyCRYP[8] __ALIGN_END = { 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000}; __ALIGN_BEGIN static const uint32_t pInitVectCRYP[4] __ALIGN_END = { 0x00000000,0x00000000,0x00000000,0x00000002}; __ALIGN_BEGIN static const uint32_t HeaderCRYP[1] __ALIGN_END = { 0x00000000}; /** * @brief CRYP Initialization Fu
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.