Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
Hi ,I have to use IAR IDE to develop SBSFU function , But I found that after "2_Images_SECoreBin" compiler success, I try to compiler "2_Images_SBSFU" as below picture. It's seem show post build fail.Dose anyone find this issue and some suggest? (but there are no fail if use STM32CubeIDE 1.8.0)My path : C:\SBSFU\Projects\NUCLEO-G071RB\Applications\2_Images2_Images_SECoreBin success 2_Images_SBSFU fail
Normally the bootloader is the first thing to program in the MCU by the manufacturer,. Bootloader contains a way how to update the firmware of the device from the firmware file (encrypted), which is openly passed to the customer. Hence the bootloader is concidered to the the most secret thing to take care of.But what to do if there is no way to go physically to the place where the newly manufacured devices are located and physically program the bootloader? Is there any way to remotely program the bootloader in a secured way, so that the people having the devices could not steal or sniff it? Are there any ready solutions to this problem?The MCU related is STM32F427.
I tried to do an experiment with PC-ROP protection in Cubeprogrammer, but an exception occurred when I disabled protection.My Memory Data seems to be protected all the time, the value is always 0, and there is no way to Erase the entire Chip normally.I took a normal board to compare and found that Option Bytes are different.In normal boardaddress(0x52002010) SR1 Data: 0x00000000address(0x5200211C&0x5200201C) OPTSR_CUR&OPTSR_PRG Data: 0x0306AAD0address(0x52002030&0x52002034) SCAR_CUR1&SCAR_PRG Data: 0x000000FFOn unusual boardsaddress(0x52002010) SR1 Data 0x01000000address(0x5200211C&0x5200201C) OPTSR_CUR&OPTSR_PRG Data:0x0006AAD0address(0x52002030&0x52002034) SCAR_CUR1&SCAR_PRG Data:0x80000000I would like to know if there is a way to adjust to normal, or how to restore to default factory setting?
Hi everyone,currently, I'm struggling to make interrupt working with SBSFU (STM32WB55).If I run the program without SBSFU, interrupt event working properly.but when I compiled it along with SBSFU, the interrupt not working.I see on another post that is possibility its caused by interrupt vector.I used this configuration on system_wbxx.c#if defined(__ICCARM__)extern uint32_t __vector_table;#define INTVECT_START ((uint32_t)& __vector_table)#elif defined(__CC_ARM) || defined(__ARMCC_VERSION)extern void * __Vectors;#define INTVECT_START ((uint32_t) & __Vectors)#elif defined(__GNUC__)extern void * g_pfnVectors;#define INTVECT_START ((uint32_t)& g_pfnVectors)#endifactually, the program is running but interrupt still not working.I also tried with this code:#if defined(__ICCARM__)||defined(__GNUC__)extern uint32_t __ICFEDIT_intvec_start__;#define INTVECT_START ((uint32_t)& __ICFEDIT_intvec_start__)#elif defined(__CC_ARM)extern uint32_t Image$$vector_start$$Base;#define INTVECT_
..
Hello everyone! I encrypt the data with the AES-256 ECB algorithm using the X-Cube-Cryptolib library, while the library itself can decrypt the data correctly, and third-party libraries decrypt it incorrectly. I use 32 random bytes as the key.I tried using Aes, AesManaged, Aes Crypto Provider, Rijndael, and RijndaelManaged in C# with the following parameters in the constructorKeySize = 256;Block Size = 128;Mode = CipherMode.ECB;Padding = PaddingMode.Zeros;Key = key;And on these sites by copying the bytes of the key and data from the debag:https://www.devglan.com/online-tools/aes-encryption-decryptionhttp://aes.online-domain-tools.com/https://www.javainuse.com/aesgeneratorhttps://encode-decode.com/aes256-encrypt-online/https://gchq.github.io/CyberChef/#recipe=AES_Encrypt(%7B'option':'UTF8','string':'hello'%7D,%7B'option':'Hex','string':''%7D,'','','',%7B'option':'Hex','string':'undefined'%7D)&input=VGVzdAPlease tell me, maybe there is some error in the library. Thanks!Best regards!
Hi All,Currently I used SBFU solution to develop project , I had checked the AN2262 that descript SBSFU support below picture.1.My question is how to enhance below encryption strength or any application I could reference, does it need modify SE engine(as I know user could not modify this Images_SECoreBin project)?Confidentiality - change to AES 256bit (original is 128bit)Authentication - change to SHA2-384Cryptographic - change to AES 256bit (original is 128bit)2.Could user revoking previously signed firmware in this SBSFU solution? Sam
Hi!Can someone explain to me why this code:// Is FLASH_CR register locked for writing? if (FLASH->CR & FLASH_CR_LOCK) { // Unlocking FLASH_CR register FLASH->KEYR = KEY1; FLASH->KEYR = KEY2; } // Unlocking FLASH option register if (FLASH->CR & FLASH_CR_OPTLOCK) { FLASH->OPTKEYR = OPTKEY1; FLASH->OPTKEYR = OPTKEY2; } // Setting RDP level to 1 FLASH->OPTR &= ~FLASH_OPTR_RDP; FLASH->OPTR |= 0xBB; // Any value except 0xAA and 0xCC while (FLASH->SR & FLASH_SR_BSY1); FLASH->CR |= FLASH_CR_OPTSTRT; while (FLASH->SR & FLASH_SR_BSY1); // Updating option bytes by resetting of the device FLASH->CR |= FLASH_CR_OBL_LAUNCH;kills STM32G070KB device, when was written with J-Flash, but works great with STM32G071CB with the same Errata note for RDP protection.Same code works great for both MCUs when were written with Segger Embedded Studio.PS: I'm also posting this question on Segger's forum.Thank you
I wont to test the L432KC example on a NUCLEO-L432KC board"\SBSFU\STM32CubeExpansion_SBSFU_V2.6.0\Projects\NUCLEO-L432KC\Applications\1_Image"I have created correctly a new workspace and imported the necessary projects. All compiles fine and I get "SBSFU_UserApp.bin" and "UserApp.sfb"With CubeProgrammer I have written SBSFU_UserApp.bin that is a all in one firmware, but using TeraTerm I can see that the board continue to stay in boot-loader modeI have tried to send UserApp.sfb, but at the end of process no error messages, the board makes a software reset, but stay always in boot mode.= [SBOOT] System Security Check successfully passed. Starting... ====================================================================== = (C) COPYRIGHT 2017 STMicroelectronics = = = = Secure Boot and Secure Firmware Update = ====================================================================== = [SBOOT] SECURE ENGINE INITIALIZATION SUCCESSFUL = [SBOOT] STATE: CHECK STATUS ON RE
Hi,I am trying to run the CRC calculation with the STM32G031 but the results do not match. The result of the CRC16_CCITT_FALSE should be 0x29B1 according to http://www.sunshine2k.de/coding/javascript/crc/crc_js.html but I get 0x277F.You can find my implementation below.unsigned short CRC_16Bit_Polynom(unsigned char *Data, unsigned char Size); void CRC_Init(void); int main(void) { unsigned char Buffer[] = {'1', '2', '3', '4', '5', '6', '7', '8', '9'}; CRC_16Bit_Polynom(Buffer, 9); } void CRC_Init(void) { RCC->AHBENR |= RCC_AHBENR_CRCEN; CRC->CR = 0x00000000; CRC->CR |= CRC_CR_POLYSIZE_0; CRC->INIT = 0xFFFF; CRC->POL = 0x1021; } unsigned short CRC_16Bit_Polynom(unsigned char *Data, unsigned char Size) { unsigned short Ergebnis = 0; CRC->CR |= CRC_CR_RESET; for(unsigned char i = 1; i <= Size; i++) { CRC->DR = (unsigned short) *Data; Data++; } Ergebnis = (unsigned short)CRC->DR; return Ergebnis; }Please kindly help to find the
I'm attempting to use the serial bootloader to load a secure firmware image to an STM32L5 using STM32CubeProgrammer. I can successfully connect to the board in bootloader mode and perform a full-chip erase, but attempting to download the image (either a .hex or a .out) results in an error:10:20:33 : Memory Programming ... 10:20:33 : Opening and parsing file: project.out 10:20:33 : File : project.out 10:20:33 : Size : 256 KBytes 10:20:33 : Address : 0x0C000000 10:20:33 : Erasing memory corresponding to segment 0: 10:20:33 : Not flash Memory : No erase done 10:20:33 : Download in Progress: 10:20:34 : Response received from device: NACK 10:20:34 : Error: Write address not acknowledged: 0xC000000 10:20:34 : Error: failed to download Segment[0] 10:20:34 : Error: failed to download the FileTrustZone is enabled (FLASH_OPTR->TZEN=1) on this device. Reading 0x0BF97FFE returns a bootloader ID of 0x92.Is there a way to apply a secure image via the serial bootloader?Thanks!Update: I
So I have a STM32H753 with active "secure area" - but the code in the secure area is buggy and hangs before jumping outside.Is there a way to erase the MCU and recover, or it is bricked?No RDP is set.
I am experimenting with CRC Calculation on a STM32F4-Discovery.As I have seen in the reference manual this MCU is using CRC-32 used in Ethernet. I am also using https://crccalc.com/ (CRC-32/MPEG-2) to validate the results.I just activate the CRC in CubeMX and this is my source code for 32-bit values:uint32_t raw_data_32_bit[BUFFER_SIZE] = { 0x00, 0x01, 0x10, 0x1A, 0xAC, 0xC0 }; uint32_t crc_value_32_bit = 0; uint8_t is_error_32_bit = 1; crc_value_32_bit = HAL_CRC_Calculate(&hcrc, raw_data_32_bit, BUFFER_SIZE); if (crc_value_32_bit == expected_crc_value_32_bit) { is_error_32_bit = 0; }which is working like a charm.Then I would like to do the same for 8-bit values with this code:uint32_t expected_crc_value_8_bit = 0xA4541FC6; uint8_t raw_data_8_bit[BUFFER_SIZE] = { 0x00, 0x01, 0x10, 0x1A, 0xAC, 0xC0 }; uint32_t crc_value_8_bit = 0; uint8_t is_error_8_bit = 1; crc_value_8_bit = HAL_CRC_Calculate(&hcrc, (uint32_t *) raw_data_8_bit, BUFFER_SIZE); // returns 0xe7206
The details of this project are like this. I have a working product on the F417 that I wish to add Remote update capabilities to.Product is already deployed with SBSFU and updates using Ymodem through the UART work fine.What I am trying to add on now is the Remote firmware update, which is based on the STM32CubeExpansion_Cloud_AZURE_V1.2.1, to be able to download the F/W from a webserver for an update.What is puzzling me now is this:When I test out the downloading in my debug build (without SBSFU) the .sfb file can be downloaded and saved to flash. I can peek into the flash with the debugger and see that the file has been saved.However, when I build a release version (which is together with the SBSFU) and trigger the update process, when attempting to write to the flash, the program gets stuck and hangs at the HAL_FLASH_Program call and will eventually result in a watchdog reset.I am baffled as to why I can write in debug mode but not in release mode. Why is there a difference in how t
Is there a an option to implement SE_<FOO> in se_crypto_bootloader.c. I tried implementing a SE_FOO but the system reset as mentioned in document ."Protected code and data are accessible through a single entry point (call gate mechanism) and it is therefore not possible to run or access any SE code or data without passing through it, otherwise a system reset is generated."I want to have flexibility for Boot loader to decrypt/encrypt blob of data and also verify signature of blob of data. Which is separate from app image .sfb
Hi,I have a bit trouble understanding the two keys in the SBSFU and which pairs is actually used. From AN5056, chapter 5 there is stated how to generate the two different methods and the AES key I could successfully adjust. With the ECCKEY method and when I adjust the key (I used the following generator: https://8gwifi.org/sshfunctions.jsp) I am not able to run the prebuild.sh anymore successful. I get the following error when running the prebuild.sh with a different key than the original in the examples:So the key is somehow not the correct one. So my questions are:1.) Do I need to change both keys (the OEM keys in the .bin for AES and the ECCKEY1)?2.) Is there a generator for the ECCKEY1 key?
The examples in CubeU5 package always states to activate dual bank mode, when using TrustZone. Can't you use single bank mode and just allocate specific sectors to be secure?Is it possible to use TrustZone without dual bank? Some types don't have it.Best regards Lukas
Hello,I am using the SBSFU with the KMS on my STM32L486RG. I activated the verbose debug in the config file and this is the output that i am getting when flashing the binary file combining the boot-loader and my user application at the same time : As you can see the boot-loader fails to verify the the authenticity of the Firmware. How can I debug this problem? If I debug the SBSFU.elf alone from the STM32CubeIDE, the secure boot tells me that there is no firmware in the active slot (obviously) so does not verify it...I am using ECCDSA for the firmware authenticity verification and using this same boot-loader configuration in a another project without any problem.Thanks in advance for the help,Benjamin
Setup:Device - STM32H7B3I-DKProject - STM32H7B3I-DK\Applications\2_Images_ExtFlashWe have Composite firmware update file which contains and stored in external flash which Boot loader will process APP firmware (UserApp.sfb )GUI resources Calibration dataOther blob (MCU stm32f4 APP image)This composite file header contains signature of payload(app fimware + gui + calibration data + other blob of data) which is placed in external flash.What are the API calls which i can make to verify the signature SE_CRYPTO_ReadKey_Pub will be able to get the key is this correct way?SE_CRYPTO_SHA256_HASH_DigestCompute - computes the hashECDSAverify() - to verify the Signature.What changes i have to keep in mind for this to work as this part of Secure engine ? Thanks!
Hi,I'm working on a project that needs AES256 encryption, I requested the X-CUBE-CRYPTOLIB software, but it's being validated by STM32, my question is, why does this validation exist? Is there any criteria for them to make the software available? What is the deadline for allowing the download?
I have an undefined reference error to several secure engine functions, for example SE_APP_GetActiveFwStateI have read this thread:https://community.st.com/s/question/0D53W000017PGUKSA4/how-to-call-secureengine-functions-from-my-applicationAnd what I think needs to be done to resolve this problem is to:-add the function names to se_interface.txt in the SBSFU folder-rebuild SBSFU-add the generated se_interface_app.o as additional object file in my project settings > MCU GCC Linker > Misc-Add other flags, in project settings > MCU GCC Linker > Misc to be the same as the userappAfter doing this however the problem still persists, and I'm having a hard time finding it. I made sure to copy all project settings from the SBSFU UserApp example, added all the includes and compared the linker scripts, now I have reached a dead end...The contents of my se_interface.txt file is:SE_APP_GetActiveFwInfoSE_APP_GetActiveFwStateSE_APP_ValidateFw
Device - STM32H7B3I-DKProject - STM32H7B3I-DK\Applications\2_Images_ExtFlashHere app images should be placed in Internal flash and GUI resources(> 15 MB) should be placed in external flash.
Dear all,For an IoT project I would like to run the demo of the AWS package provided by ST but for some reason I could not manage to debug the demo project.To do so I have downloaded the X-CUBE-AWS_v2.0.0 package and used the following ressources : ST starting guideAmazon first steps documentation AWSxSTM32 workshop Before trying to run in debug mode the project I did the following steps : created a thing on AWScreated a certificate/private key on AWSprovisionned the certificate and private key to aws_clientcredential_keys.h (I don't want to use the ST-SAFE here)provided connection information into aws_clientcredential.hThen prepared the SBSFU :Built the project B-L4S5I-IOT01_2_Images_SECoreBin. Built the project B-L4S5I-IOT01_2_Images_SBSFUThen prepare the demo project : I merge the demo project with the AWSxSTM32 workshop sensor example to get the sensor streaming of the proto board to AWS.I build the demo project. I had to apply the following fix provided by @Jocelyn RICARD Us
Currently I write locked the first few sectors of my STM32U575xx. However I would also like the unlock the write protection. Since both J-Link and the ST-Link cannot do this I thought about writing a small application and run it from RAM to reset the option bytes. This however does not work.When I try to write the option bytes the status register returns `Option write error`. Does anyone has an idea on what I'm doing wrong? I previously locked pages 0 to 8, I thought I leave it unchanged. Changing this to the factory default however doesn't work.The failure occurs on line 82./** * @brief The application entry point. * @retval int */ int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration--------------------------------------------------------*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the sy
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.