Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
I've been implementing I2C communication between F401CCU6 and Nucleo F746ZG, while adding CRC I got different outputs, Nucleo provides configurable CRC peripheral, while F401 is by default set to 0x4C11DB7 (https://www.st.com/resource/en/reference_manual/rm0368-stm32f401xbc-and-stm32f401xde-advanced-armbased-32bit-mcus-stmicroelectronics.pdf#page=68&zoom=100,89,116)It also provides reseting initial value to 0xFFFF FFFF, ("The CRC calculator can be reset to 0xFFFF FFFF with the RESET control bit in the CRC_CR register. This operation does not affect the contents of the CRC_IDR register")I've set Nucleo CRC polynomial, init value to match those on BlackPill. Calculated value matches with CRC-32/MPEG-2 standard (available at https://crccalc.com/ for example).Did anyone has experienced this too?
Hello everyoneI am trying to use the crypto library to perform an AES CCM encryption decryption. I am using an STM32F423CH MCU. The frames I am receiving are comming from other system and the authentication is always failing.I implemted the validation scheme that appears in the NIST Special Publication 800-38C for CCM. //FROM THE EXAMPLE IN nvlpubs.nist.gov const uint8_t key[] = {0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F}; uint8_t nonce[] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16}; uint8_t header[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; uint8_t data[] = {0x20, 0x21, 0x22, 0x23}; uint8_t outputData[40]; uint8_t outputTag[8]; uint8_t recoveredData[32]; int32_t outputLength = 4; int32_t outputTagLength; volatile uint32_t error_status = AES_SUCCESS; AESCCMctx_stt AESCCMctx; AESCCMctx_stt* AESctx = &AESCCMctx; AESctx->mNonceSize = 7; AESctx->mKeySize = CRL_AES128_KEY; AESctx->
@Jocelyn RICARD I've built, installed and used SBSFU to successfully update the firmware through the serial terminal with a YModem transfer. This update was from version "0" to version "1". Now I have built a new version "2" which only differs from version "1" in that it prints a different version number at startup. The build process and scrips used are exactly the same. Now when I try to install version "2", it downloads correctly, but after that SBSFU throws an error: "Installation not validated: rollback procedure initiated (SLOT_ACTIVE_1 / SLOT_DWL_1)"I've tried it multiple times, each update from "0" to "1" works without problems, but going from "1" to "2" throws the same error. I'm completely mystified.... Log is attached.
STM32G484QETx is getting locked because of wrong configuration in secure boot and secure firmware update. Kindly suggest me the right configuration along with code and examples. I am attaching a pdf for your reference.
Hi, I am writing this both as a guide to other people struggling with their STM32 AES accelerator, and as a suggestion to STM how to improve their HAL so it is easier to use. My testing and debugging was done on a STM32WB, but i think other accelerators on STM32 chips have similar properties. I used a STM32L4A6 before, and its accelerator seemed to have the same properties.First, these are the badly documented properties of the HAL you might have problems with:1:When setting the DataWidthUnit field to use byte buffers, this only changes the processing of the data itself. Key and IV are still expected as word buffers.2:The accelerator is only able to process data that has a size of a multiple of 4 bytes. The HAL will not throw any errors when passing an invalid data size, but the result will not be a valid AES result.3:When using an AES mode using any initial vector, it might seem like the HAL always expects 4 words / 16 bytes as IV, but this is not true. Actually, it expects 3 words /
Hello,So I'm using a Nucleo-H753ZI (so STM32H753ZI) and I am trying to implement manually (aka without using the HAL library you provide) some drivers of the CRYP module. More precisely, I need to use the CRYP module with AES in counter mode (AES-CTR, 128 bit keys).My issue is that I think the documentation on this part contains a slight discrepancy. I am referring to the document "RM0433 Rev 7". On page 1306, (in the CRYP AES-CTR chapter) we find:To me, it looks clear the AES counter is stored in register CRYP_IV0L. Furthermore, the document states that "the peripheral increments the least significant 32 bits (leaving the other most significant 96 bits unchanged).". To me, that confirms that CRYP_IV0L contains the counter and will be incremented for each block. However, I found no success in implementing the driver by configuring the counter with CRYP_IV0L, but the encryption and decryption do work flawlessly when the counter is stored in CRYP_IV1R.My point is that I think this table
As per current SBSFU Key storage mechanism, we can store One Key per each SLOT wise, as we are going to use single slot, we can configure one Key in SBSFU.Also, if you want to store more keys, we can use other slot keys as well like ECC_KEY2 and ECC_KEY3. Need some customization at SBSFU to utilise these for SLOT 1 firmware purpose. is my understanding correct ??Then i have some following questions on KEY Revoke mechanismIf i want to Revoke KEY1 and make use of another KEY2 in case of KEY1 compromise, is it possible to do this ?? To achieve this, we need some common secured shared memory between SBSFU and Application, is it exist ??We are thinking of solution in case of one KEY1 compromised, and we want to switch to alternate KEY2 for further verification of Firmware. So please suggest better solution to this ??
Device details :ST-LINK SN : 002F003F3137510539383538ST-LINK FW : V3J9M3B5S1Board : STLINK-V3SETVoltage : 3.76VSWD freq : 24000 KHzConnect mode: Hot PlugReset mode : Software resetDevice ID : 0x480Revision ID : --Device name : STM32H7A/BFlash size : 2 MBytesDevice type : MCUDevice CPU : Cortex-M7BL Version : 0x91When trying to program SFI file to device getting below errorError: SECURITY State Fail Error: Invalid state after SFI install ! Error: RSS internal system error or License is invalid ! SFI creation :onFull logs:./STM32_Programmer_CLI -c port=swd mode=HOTPLUG -sfi protocol=static /home/analog/drive/SFIFiles/sbsfu_rdp_bb.sfi hsm=1 slot=1 ------------------------------------------------------------------- STM32CubeProgrammer v2.10.0 ------------------------------------------------------------------- ST-LINK SN : 002F003F3137510539383538 ST-LINK FW : V3J9M3B5S1 Board : STLI
I know that STM32H753 is pin-compatible to STM32H743, and as far as I know also code-compatible for most intents and purposes. The only difference seems to be the Crypto hardware acceleration. So I assume that I can run code from H743 on the H753 without even recompiling, is that correct?What about the Bootloader? AN2606 makes no distinction between H743 and H753, so again I assume the chips are interchangeable in this regard?What about the SecureBoot / SBSFU stuff? Do I need to do something special if I DON'T want to use these features? Or are they disabled by default?Thanks for your help!
I am using the KMS of SBSFU to store my TLS certificates during the provisioning process. When I flash a new user firmware application the certificates inside the KMS are deleted too. So each time I want to run new user firmware, I have to go through the whole provisioning process again. This is very tedious.I install the new firmware by uploading the userapp.bin firmware (which is generated by the SBSFU postbuild.sh script) with STM32CubeProgrammer.What should I do differently to prevent deletion of the KMS contents?
Hi,In TFM and SBSFU applications, by default the anti-tamper protection is enabled for both internal tamper events and external tamper events. It is activated at the start of TFM_SBSFU_Boot, and remains active.In case of tamper detection, sensitive data in SRAM2, caches and cryptographic peripherals are immediately erased, and the tamper interruption triggers a reset and the application is blocked (can't boot).I'm using the anti-tamper protection in TFM with stm32U585, but I don't want the tamper interruption to trigger a reset, I have changed the default configuration in TAMP_IRQHandler(), but still a reset is triggered and the application is blocked at tamper detection, I have tried to catch reset causes (reset flags), and I have found a software reset flag (Set by hardware when a software reset occurs.) and NRST Pin reset flag (Set by hardware when a reset from the NRST pin occurs.), So I wonder what would be the cause of NRST reset, and is there any relation between NRST , TAMP and
Working on a project using STM32G071CBT6. Using STM32CubeExpansion_Crypto_V4.0.1 Projects NUCLEO-G071RB Applications RSA PKCS1v1.5_SignVerify RoutinesTrying to sign a 138 byte msg.cmox_rsa_pkcs1v15_verify() returns CMOX_RSA_AUTH_FAILAny suggestions?
Hi,I'm trying to implement secure boot and secure firmware update on STM32F415RGT6 but I'm having hard time with SBSFU code.I already compiled the example STM32F413H-Discovery making adjustment for flash and ram in linker file. Then I runned the SBSFU on microcontroller but this is what I get from console log. I stepped into debug session and found that the microcontroller keeps rebooting because function SE_IsUnprivileged() always return 1, which means non-privileged mode.It may be a wrong memory mapping??Thanks
Also, apparently CVE-2020-27212 means that you can bypass flash readout protection. Is that a correct reading of that CVE? Note that searching both the ST main site and the community site produce no hits for either CVE, and trying to determine the actual impact of either CVE from the NIST sites is difficult because they provide no detailed information.
Hi, I try to download X-CUBE-CRYPTOLIB but after clicking on ACCEPT "terms and conditions" I always get 404 Error
I set level to DC(level1) and now I am not able to connect the board to Cube Programmer and throws "Connection to target must be established before performing the read command." https://youtu.be/LG474meMnagI was using this above video for reference. I had TrustZone enabled on the board and wanted to disable it. As per the video I first set it to DC from AA level in cube programmer. Then disconnected the board and power cycle. Then tried to connect back for the next steps, the cube programmer started throwing an error " Error: Connection to target must be established before performing the read command." Now I am not able to flash the code in Keil and it says "CPU is locked up"
We have plan to support application down-loader from Application context. It means Application has ability to receive new application over the air. Not SBSFU.In case of Active application got corrupted somehow, then SBSFU is locked the MCU, as we lost Remote application upgrade capability.Can we enable SBSFU internal loader in case of recovery mechanism condition only, as No valid application exist ?? if we enable, the what is the RISC of Security ??
..
Hi,Hope doing good.Can I have an SHA-256 crypto library example code?
I am quite new with embedded programming. I must implement CRC8 with HAL and have tried to implement the CRC8 in python at the other end. Have used the crc8 library but both results don’t match. Is there anybody who could give me a hand to implement it correctly?
Can the CRC for the ADBMS1818 (and other Analog Devices BMS parts) be generated using the STM32 CRC peripheral?The ADBMS1818 datasheet shows a 15 bit polynomial for the CRC as--x 15 + x 14 + x 10 + x 8 + x 7 + x 4 + x 3 + 1Other sources call this a CAN-15-CRC polynomial, e.g., the Wikipedia article Cyclic redundancy check.Wikipedia lists this polynomial as "even", and the Ref Manual for the STM32L431 says that the CRC peripheral does not work for even polynomials. However, it is not clear as to the exact definition of what Wikipedia and ST are using for "even." So, it is not clear that this polynomial can be handled with the 'L431 CRC.However, if the problem is odd/even, there might be some tricks to make it work, e.g. reversal of the polynomial with a zero added, but I'm not sure if that is possible. I've made some attempts that have not been successful.Finally, the datasheet has an example of software routine for generating the CRC. It uses a polynomial representation of 0x4599. Howe
Also, the crypto functions require a key made up of an exponent and a modulus. The examples only show these as two separate arrays. How do I get from a single array I have hopefully included from the pem file into these two separate arrays? What is the format?As a separate task, does anyone have any example of how to decrypt a large amount of data using a private key? The large amount will be read from a flash chip in multiple 512 byte chunks.
Hi, I have nucleo-h753ZI and I want to use CRYP in a project that also uses FREERTOS. I set Timer 6 as Timebase Source (recommended due to FREERTOS) and as a result, program goes to HardFault every time I use HAL_CRYP_Encrypt function.HAL_CRYP_Decrypt(&hcryp, (uint32_t *)AES_input, 48, (uint32_t *)encrypted, 100);I configured CRYP to AES CBC with 256bit key and 8bit data and my array size is 48. When I change Timebase Source to systick, it works without any issues. Does anyone know what is the issue here?Thanks.
Does the controller perform a CRC confirmation check before running the application to check if the firmware is corrupted? If so, where does this happen; in the bootloader or the application itself? What does it do if the CRC turns out to be wrong? Secondly, I've referred the AN3155 and in that the bootloader expects a packet size to be a multiple of 4 while issuing the Write memory command (2nd note below the Write Memory Command flow on Pg. 19 of AN3155). So what if the overall firmware size is not a multiple of 4? How to handle the last firmware packet transaction?
Hi,I am currently working on a bluetooth application, on an STM32WB55 microcontroller, to which I have integrated OTA update functionality.As Loader I used the one present in the provided code examples.The application and downloads work properly, my question is: what happens if the binary file I transmit is corrupted?At the moment I have run some tests. However, if I manipulate the binary file by going to delete parts or overwriting others, the trend may change. There are cases where after downloading it remains in the OTA loader and others where the firmware is loaded but the application crashes not allowing the binary to be reloaded.So in the loader present in the examples I think that in addition to the key check there is no check on the validity of the received binary, is there?In that sense how could one proceed? By inserting an additional check in the loader (e.g., CRC) or has some other functionality been provided?Thank you very much
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.