Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
I'm using X-CUBE-CRYPTOLIB v4.1.0 on an STM32H735. I'm using the libSTM32Cryptographic_CM7.a static library supplied by the crypto library.I'm running into an interesting issue where the address that the binary library is using for the CRC peripheral is wrong, but only when running under emulation (I'm using Renode.io). Running on the real device does not have this issue. The firmware used in both cases is identical (i.e. I'm loading the same firmware binary into Renode or into the STM32).For the STM32H735, the CRC peripheral is at 0x58024c00, which is off D3_AHB1. This is all computed in the stm32h735.h header file supplied by the HAL. If I check the macro definitions in my C source, everything lines up correctly.Tracing around in the assembly code in the crypto library, it looks like cmox_md_generateTag is finding the address of the CRC peripheral through a bit of math, a lookup table and a value passed to it by cmox_hash_common_compute() which is called by cmox_sha224_comp
Hello,We'd like to integrate with some customers smartcard infrastructure.We cannot control which cards and standards are used and therefore would need an MCU that can read all cards possibly in use.Private keys will be provided by the customers.If we'd need several MCUs, please tell us the complete list.Best wishes,Fabiano
Hello,I'm using SBSFU to secure firmware runs and firmware upgrades. My target board is a custom board with F429ZI and external SPI Flash, but for the beginning, I've started testing with NUCLEO-F429ZI.I have successfully ported "2-Images" example from F417-Discovery to my Nucleo board and everything looks to work fine, however, when I try to expand the size of active and download slots, I face a memory fault.The F429ZI has a 2MB Flash arranged in 2 banks of 1MB, but I found that I can use the entire Flash without utilizing dual-bank architecture, I just use it as a single 2MB flash.If I arrange the slots layout as below everything works fine: /* swap (128 kbytes) */ __ICFEDIT_SWAP_start__ = 0x08100000; __ICFEDIT_SWAP_end__ = 0x0811FFFF; /* Active slot #1 (768 kbytes) */ __ICFEDIT_SLOT_Active_1_start__ = 0x08040000; __ICFEDIT_SLOT_Active_1_end__ = 0x080FFFFF; __ICFEDIT_SLOT_Active_1_header__ = __ICFEDIT_SLOT_Active_1_start__; /* Dwl slot #1 (768 kbytes) */ __ICFEDIT_SLOT_Dwl_1_
I am using stm32L4 series, I try to encrypt data using STM32 cryptographic firmware library and i use the apis cmox_initialize() , cmox_cipher_encrypt() and cmox_cipher_decrypt() I am using the library libSTM32Cryptographic_CM4.a is any one help me to find the memory consumption of these apis
Hi @ communityI am working around the flash lock protection that was somehow enabled in my development board(B-U585-IOT2A) while testing the TF-M SBSFU Application and now i am unable to do a flash erase on my chip. The cube programmer is showing the following error message while doing a full chip erase:As per the inputs received(referred from st tutorial video), I have tried the following sequences to deactivate the TF-M with no valid secure code:1. Boot from RSS(Boot 0 pin connected to VDD).2. Power on Reset.3. Separate power given to the development board(usb c supply with change in jumper position JP4) in addition to ST Link supply.4. Connected to Cube Programmer in Hot plug and SWD mode.5. Enabled the TZEN bit and did power reset.6. Changed the RDP Level to DC and did power on reset.7. Changed RDP from DC to level AA and TZEN=0 at the same time.8. after power on reset checked the chip erase functionality. it is returning the same error message.I checked the option bytes
Hi all,I would like to know what are the known issues for the cryptographic library (version 4.0.1). How I can do ?Thanks,Damien
Hi,Can anyone help me why size of rom area using large size?I'm porting SBSFU STM32G071 to STM32G0B1 to add USB CDC. Best regards,TDR
After using STMCubeProgrammer 2.21 to set the RDP byte to BB, the board works fine, but Cube programmer is later unable to access the board; I've tried different modes, under reset etc. The disk folder shows when plugged in to the USB with FAIL.txt listing and a connection error message.This only started happening after updating the programmer a week ago.Has anyone had this problem and found a solution? Thanks
Hi all,I'm working in a project (with STM32L462) in which we're building our own bootloader to perform secure boot and firmware upgrade. There are some issues we're still struggling with, regarding protection of our code (and data). Hopefully someone can give me some explanation, hint or application note to help me out.So, these are what we need:We have our own bootloader, and we want to setup Read-out protection (to avoid the source code to be read out by JTAG or debugger) and also Write protection to avoid the source code from being overwritten (accidentally) during operation. So, the first question is if we can setup both read/write protection on the same flash area? I have read about PCROP but can't really figure out if using PCROP is a better option or enabling both RDP and WRP is better?We have a flash area to store the executable firmware which I will have to overwrite during firmware update. So, next question is, can I disable WRP to overwrite the data and then enable it again?
I set up a very simple test project. It is a .ioc file from another project to which I wanted to add a virtual com port interface. I added the vcp in the cube plugin and generated the code. However, if I include a CDC_Receive_FS() function this gets flagged as undefined.If I click on the function and open declearation the function declaration does pop up.I tried to include the paths again manualy. No change.Attached is the code I'm working with. There is only the FastNeopixel.ioc and the two lines in main:uint8_t buf[2] = {0x01}; CDC_Receive_FS(buf, 2);Which have been added / changed.Thank you in advance.AndreasBuild Console Output:22:43:12 **** Incremental Build of configuration Debug for project FastNeopixel **** make -j16 all arm-none-eabi-gcc -o "FastNeopixel.elf" @"objects.list" -mcpu=cortex-m3 -T"C:\Users\justRandom\STM32CubeIDE\workspace_1.3.0\FastNeopixel\STM32F103C8TX_FLASH.ld" --specs=nosys.specs -Wl,-Map="FastNeopixel.map" -Wl,--gc-sections -static --specs=nano.specs -mfloa
Hi @ST Community GreetingsI'm trying the TF-M Application package v1.2 released by ST and am following the instructions in UM2851.I'm currently in the step shown below:in windows im unable to run the TFM_Update.sh script that is provided in the following location(my installation path)C:\TFM\en.stm32cubeu5-v1-2-0\STM32Cube_FW_U5_V1.2.0\Projects\B-U585I-IOT02A\Applications\TFM\TFM_SBSFU_Boot\STM32CubeIDE.To enable the installation of shell scripts i used the cygwin tool and tried running the above mentioned script from the path and the following error is returned:Is there any changes that i have to do(as i m not much familiar in shell scripts). Is my method correct? There is another path that contains a batch file TFM_UPDATE.batch in the path(for EWARM IDE). Can i use this batch file with STMCube IDE. C:\TFM\en.stm32cubeu5-v1-2-0\STM32Cube_FW_U5_V1.2.0\Projects\B-U585I-IOT02A\Applications\TFM\TFM_SBSFU_Boot\EWARM.Is there any manual sequence by which i can upload the code?
Hello all, When I had a beautiful STM32U5 in hand the world was still good.But now I have a comprehension question about the STM32L0, I have an 8-bit buffer and now the fastest way to AES decrypt/encrypt this data is via DMA with active burst mode. To activate the burst mode on the STM32U5, we just need to set the corresponding registers with the needed value, but this is not the case on STM32L0.Do I correctly understand, that Burst mode is only available on Timer2/3? So that to transfer data using this mode to the AES engine, 3 DMA channels must to be configured. DMA channel: 1. Buffer -> TIM2/3 Register (DMA Burst mode 8bit -> 32bit) for a burst mode here. (first DMA Channel) 2. TIM2/3 -> AES-IN (second DMA Channel) (32bit->32Bit)AND to get the data out of AES 3. AES-OUT->De/Encrypted newBuffer (No burst) (third DMA Channel)(32bit->32bit) Are these the corresponding sequences that need to be performed? We absolutely
Hi,We are migrating our code from using the legacy crypto lib to the libSTM32Cryptographic_CM4.a.I can not find api document describing the functions etc, is there any thing like there was for the legacy lib (like https://www.st.com/resource/en/user_manual/dm00215061-stm32-crypto-library-stmicroelectronics.pdf)?2.I am trying to write code that gets the public key from a given private key.I had it working with the legacy code using the retval = ECCscalarMul(G, ephermPrivKey, ephermPubKey, &ECparams, &mb);but now I can not get it to work. This is my code: retval = cmox_ecdh(&Ecc_Ctx, CMOX_ECC_CURVE_SECP256R1, ephemPrivateKeyMsg.p_buf, ephemPrivateKeyMsg.length, ecc_256_FullG, sizeof(ecc_256_FullG), fullEphermPubKey, &fullEphemPubLength);where ecc_256_FullG is the x and y values of G, first x coordinate, then Y coordinate (that were correct in the legacy code), see belowAny ideas? example code for this?Thanks!const uint8_t ecc_256_FullG[]={0x6B, 0x17, 0xD1, 0
My controller is STM32L462. I need to compute CRC16 for Modbus application. There is CRC initialization function:void MX_CRC_Init_CRC16(void) { hcrc.Instance = CRC; hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_DISABLE; hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_DISABLE; hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE; hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE; hcrc.Init.GeneratingPolynomial = 0xa001; hcrc.Init.InitValue = 0xffff; hcrc.Init.CRCLength = CRC_POLYLENGTH_16B; hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES; if (HAL_CRC_Init(&hcrc) != HAL_OK) { Error_Handler(); } }There is function to calc CRC16 by software. It works correct.uint16_t calc(uint8_t *packet, uint8_t size) { uint16_t crc_polynome = 0xa001; uint16_t crc = 0xffff; for (uint8_t j = 0; j < size; j++) { crc ^= packet[j]; for (uint8_t i = 0; i < 8; i++) { if (crc & 0x1) { crc >>= 1; crc ^= crc_polynome; } else
Hi,My STM32H735G-DK is having issues.When I try to flash a known good firmware, I get the following:command: STM32_Programmer_CLI -c port=SWD freq=4000 mode=UR --erase all -d build/stm32h735.bin 0x08000000 -v --start 0x08000000------------------------------------------------------------------- STM32CubeProgrammer v2.5.0 ------------------------------------------------------------------- ST-LINK SN : *** ST-LINK FW : V3J7M2 Board : STM32H735G-DK Voltage : 3.28V SWD freq : 8000 KHz Connect mode: Under Reset Reset mode : Hardware reset Device ID : 0x483 Revision ID : Rev Z Device name : STM32H72x/STM32H73x Flash size : 1 MBytes Device type : MCU Device CPU : Cortex-M7 Mass erase ... Mass erase successfully achieved Memory Programming ... Opening and parsing file: sbsfu_H735.elf File : sbsfu_H735.elf Size : 54008 Bytes Address : 0x08000000 Erasing memory corresponding to segment 0: Erasing internal memory sector 0 Download in Progres
Hi,Im looking for encryp using internal AES peripheral that the STM32G0 has.I need touse "AES128-CMAC" but i dont found the option in HAL libraries to set "hcryp.Init.Algorithm=XXX" and "defgroup CRYP_Algorithm_Mode CRYP Algorithm Mode" library options. Is it possible?If its not possible, anybody knows a library that i could use to encryp using AES128-CMAC and STM32CubeIDE?Thanks,Best REgards,
Hello, Is it possible to custom the header of a firmware for SBSFU ? I want to add 2 variables but it's not working. I have authentification failure. But I don't change the size and position in the structure because I used the "reserved" bytes. (the size was 28 ,now 24 of "reserved" field)The error is : "Fw header authentication error"I have modified : 2_Images_SECoreBin\Inc\se_def_metadata.h :typedef struct{ uint8_t SFUMagic[4U]; /*!< SFU Magic 'SFU1' / 'SFU2' / 'SFU3'*/ uint16_t ProtocolVersion; /*!< SFU Protocol version*/ uint16_t FwVersion; /*!< Firmware version*/ uint32_t FwSize; /*!< Firmware size (bytes)*/ uint32_t PartialFwOffset; /*!< Offset (bytes) of partial firmware vs full firmware */ uint32_t Partia
I'm trying to compute the ECDH shared secret by multiplying local private key and other party public key using HAL_PKA_ECCMul. For some reason it is not working. I'm using curve secp256r1. But I'm able to use HAL_PKA_ECCMul to generate public key by multiplying a private key with the secp256r1 generator x and y.
Hello supportTeam,Have a nice day.I am working on B-U585I-IOT02A development kit and i tried merge our application with SBSFU_Boot and SBSFU_LoaderI've included the steps I take to integrate my own application below.1. Create Project Name: Application[Enable TrustZone]2. Change .ld file of secure and non secure project[output.ld - added prebuild file in secure and non secure project properties]3. Change linker path in secure and non secure project properties4. Added Postbuild.sh in own application repo5. Update NS address in secure-> main.c "#define VTOR_TABLE_NS_START_ADDR NS_CODE_START"6. Added postbuild.sh path in secure and non secure project properties7. Successful compile code8. Generate sign with encrypted .bin file in Binary folder9. Go to local bootloader with reset10. Upload encrypted sign .bin through SBSFU_Loader11. Reset trigger12.We are getting log in SBSFU_BootLOG:[INF] signature OK[INF] Bootloader chainload address offset: 0x1a000[INF] Jumping to the first image
Hi,I am trying to modify the SBSFU example provided with STM32CubeU5 to run my own application. I generated the code with STM32CubeMX for IAR by enabling TrustZone and leaving the default values set by STM32CubeMX. I wrote my code, deleted all the files in the SBSFU_Appli folder, copied the files generated by STM32CubeMX inside SBSFU_Appli and configured the IAR project to use the prebuild_s.cmd, prebuild_ns.cmd and postbuild.bat scripts. I have replaced the stm32u585xx_flash_ns.icf and stm32u585xx_flash_s.icf files generated by STM32CubeMX with the stm32u585xx_flash_ns.icf stm32u585xx_flash_s.icf files provided with SBSFU from STM32CubeU5. In the main.c file of the secure project I included the region_defs.h file and defined #define VTOR_TABLE_NS_START_ADDR NS_CODE_START. I can compile the code and generate the binaries, and the SBSFU_UPDATE.bat script for loading the binaries finishes correctly. When I start the microcontroller, SBSFU is executed but it stops right after printing in
Hi, I’m working on a STM32L552ZEQ.My goal is to generate a pair of RSA keys of 2048 bits using the Trust Zone.Before start using the Trust Zone, I wrote the code to generate the RSA key pair (of 2048 bits) without the Trust Zone, and the average time for the generation is about 50 seconds (clock frequency set to 110MHZ).After that I tried to do the same thing but this time using the Trust Zone. The configurations are the same, but with the Trust Zone enabled it takes more than 20 minutes to generate the RSA key pair.In order to check this behaviour I wrote a simple "for loop" (with inside a malloc) and compared the execution time between the "secure" code and the "non secure" code.The result is that the "for loop" executed inside the "secure" code is about 25 times slower than the "for loop" executed inside the "non secure" code.Is that possibile?Maybe I'm wrong but I have not found this reduction of performances explained inside the documentation of the MCU.Thanks in advance.
I'm using cmox_ecdh for generating shared key for STM32G431KBT6. I tried using single call API from AES_CBC_EncryptDecrypt example and provided Computed_Secret instead of Key in cmox_cipher_encrypt function but I get bad parameters error. I dWith the current implementation Computed_Secret size is 128 bit.
Is it possible to compute the ECDH shared secret (pubkey * privkey) by using HAL_PKA_ECCMul, replacing the generator X and Y with the public key X and Y and specifying the private key as the scalar value?Thank you.
Hi ST Team,I am using STM32U575 MCU. I want to create signed binary. I want to upload signed firmware in MCU and also update only new signed firmware via Native bootloader and want to restrict unknown firmware updates.How can I create signed firmware for STM32U5 MCU?Does ST's native bootloader verify signature firmware before updating new firmware or I need to add custom bootloader to restrict unknown firmware updates by verifying signature?If ST's native bootloader verify signature then when should I need to do configuration for that?Can you please guide me.Thanks in advance,VIJAY.
Hello ST Community,There was a thread by Aurelien about this topic, but I did not understand the answer. So let me rephrase the question with my own words.I have a STM32U5 based device with high security settings (TZEN=1, RDP=2). Is there any other means to regress to TZEN=0, RDP=0 than OEM2KEY provisioning and JTAG/SWD communication? By software?Regards.
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.