Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
Hi folks,I am trying to use the hardware-AES of the STM32WLE5JC, but I get weird results that do not match the expected values. I am comparing my STM-implementation against RadioLib's Crypto which is based on tiny-AES-c and AES-CMAC. RadioLib's implementation yields results that completely match verification tools such as this one.I am investigating two things: 1) single-buffer ECB encryption, and 2) CMAC calculation based on ECB encryption. My observations are as follows:encrypting a single ECB buffer yields incorrect results,calculating CMAC (which uses ECB encryption as subroutine) is OK / as expected,calculating CMAC and then a single ECB buffer yields expected results** I only get OK results for buffers <=128 bits.Example: uint8_t key[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; RadioLibAES128Instance.init(key); uint8_t data[24] = { 0 }; uint8_t out[24] = { 0 }; // RadioLibAES128Instance.generateCMAC(data, 24, out); RadioLibAES128Instance.encr
Hello, I have created an encrypted file by openssl-aes256-CFB. in openssl IV length should be 128 bit but in X-CUBE-CRYPTOLIB it is not possible, it cannot set to 128 bit, (HARDFAULT). only i can set 256bit and then received error 0x10003
hi i am trying to work with ST given example code of SBSFU for the U585 controller. Here my requirement is to add the active tampers to the system. in this given code i think tamper is only configured in the bootloader application only.tamper detection only occurred when bootloader code is running . no detection on secure or non secure code , i only can see the tamper irq handler in boot code , no implementation in secure or non secure code. i tried to remove the RTC and tamper configuration inside the bootloader code and tried to configure both in secure code that time its not working (initialization of RTC failing ,need to know weather some dependency is there or not with boot).then i tried to configure the RTC in boot itself and tamper initialization in secure part there whenever tamper occurred in the application(while running secure or non secure code) code is getting hanged otherwise works perfectly. whenever tamper occurred the tamper ISR not calling properly(trie
Hi,Currently I can able to RDP protection ie., Product state using STM32CubeProgrammer and it is working.But our requirement is we want to use Any HAL_driver /C-code instead of STM32Cube. Any suggestion.
Hi @Jocelyn RICARD, My team developed Android app with following code to encrypt the message then send it to STM32WB55 device via BLE : ... SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey, "AES"); IvParameterSpec parameterSpec = new IvParameterSpec(iv); Cipher cipher = Cipher.getInstance("AES/CCM/NoPadding"); cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, parameterSpec); return cipher.doFinal(message); This code has no tag/addData inputs. First attempt:I develop the following code to decrypt the encrypted message on STM32WB55 device with AddData/Tag variables filled 0 because I dont use them: const uint8_t AddData[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; const uint8_t Expected_Tag[] =
Hi,I want to use SBSFU with my simple application. I watched https://youtube.com/playlist?list=PLnMKNibPkDnGd7J7fV7tr-4xIBwkNfD--&si=T2hYVP2BWDyQkhAWI successfully implement the SBSFU example project on my board. Here, I've a problem to use SBSFU with my application. Can anyone please help me? Regards,Meena.
Hi all,I'm new to using the STM secure boot/secure firmware update and I'm trying to understand how the verification works when sending a new firmware image to the board. I got SBSFU running on an STM32H750B-DK dev board and successfully loaded the example UserApp program from the SBSFU extension package. I then tried to corrupt the firmware image file by flipping a single bit in a copy of the firmware file created with python script utilizing the shutil.copyfile() method, which from its documentation does not copy file metadata. From what I understand, when I try to load the corrupted image onto the board using Tera Term and selecting the "Download a new Fw image" option, after verifying the keys the SBSFU should verify the integrity of the new firmware image by checking both the header and the rest of the file compared to the current image. Is my understanding correct? Or does the SBSFU only verify the image signature?This brings me to my issue. In some cases, the new corrupted
HI,we are interested in a guide to a clear workflow of integrating CubeMX-generated code for U5 into TFM-based application.In particular:1. We have trustzone-enabled CubeMX-generated app with Azure RTOS and TouchGFX. The IDE and compiler are IAR. We want to be able to easily debug and re-build it, as needed, without any much security involved and, even most important, without manipulations with flash loaders and signed binaries every time a single line of code gets changed. 2. Once we are happy with stable code behaviour, then we want to "wrap" it in TFM, by letting the latter to create signed binaries and the loader, as per TFM example for U5 from STM. If any intermittent step((s) required to achieve so: adjusting addressees, locations, etc - we are OK to create custom pre/post builds ourselves. But we'd like to know what exactly steps are needed. So the questions are:a). Is there any help/guide/examples or any other support can be expected from STM for that matter?(Ye
Hello everyone,I am currently debugging a Cortex-M33 MCU with TrustZone-M. During my debugging session, I have observed some unexpected behavior when reading the VTOR (Vector Table Offset Register) in both secure and non-secure states using GDB.BackgroundThe core is executing in the secure state.I have accessed the VTOR (0x0E00_0ED08) and its non-secure alias (0x0E002_ED08) registers through GDB.Initial ValuesThe VTOR_S (secure state) register initially held the value 0x0C00_0000.The VTOR_NS (non-secure state) register initially held the value 0x0800_0000.Expected OutcomeThe value read from the VTOR register (0x0E00_0ED08) should be 0x0C00_0000.The value read from the VTOR non-secure alias (0x0E002_ED08) should be 0x0800_0000.Observed ResultsThe value read from 0x0E00_0ED08 was 0x0800_0000.The value read from 0x0E002_ED08 was 0x0.IssueIt appears that GDB is operating in the non-secure state, as the values read do not match the expected secure state values. This discrepancy has led me t
Hi, I am currently working on migrating a project from STM32 Crypto Library version 3.1.5 to version 4.2.1. I would greatly appreciate your assistance with the following queries:Compatibility Inquiry: Is version 4.2.1 compatible with version 3.1.5? Specifically, Device ‘A’ is operating on version 3.1.5, while Device ‘B’ is on version 4.2.0. Are there any known compatibility issues between these versions?Function Replacement Issue: After importing the v4.2.0 library, I encountered an error with the HKDF_SHA512() function call. I replaced this function as follows:In v3.1.5: HKDF_SHA512(&StHkdfInput, Aru8HkdfOut, sizeof(Aru8HkdfOut)); In v4.2.0: if (cmox_initialize(NULL) != CMOX_INIT_SUCCESS) { #ifdef APP_DEBUG printf("cmox_initialize failed\n"); #endif } if(HASH_SUCCESS == HMAC_SHA512_Init(&SHA512ctx_st)) { if(HASH_SUCCESS == HMAC_SHA512_Append(&SHA512ctx_st, Aru8HkdfInput, sizeof(Aru8HkdfInput))) { if(HASH_SUC
Hi, I am working on integrating the TPM ST33TPHF2XI2C into our platforms and we noticed that there are two GPIOs in the TPM chip. The datasheet says the following: The GPIO function could be modified by activating GPIOs mapped on the NV storage index feature. Is there any information/documentation where it is indicated which NV storage index is the one required for this function? or any additional information about how to access and or use the GPIOs? Regards,Adan Flores
We are developing a Matter device using X-CUBE-MATTER.How can I make the sample firmware using SBSFU into a sleepy end device? Just setting CFG_FULL_LOW_POWER to 1 fails the commissioning. How can I enable Sleep Mode like the generic-switch app?The development environment is as follows.Hardware: STM32WB5MMG-DKFirmware: Window-App-SBSFUX-CUBE-MATTER Version: 1.1Implementation CFG_FULL_LOW_POWER is set to 1
I spend a lot of time looking and never could find an easy way to do this. I came up with a solution and thought I would post it.I am using the STM32F407. The F4 series only has one way of calculating the CRC in hardware and that is what I chose to use in the Binary file. This way, the F4 can easily verify a file when it is uploaded to it for a firmware update.I have attached a Zip file with an EXE in it called CRC32. It requires one parameter - the name of the file to add a CRC32 to. It assumes the file size will be a multiple of 4 bytes. It then reads the file and calculates the CRC. When it reaches the EOF it inverts the CRC and appends it to the end of the file. This way when the whole file with added CRC32 is CRC'd again on upload, the result should be 0xFFFFFFFF. If CRC32 is run on the same file multiple times, it will continue to add CRC32's to it - probably not what you want, but if you make this automatically run each time you build, that should never happen.You can make this
How do you know how big the preallocated static buffer should be when calling cmox_rsa_construct?Does this depend on the RSA key size that will be used?Does this depend on the Modular Exponentiation function that is selected (LOWMEM, MIDMEM, HIGHMEM)?Thanks!
Hi,Im trying to encryp using AES 128 CTR but i dont get the same result that online calculators.Im using this online calculator: https://cryptii.com/pipes/aes-encryptionMy code is the next:uint8_t IVKey[] = {0xDD, 0xF9, 0x11, 0xA6, 0xDD, 0xF9, 0x11, 0xA6, 0xDD, 0xF9, 0x11, 0xA6, 0xDD, 0xF9, 0x11, 0xA6}; AesDeInit(); // CTR AES hcryp.Instance = AES; hcryp.Init.DataType = CRYP_DATATYPE_1B; hcryp.Init.KeySize = CRYP_KEYSIZE_128B; hcryp.Init.pKey = (uint32_t *)AESKey; hcryp.Init.Algorithm = CRYP_AES_CTR; hcryp.Init.pInitVect = (uint32_t *)IVKey; if (HAL_CRYP_Init(&hcryp) != HAL_OK) { Error_Handler(); }and the AESKey is the next:const uint8_t AESKey[] = {0x44, 0x26, 0x44, 0x20, 0x45, 0x6C, 0x65, 0x74, 0x74, 0x72, 0x6F, 0x6E, 0x69, 0x63, 0x61, 0x20 };My AES function is the next:int16_t AesEncrypt(char *In,int16_t Len) { uint8_t Buf[16]; if (Len & 0x0F) Len+=16-(Len & 0x0F); if (HAL_CRYP_DeInit(&hcryp)!=HAL_OK) Len=0; else if (HAL_CRYP_Init(&
I'm having issues with a project based on an STM32WB5MM where some devices fail to operate BLE (like advertising, for example). The project integrates SBSFU and BLE_ota. I'm reviewing the linker files and I see differences in the management of the BLE buffer between a standalone application and an application with OTA and SBSFU. In the standalone application generated by STM32CubeIDE, I have this in the linker file: .ARM.attributes 0 : { *(.ARM.attributes) } MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED /* used by the startup to initialize .MB_MEM2 data */ _siMB_MEM2 = LOADADDR(.MB_MEM2); .MB_MEM2 : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED AT> FLASH and in the application with integrated SBSFU and OTA, I have: .ARM.attributes 0 : { *(.ARM.attributes) } MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED MB_MEM1 (NOLOAD) : { *(MB_MEM
Hi,In our application, we want to authenticate our IoT devices in Azure IoT Hub using X509 certificates with the help of STSAFE-A110. The application is written in Zephyr RTOS and is using the MbedTLS library for the TLS part. Using the in-tree Zephyr libraries for secure sockets, it is necessary to load the device private key and certificate, in the simplest way from an MCU Flash memory. They are eventually used when calling the functions mbedtls_pk_parse_key() and mbedtls_x509_crt_parse(). My goal is to integrate STSAFE-A110 in this process, so that the device private key and certificate are stored in STSAFE-A110 instead of the MCU Flash. I'd like to get some feedback on whether the process sounds reasonable.I suppose the process would look something like this:While in production, we should provision STSAFE-A110 with the device's individual certificate. It needs to be like this, because authentication in Azure requires that the subject common name is the same as the unique
Hi Team,I am working on project in which we are implementing Secure software upgrade feature using SBSFU. locally I am building SBSFU package, but our project follows different process. To meet that I need to build SBSFU package in TeamCity.could anybody help me to setup job which build SBSFU in TeamCity.?
Hi, i am using stm32l496 and bluenrg module. i want to implement AES-CCM encryption but I don't have any idea about the implementation and also I don't have library for aes-ccm. please help me.
Hi,How to authenticate a device connected to STM 32 using USB Peripheral the STM 32 is integrated with STSAFE IC , How to use peripheral Authentication Example for this in the software package
I am integrating SBSFU with the STM32L496ZG microcontroller and have created a new project. I attempted to generate the SFB file using a customized post-build script from the L476 Simple App example. Although I modified the script paths for my project, the SFB file is not being generated.The command prompt shows:Encrypt debug\SBSFU. bin into .\\Binary\\\SBSFU. SFU using AES key from Secure Engine binaryAn error message is generated:Exception: AES CBC encryption requires the Firmware Image size to be a multiple of the AES block size (16 bytes)Could you please provide guidance on how to resolve this issue?
I'd like to open a small discussion about what would be the best usage of STSAFE-A110 to enhance the hardware-level security of our IoT device. To be more specific, in our application we want to use the STSAFE-A110 to store the customized device private key and certificate (not the standard leaf certificate in zone 0), that will be used for TLS authentication at the server.I'm trying to think how this will help in case that a malicious adversary gets hold of our hardware. I suppose nothing is completely secure and it all depends on how good one needs to be protected and/or how many obstacles one wants to make it for the attacker.Let's however, do a thought experiment. What can the attacker do with our hardware?I suppose that since the device private key and certificate are not in the MCU flash but in the A110, the attackercannot get hold of the private key, but can use it for signing (right?)can read out the device certificateWhat can one do with the above? Could one clone our device a
Hello,I am working STM32u575 Nucleo board. I want to use secure flash to store secure data and to use it I need to enable TrusZone. Is there a way we can program option bytes with TZEN =1 without using STM32programmer?Regards,Shafi
Dear Sir/Madam We are using STM32U585AII6Q MCU part in one of our projects. We encountered a problem with Flash read protection and no longer able to flash the MCU. Below is the reference screenshot from the error. We also tried few methods defined in the below document (page 56).We use Segger j-link tool (JTAG interface). https://www.st.com/resource/en/user_manual/um2237-stm32cubeprogrammer-software-description-stmicroelectronics.pdf Unfortunately, we are not successful, and unable to even read the Device authentication ID as well . Device authentication ID shows 0x - -. Could you please let us know how we can set Read protection level 0. Thank you in advance Regards Apoorva
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.