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 STM's cryptographic library on a STMf412ret6 to encrypt a 16 byte message using a 2048 bit public key generated by the Python-RSA 4.8 library, first result on google for "python rsa".I've verified the key being received by the MCU is identical to the one generated and I've verified the encrypted message is identical once it makes it back to the Raspberry Pi running the python script. Upon attempting to decrypt the message it throws the error for not being able to find proper pkcs#1 v1.5 padding. I've tried manually adding padding, so I know that the issue is not of the ST library not automatically doing padding. Stepping through the python RSA library I have found that the resulting clear text message doesn't contain the original message anywhere which leads me to believe it is an issue with ST's library. Here is my code for calling the library:static void dcu_encrypt_aes_key(uint8_t aes_key_to_crypt[16], uint8_t encrypted_aes_key[256], size_t* encrypted_key_size) { if (cmox
i am enable trust zone and I make one part as secure world and another part as a non secure world using (SECWM1, SECWM2) but forget to enable Dbank as (Dbank = 1) now I couldn't make any changes in option bytesmy question is1.how can I enable dual bank mode (Dbank = 1)?2.if I will launch my both binary what will happen?3.what are the steps to recover my device?
I set the start address about RAM is 0X20002000, and disable shared but execution.Than, I set a function which data is 0x20002004 to change the protected data.when system enter the function, it will reset.
I have configured the STM32CubeExpanision_Crypto_V4.0.1 folder using the STM32CubeIDE. Within the folder is a main.c file for a SHA256 digest located in ..STM32CubeExpansion_Crypto_V4.0.1\Projects\NUCLEO-L476RG\Applications\Hash\SHA2_Digest\Src. Within that file, there is a string of text for a message, and a string of text for the expected hash. However, I have typed in the text online in a sha-256 digest calculator and the generated hash value is not the same as the one in the main.c file. I have CRC enabled but I do not understand why the expected hash value in the main.c file is not correct.Below is the string of text for the message and expected hash value.Below is the string of text for the message and expected hash value in raw form Msg = 6b918fb1a5ad1f9c5e5dbdf10a93a9c8f6bca89f37e79c9fe12a57227941b173ac79d8d440cde8c64c4ebc84a4c803d198a296f3de060900cc427f58ca6ec373084f95dd6c7c427ecfbf781f68be572a88dbcbb188581ab200bfb99a3a816407e7dd6dd21003554d4f7a99c93ebfce5c302ff0e11f26f83
Hi,My project is based on STM32L15xx microcontroller. I know, that internal FLASH Read Protection may be enabled during programming an image by STMFlashLoader with --erp option. My question is: can I compile my image with internal FLASH read protection enabled by some tweak so that I don't have to use "--erp" option on downloading my image to the target?Thanks in advance!
Hello,I wanted to try the SBSFU topic 6 step by step youtube video, i accidentally flash the Userapp.bin with the RDP level 1, (and also with Write protection enable in bank1).I try to change the RDP level back to 0, and also disable the Write protection on bank1, however the mass erase option had not been successful, can you advise if such revert is possible? it means that those protected area was not able to be erase.(0x8000000), or the board had become unusable?
looks like the same issue like in: STM32F423 Generating AuthTag for AES crypto is not working
Dear all,I have a question regarding the read-out-protection on STM32 L1 series (STM32L151CB-A) and I was wondering, if the same problem occurred to anyone of you before.I am booting from internal flash memory (BOOT0 = GND) and set the option bytes RDP to BB (Read out protection level 0) using the Cube Programmer.However, after doing so, the controller is not booting anymore. Even after a hardware reset pulling the NRST line low.My program is also writing to the FLASH and EEPROM - could this be an issue?(HAL EEPROM / FLASH unlock).What could be the origin of the problem?Thank you and all the best!
Hello,I've two STM32 development kit and would like to implement and test the secure boot loader, however it's not working. There is NO serial print after programming boot loader G0_BL.bin load or Application G0_App4BL.bin. I read the location of 0x08000000 and 0x08008200, i see there exists code.The code i've referred is from the below videoVideo reference: Security Part4 - STM32 security in practice - 10 Simple boot loader labThe development kits i'm using are Nucleo-wb55rgSTM32U585 discovery kit Can you please help me here what i'm missing. Thanks & RegardsRajesh
I am using the STM32F746VET6 which was setup with STM32CubeMX project. In the code it creates I see there's a STM32F746VETX_RAM.ld linker file and a #define VECT_TAB_SRAM to locate the IVT in RAM, but I don't see in MX where I specify that I want the autogenerated code to behave that way. Am I just missing something?The reason I want the IVT in RAM is that I want to reconfigure which ISR is used for a timer depending upon a setting set through the SPI port. Doing this by overwriting an IVT in Flash would be a problem for my bootloader which has a CRC over the entire Flash range.
I am trying to implement the sha1 function using the cryptographic library offered from STMicroelectronics. I believe I have properly imported the library as per the directions in Security:Getting started with the Cryptographic Library - stm32mcu. From here, how do i implement a simple SHA-1 function?
Is there a manual for the STM cryptographic library V4? I know the legacy V3 cryptographic library has a manual (https://www.st.com/resource/en/user_manual/dm00215061-stm32-crypto-library-stmicroelectronics.pdf), but I cannot find an updated manual for V4. I would like to study an updated manual so I can learn how to use the library properly.
..
I aim to load my application at 0x08002000 instead of 0x08000000(base address) and secure the first two sections which will be used to store CRC and other firmware update information.I use a post-build script to calculate the CRC using srecord utility on application firmware and embed it into the executable at the base address.I also change the vector table offset to #define VECT_TAB_OFFSET 0x00002000U.but don't know why it was not working, following is my observation:1)When I just build & load the application firmware at the address of 0x08002000 without embedding CRC it was working.2)But when I embed CRC into the executable it was not working, I also verify flash contained and that it was loaded properly. (After loading cube-programmer gives a warning: The core is locked up)Am I missing any steps? Please help me here to resolve my issue.
I've found an inconsistency between different reference manuals of STM32 embedding the CRYP peripheral, about the management of IVs in GCM mode:The HAL seems to implement the second solution.Could you confirm ?Best regards
Hi All,Did Someone use AES encryption/Decryption in STM32F407?, because I'm using existing example of AES encryption and its not working on my board, EN bit isn't enableing.
Hello to all,I am using a STM32H743 and create a SPI master (SPI4) and a SPI slave (SPI2). I have connected the pins used (including NSS). For receiving and transmitting I use DMA in both parts, master and slave. The configuration was done with STM32CubeIDE (1.11.2) and I use the ST HAL drivers.Additionally the master and slave instance run in their own freeRTOS threads.When I use the SPI without CRC, everything works fine.When I enable the CRC, I always get CRC errors. For testing I send only one byte in each direction. When I look into the SPI registers, the RXCRC and TXCRC registers for SPI2 and SPI4 hold different values. It looks like the CRC of SPI2 is truncating the calculated CRC value.Here is my configuration Here are the values on the bus, the first byte is the payload for testing (master sends 0x02, slave 0x03):When I get the error callback, I get these values back:My expected crc values are 0x2042 for payload 0x02 and 0x3063 for payload 0x03.SPI4 calculates the correct valu
Hello,is there any example of a TFM application that is supported by STM32CubeIDE?I came across the iot-reference-stm32u5, but the structure of the project is way different from any other TrustZone and TFM examples available as part of the STM32CubeU5 Firmware Package and find this a bit confusing.Would really appreciate if someone could shed some light.Many thanks
Hi,I want to compute APP's hash (SHA256) from my Bootloader using DMA.I have 3 non adjacent zone to process the HASH.If I use one node and call HAL_HASHEx_SHA256_Start_DMA inside HAL_HASH_InCpltCallback, I can compute my HASH.I hope I can use link list in order to let DMA process all zone and use CPU to process only the last one (to clear MDMAT bit). However, this fail. I never goes in GPDMA IRQ.What I want is to configure DMA in link-list mode to send all block except last one to HASH without interrupt CPU. The last block will be send when GPDMA run last LLI IRQ (DMA_TCEM_LAST_LL_ITEM_TRANSFER) .How can I do that?Thanks for your help.Have a good day.Aurélien
Dear Team,I want use inbuild AES encryption engine to encrypt the data, therefore I used CubeMX to initialize the AES engine, when i'm going to encrypt the payload, it stuck in static HAL_StatusTypeDef CRYP_WaitOnOFNEFlag(CRYP_HandleTypeDef *hcryp, uint32_t Timeout) and return HAL_Error. Kindly let me know what wrong am I doing to initialize the AES engine. MCU = STM32F417VET/********************* Code ****************************/static void MX_CRYP_Init(void){ hcryp.Instance = CRYP; hcryp.Init.DataType = CRYP_DATATYPE_8B; hcryp.Init.pKey = (uint32_t *)pKeyCRYP; hcryp.Init.pInitVect = (uint32_t *)pInitVectCRYP; hcryp.Init.Algorithm = CRYP_DES_CBC; hcryp.Init.DataWidthUnit = CRYP_DATAWIDTHUNIT_BYTE; if (HAL_CRYP_Init(&hcryp) != HAL_OK) { Error_Handler(); }}HAL_CRYP_Encrypt(&hcryp, input, sizeof(input), output, 1000);
the link : https://wiki.st.com/stm32mcu/index.php?title=Security:How_to_implement_HKDF_with_the_Cryptographic_library&oldid=11796&diff=prev#HKDF_implementation_example_using_HMAC-SHA256_Cryptographic_library_services .my questions is first, once I added the salt, IKM, info values and I declared uint32_t L = 256; and uint32_t N = 0; I should add other code to determine the "computed_PRK" and "computed_hash" values right ? or is there a more complete example for my case ? Thanks a lot
The STM32H753 has 2 CRCs. One global CRC and one specific for Flash memory.I think it is possible to use the global CRC for flash memory right ? The benefit would be to use a different polynom than the one from Flash CRC.is it possible to have an idea of the performance loss @ 400MHz CPU clock. I know it depends on many factors, I just want to know if it's twice slower, 10 times slower...
Hello,I am working on an IoT security project, where a TPM like STSAFE-A110 is required for signature verification and data decryption. The latter fails with the mentioned chip and the static (non-ephemeral) private key.Setup:X-NUCLEO-SAFEA1 board (with STSAFE-A110 TPM), pairing doneB-U585I-IOT02A MCU boardWindows 10 PCTera TermSTM32CubeIDEI have successfully run the Establish_Secret demo project, it shows ephemeral key usage: As I need the TPM's private key to survive the power cycle, I replace the ephemeral slot with the static slot 1, also on StSafeA_GenerateKeyPair call: The call to StSafeA_EstablishKey then fails with code 17 (STSAFEA_UNSATISFIED_ACCESS_CONDITION): Why does it fail? The documentation for STSAFE A110 clearly states that this feature is supported for slot 1 (document dm00675324): Thanks.
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.