Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
I've tried to enable the CRYPT and HASH peripherals by setting bits 5 and 4 in the AHB2ENR register, but all peripheral registers read as zero and writes are ignored as if the clock wasn't enabled or the peripheral was missing. Does this chip have hardware crypto and if it does what's required to initialize the hardware to calculate a SHA256 hash?
Hello all, I am using the SBSFU v2.6.2 on STM32H753 - (2 slots based) for a few months now, and am trying to enable the Firmware Rollback feature right now. During this attempt, I had enabled ENABLE_IMAGE_STATE_HANDLING as required in SE, SBSFU and UserApp projects and then built all of them. I see in the SFU header region of the User App binary that gets generated finally and find that the parameter FwImageState is filled with FWIMG_STATE_VALID whereas I expected FWIMG_STATE_NEW. (Please refer screenshot below)Due to this, I am failing to update to Self-Test state at SFU_IMG_UpdateImageState(), while launching from Active slot, as well as during the Firmware installation process at FirmwareToInstall(), as it fails to recognize the new image. At SFU_IMG_UpdateImageState()At FirmwareToInstall()I use the following command in the postbuild.sh that generates the header:command=$cmd" "$prepareimage" header -m "$magic" -k "$ecckey" -p 1 -r 44 -v "$version" -f "$
Hello there!I've been trying to make the Lora-FOTA example portable by converting the include paths, resource links, linker path and pre/postbuild files to be "project related paths" instead of absolute paths.Everything worked out very well with kms_blob and secore projects. I've been getting an issue with bfu project build.I'm getting this error when I'm trying to compile the project after I've updated all the above mentioned paths.1. I have moved the SECoreBin project 1 dir back.2. I have renamed the build output from "Debug" to "BUILD_debug"3. I have compiled first the kms_blob then the secorebin and lastly the bfu project (which ends up in error)4. Other two builds are successfull with no errors. Is there anything missing ?1. I'm suspecting workspace related issues (even I don't see any workspace relation in all the paths or in the .cproject or in .project files2. Is there fixed locations regarding the assember for this project ?! Am I going nuts ?! Kind regards,Kyf
Hello, I am using the STM32 Cryptolib. I need to get the modulus and exponent of RSA public key from a .pub or .pem files. After decoded from base64 I need to decode the DER format (in ASN.1 format). Has anyone any suggestion of which libray may I use? Cryptolib only accept modulus and exponent has two parameters.
For some reason bootloader fails to pass image tag authentication. SE_AuthenticateFW_Finish(pSeStatus, fw_tag_output, (int32_t *)&fw_tag_len). returns SFU_SUCCESS status. However, compare to the tag retrived from image header located in MCU flash is failed:if (MemoryCompare(fw_tag_output, fw_tag, SE_TAG_LEN) != SFU_SUCCESS)Validated, that the tag compiled and incorporated into sfb image is exactly matching the one retrieved by SE mechanism from application image header located in MCU flash. Despite this, tag verification fails.Also, all chanks of image are passing authentication correctly SE_AuthenticateFW_Append(pSeStatus, fw_image_chunk, (int32_t)fw_chunk_size, fw_chunk, (int32_t *)&fw_chunk_size);We are using CubeMX IDE environment Version: 1.10.1Build: 12716_20220707_0928 (UTC)
Hi, I have been trying to use P-Nucleo-WB55 project from SBSFU 2.6.2 with SECBOOT_AES128_GCM_AES_128_GCM_AES128_GCM crypto option. I have disabled all security IPs for ease of debugging and have tried with local loader and no loader configurations. I am using STM32 IDE and following all steps. Infact the SECBOOT_ECCDSA_WITHOUT_ENCRYPT_SHA256 crypto option works for me under same settings.However, I am never able to use this crypto option to successfully decrypt and execute UserApp. Has anyone been able to use this crypto option with P-Nucleo-WB55 project.
Hi all,I'm trying to implement Active Tamper in STM32U585 controller, im trying to generate the SEED, the Seed is getting generated, but the SEED is not getting updated in the SEED reg of tamper, i'm attaching the code and seed values generated for reference. can anyone help me whats wrong here, reference image for Seed reg not updated.
Hi, I am a beginner in SBSFU.STM32L4S7ZIT6STM32CUBEIDE Version: 1.12.0STM32CUBEProgrammer v 2.13.0 (for download SBSFU and full chip erase)Tera Term v 4.106When run SBSFU, I can get EXECUTE USER FIRMWARE at end, but cannot run UserAPP.if reset SBSFU, still cannot run UserAPP.I have done some debug:1. never use RDP2 level 22. boot is set to GND3. modify linker_common and STM32L4S7ZITX_FLASH.ld by STM32CubeExpansion_SBSFU_V2.6.2 (B-L4S5I-IOT01A)4. modify system_stm32l4xx.c and STM32L4S7ZITX_FLASH.ld in UserAPP for SBSFU( if don't change, i mean that UserAPP can run normally without SBSFU)5. disable SECBOOT_DISABLE_SECURITY_IPS at app_sfu.hreference:1. if i run UserAPP alone, it show error Break at address "0x1fff51da" with no debug information available, or outside of program code. then it can run to main.2. if i run SBSFU alone, it show error Break at address "0x1fff51da" with no debug information available, or outside of program code.&n
Hi @ST Community @Jocelyn RICARD ,GreetingsIam implementing using the reference from TF-M SBSFU for secure boot and secure firmware update service. As per UM2851 the signature scheme that is used is RSA 3072/2048 using RSA-OAEP padding.1. My requirement is to use RSASSA-PSS padding. how can i get this implementation done without altering the SBSFU Implementation. 2. I also have a requirement to decrypt the firmware - during the firmware update process - in the application using AES256. 3. one more clarification -. when executing the TFM_update.sh script the plain application is being dumped into the controller instead of the encrypted_signed_firmware.bin file, on the other hand when doing a firmware update the encrypted-signed_firmware.bin file is downloaded to the controller. please suggest how to download the encrypted_signed_firmware.bin directly using the TFM_update.sh script.I require sincere support and help in these 3 aspects and the steps on how these can be impl
Am using Nucleo-STM32H573 Board. i wanted to generate a pair of public and private keys. Guide me
Hi,In my application using stm32l496zgt6 I'm using DCMI to capture Image and storing image Data in External PSRAM , this code works fine, Problem is whenever integrating this piece of code with application using SBSFU, As soon as MX_FMC_Init(); function is called in main(); MemManage_Handler is being called and application is freezing here. I just wanted to know if MPU settings of SBSFU is causing this problem or anything I'm missing with respect to SBSFU that i have to take care while using External memories.
Hello,I am working on STM32L496, that does not have an AES hardware encryption, and i wanted to generate a pair of RSA Keys, public and private keys.I wonder if i can use mbedTLS or any library to do so or not?If i can do it, is there any example or documentation? Thanks
I am trying to port SBSFU to my target MPU which is F429ZI. I am currently using NUCLEO-F429ZI board for testing and used Discovery-F413ZH example as starting point.To do so, I replaced BSP functions with NUCLEO pin mapping (changed USART6>USART3, USER_KEY and LEDs) easily, but the more critical part are changes in "mapping_sbsfu.ld" and "mapping_fwimg.ld". As the target MPU has more flash I left "mapping_fwimg.ld" unchanged and for "mapping_sbsfu.ld" I just changed the following: /* SBSFU RAM1 region */ __ICFEDIT_SB_region_RAM_start__ = __ICFEDIT_SE_region_RAM_end__ + 0x1; __ICFEDIT_SB_region_RAM_end__ = 0x200200EF; //original value for F413ZH 0x2003FFEF /* Shared RAM for Image State Handling */ __ICFEDIT_SB_FWIMG_STATE_region_RAM_start__ = __ICFEDIT_SB_region_RAM_end__ + 1; __ICFEDIT_SB_FWIMG_STATE_region_RAM_end__ = 0x200200FF; //original value for F413ZH 0x2003FFFF Now I can run the SBSFU and program UserApp for the first time, however any attemp
Pls suggest us possible controller for our below requirement : My Controller ..expectation : CANTwo-uart Signed bootSslCypher - like i read in esp32 documentation, is it just software thing, can we use it for all STM controllers ? Secure boot - as i read its also software things, not depend on hardware so any STM32 can have secure boot, right ? as i found Stm32 cube extension software named X-CUBE-SBSFU for secure boot. OTP - one-time program Acceleration for encryption - How much acceleration needed, how its necessary, if My goal is just get CAN data & sending that 200-300 byte data to server. every second.is this hardware stuff or this also can be achieve by coding only to any stm32 uc.IoT / BLE security - ble we using for sending one byte & 100 kb photo via phone ble.
I received the boards, that's great. But where do I get the material for the Secure workshop? Maybe I missed something isn't there a link to download for this file STM32SecuWS-material.exe?
Hii dont fully get what is possible under RDP Level1 on STM32H743. I have a application which loads credentials into SRAM2. AN5156 writes that debug accesses to SRAM2 are forbidden. As it seems i can still read SRAM2 via STM32CubeProgrammer but the data is 0. Then i tried to run my application from flash while the debugger is attached to see if i could then read the credentials from sram2 but i cant get the fw running while the debugger is connected.Is that a protection feature or am i doing something wrong?Is there a way to externally access SRAM2 after the fw has run for a while?Are there other security implications for using rdp level 1 and i should use rdp level 2?Thanks
Hi,we are developing a firmware on the STM32U575QG MCU. Trustzone is enabled and configured as follows (DBANK active).Flash memory size is 1MB, with DBANK active. So, from my understanding, it should be two different bank, each one composed by 64 pages of 8kB.BANK1:- secure from page 0 to page 63 (all bank is secure, 512kB);BANK2:- secure from page 0 to page 31 (256kB secure). From 32 to 63 unsecure flash;We are now trying to erase NS pages from secure domain using interrupts. For instance: FLASH_EraseInitTypeDef EraseInitStruct; HAL_FLASH_Unlock (); __HAL_FLASH_ENABLE_IT_NS (FLASH_IT_EOP); __HAL_FLASH_ENABLE_IT_NS (FLASH_IT_OPERR); HAL_NVIC_EnableIRQ (FLASH_IRQn); __HAL_FLASH_CLEAR_FLAG_NS(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR); EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES_NS; EraseInitStruct.Banks = FLASH_BANK_2; EraseInitStruct.Page = 32; EraseInitStruct.NbPages = NbOfPages; HAL_FLASHEx_Erase_IT(&Eras
Hello, I currently working with a NUCLEO-H563ZI Development Board.I executed a script(Provisioning.bat) and set the product state to CLOSED according to the tutorial(How to start with OEM-iROT on STM32H573 and 563–Arm® TrustZone® enabled?).I used debug authentication to turn on secure debug and succeeded, but still couldn't connect the chip with STM32CubeProgrammer.Could you please assit me to look for steps that went wrong?Best Regard.
Hello, I would like to install the stm32 cryptographic firmware library to use with the STM32F030K6Tx.I download the latest version of the library the 4.1.0 from https://www.st.com/en/embedded-software/x-cube-cryptolib.html.I followed the guide https://wiki.stmicroelectronics.cn/stm32mcu/wiki/Security:Getting_started_with_the_Cryptographic_Library but I cannot find the correct library for the STM32F0.In the description of the library package is clear that the firmware includes also the STM32F0 series, so I need some help to install the correct library. Thank you for support me.
HiI try to activate readout protection using jlink/jflash.The read out protection is level 0 (0xaa on last bytes of option byte currently 0xDFFFE1AA), I want to set level 1, using 0x00 value instead of AA.After flashing my binary, lock and optlock protection are successfully removed using keys and optkeys writing in flash registers. Then I write 32 bits option bytes at 0x01fff7800(w4 0x1FFF7800 0xDFFFE100), this command fails. According to reference manual, this writing sequence is supposed to erase option byte(including complemented option bytes?), then write option byte.Here received error:****** Error: Programming failed @ address 0x1FFF7804 (block verification error) Failed to restore target. RAMCode never stops0x1FFF7804 address corresponds to complemented option bytes(32 bits), which should be computed and written after setting OPT_START(this is the next step in my script).device stm32g0b1re //init and flash bin [...] //Remove Lock w4 0x40022008, 0x45670123 // Send KEY1 w4 0x4002
If I use AES mode CRYP_CR_ALGOMODE_AES_CBC, the decryptedText array does not match with the last 3 uint32_t values in the array. Same goes with ECB mode. However, when GCM or CCM modes are used, the decrypted data is same as the plain text. I could not find any hints in the errata sheet either.Has anyone else faced a similar problem? #define BUFF_LEN 15 uint32_t AES256Key[8] = {0xB374A26A, 0x71490437, 0xAA024E4F, 0xADD5B497, 0xFDFF1A8E, 0xA6FF12F6, 0xFB65AF27, 0x20B59CCF}; uint32_t InitVector[4] = {0x7E892875, 0xA52C59A3, 0xB588306B, 0x13C31FBD}; uint32_t Ciphertext[BUFF_LEN] = {0x42831ec2, 0x21777424, 0x4b7221b7, 0x84d0d49c, 0xe3aa212f, 0x2c02a4e0, 0x35c17e23, 0x29aca12e, 0x21d514b2, 0x5466931c, 0x7d8f6a5a, 0xac84aa05, 0x1ba30b39, 0x6a0aac97, 0x3d58e091}; uint32_t Plaintext[BUFF_LEN] = {0xd9313225, 0xf88406e5, 0xa55909c5, 0xaff5269a, 0x86a7a953, 0x1534f7da, 0x2e4c303d, 0x8a318a72, 0x1c3c0c95, 0x95680953, 0x2fcf0e24, 0x49a6b525, 0xb16aedf5, 0xaa0de657, 0xba637b39
Hi ST Support Team,We used the ST-provided SBSFU solution for firmware upgrade purpose.As per our needs, SBSFU/TFM-Boot and SBSFU/TFM-Loader successfully jump to own created application[ThredX OS based].Below are the steps I used when integrating my own application with SBSFU. Create Project Name: Application [Enable TrustZone with Thread-X OS In STM32U585ZIT6Q controller]Copy the SBSFU_Appli\STM32CubeIDE\NonSecure\STM32U585AIIX_FLASH.ld and Added in own application non secure folder[output.ld - added prebuild file in secure project properties]Copy the SBSFU_Appli\STM32CubeIDE\Secure\STM32U585AIIX_FLASH.ld and Added in own application secure folder[output.ld - added prebuild file in non-secure project properties]Copy SBSFU_Appli\STM32CubeIDE\Postbuild.sh and Added in own application project repositoryUpdate NS address in own application secure-> main.c "#define VTOR_TABLE_NS_START_ADDR NS_CODE_START."Copy SBSFU_Appli\STM32CubeIDE\NonSecure\Application\User\startup_stm32u5xx.c and Ad
We are updating our buildtools to GNU Tools for STM32 11.3.rel1 for a new project that is using an existing SBSFU 2.4.0 based bootloader from a previous project that was using an older compiler. Trying to compile the bootloader gives following errors: data_init.c: In function 'LoopCopyDataInit': data_init.c:46:29: error: array subscript 'uint32_t {aka volatile long unsigned int}[0]' is partly outside array bounds of 'uint8_t[1]' {aka 'unsigned char[1]'} [-Werror=array-bounds] 46 | dst[i] = src[i]; | ~~~^~~ data_init.c:36:24: note: while referencing '_sidata' 36 | extern uint8_t _sidata asm("_sidata"); | ^~~~~~~ data_init.c:46:20: error: array subscript 'uint32_t {aka volatile long unsigned int}[0]' is partly outside array bounds of 'uint8_t[1]' {aka 'unsigned char[1]'} [-Werror=array-bounds] 46 | dst[i] = src[i]; | ~~~^~~ data_init.c:82:24: note: while referencing '_sdata' 82 | extern uint8_t _sdata asm("_sdata"); | ^~~~~~ data_init.c: In function
Currently developing a product to update the firmware of a product through SWD, i encounter an issue with the flash of the target (STM32G070RB).After multiple changes in the RPD (from 0->1 & 1->0) the flash of the MCU can't be erased. Some word will not erase to 0xFFFFFFFF, but instead will be at 0xFFFF0080. Once it's in that state, changing the RDP to trigger a mass erase will not fix the flash. The STLink is unable to mass erase or page erase the chip, and also unable to program anything to the chip.Initially i though that my programmer was the issue of the flash error of the target. But when it happens it was when changing the RDP from 1 to 0 with the STLink. I was not sure of that on the first occurrence of the issue. But today it happened again, while not using my own programmer at all.So i am now sure that it happen after changing the RDP from 1 to 0 using the STLinkV3.Does anyone already encounter this issue?
When I Update WRP option bytes in stm32u585 via program and call OB_launch is resetting device continuously.Here is the code snippet. any other configurations I am missing??
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.