Hello,
I want to implement a modified flash encryption feature onto my ESP32 that uses a user-supplied 256-bit key to encrypt and decrypt flash contents, rather than eFuse Block 1. The reason for this is that I want to be able to test flash encryption functionality without making any permanent changes to the chip.
I understand that the user can disable flash encryption a number of times after enabling it. However, there is a limit to this, and it still writes the key to eFuse Block 1, which is what I want to avoid.
I looked at the ESP32 technical reference manual and saw that the chip defines a key generator function that derives from Block 1 and some other settings. So I guess if I could override this key generator function, I could implement my desired functionality. But I have no idea how feasible this is, or if it's feasible at all. Are there any other potential solutions for this?
Thanks in advance.
ESP32 Test Flash Encryption
Re: ESP32 Test Flash Encryption
Hi Gerry,
No, this is not possible. The ESP32 flash encryption engine can only source its key from one place, and that is efuse block 1.
The "key generator" algorithm mentioned in the TRM is because the flash encryption uses a "key tweak" mode of AES where the key for each 32 byte block of flash is different. The hardware engine starts from the key in efuse and applies a "tweak" based on the flash block address. An alternative description of this algorithm is here: https://docs.espressif.com/projects/esp ... -algorithm
If you pre-burn a key (using the instructions in the Flash Encryption documentation) and keep a copy, and burn FLASH_CRYPT_CNT to 1 without write protecting it, then you should not be limiting your options for further use of this chip - you can always burn FLASH_CRYPT_CNT again to disable flash encryption, and you will have the key if you decide to re-enable it again later.
No, this is not possible. The ESP32 flash encryption engine can only source its key from one place, and that is efuse block 1.
The "key generator" algorithm mentioned in the TRM is because the flash encryption uses a "key tweak" mode of AES where the key for each 32 byte block of flash is different. The hardware engine starts from the key in efuse and applies a "tweak" based on the flash block address. An alternative description of this algorithm is here: https://docs.espressif.com/projects/esp ... -algorithm
If you pre-burn a key (using the instructions in the Flash Encryption documentation) and keep a copy, and burn FLASH_CRYPT_CNT to 1 without write protecting it, then you should not be limiting your options for further use of this chip - you can always burn FLASH_CRYPT_CNT again to disable flash encryption, and you will have the key if you decide to re-enable it again later.
Who is online
Users browsing this forum: vritzka and 105 guests