添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hi,

I am using STM32L4 controller for my project and using KEIL IDE.

I want to do AES-128 encryption for my firmware .hex file because we are planning to keep this firmware image in the cloud server for OTA but it is not safe keeping original firmware image in the server. Can it possible to do encryption at the compilation stage in the keil IDE?

Please suggest the procedure to get the encrypted .hex file

Thanks.

You'll have to create a separate PC tool which processes the unencrypted hex/bin file and creates an encrypted one, which you will place on your server, which will be downloaded and decrypted by your firmware.

Take a look at this example - https://github.com/dev26th/bootloader

The "creator" directory is the sources of the PC tool that I'm talking about.

Hi After Forever,

Thanks, The link that you send is really helped me to proceed my work. I have one more doubt please clarify this also:

After the AES encryption, The 128bit secret Key I am planning to store into the external FLAHS which is connected to my MCU via SPI. This key also I dont want to save the original secret key instead of that I want to save derived secret key to the External FLASH. So that attacker gets the key from external FLASH he cant use that key for decrypt.

Thanks.

Don't store the secret in the external flash, store it in internal flash and make sure to use read-out protection options so people can't extract the secret key so easily.

If you need good security, you could implement combined asymmetric (RSA or ECC) + symmetric (AES for example) encryption with different random AES key every new update. I.e. firmware will get encrypted key + encrypted binary, then decrypt the encrypted key using its private RSA key, then be able to proceed to decrypt the binary.

Cryptography is hard, you should hire professionals if you want robust protection. Even giants like Nintendo make mistakes so researches are able to get/decrypt the OTA updates.

Problem with ST cryptographic library (CMOX) AES CBC encryption in STM32 MCUs Security Encryption using AES CCM + MIC - stm32wb in STM32 MCUs Security STM32 firmware update (USB DFU) and encryption in STM32 MCUs Embedded software Firmware Encryption and Updation in STM32 MCUs Security