For devices production and make further device service possible, I'd like to make flash encryption and secure boot in this way:
- take binaries with signed app and bootloader
- generate nvs binary file per device from factory provision data
- generate image and nvs keys on host per device
- encrypt the corresponding binaries: bootloader, partition table, otadata initial and app
- build the full image
- burn flash encryption key and secure boot digest into device
- burn the corresponding efuses
- flash the prepared full image
The goals are:
- Prevent firmware and data from leakage
- Prevent firmware from counterfeit
- Remain the ability to readout flash contains encrypted to readout user data by serviceman
After these steps, I got an error:
Code: Select all
invalid header: 0x29207d17
And I used the following commands:
Code: Select all
# burn keys and efuses
..\..\espefuse.exe --port COM29 --chip esp32s3 burn_key --show-sensitive-info BLOCK_KEY0 keys/image_key.bin XTS_AES_128_KEY BLOCK_KEY1 secure_boot_key_digest.bin SECURE_BOOT_DIGEST0
..\..\espefuse.exe --port COM29 --chip esp32s3 burn_efuse SPI_BOOT_CRYPT_CNT 7 DIS_DOWNLOAD_ICACHE 1 DIS_DOWNLOAD_DCACHE 1 HARD_DIS_JTAG 1 DIS_DIRECT_BOOT 1 DIS_USB_JTAG 1 DIS_DOWNLOAD_MANUAL_ENCRYPT 1
..\..\espefuse.exe --port COM29 --chip esp32s3 burn_efuse SECURE_BOOT_KEY_REVOKE1 1 SECURE_BOOT_KEY_REVOKE2 1 SECURE_BOOT_EN 1
# Flashing full image
..\..\esptool.exe --port COM29 --baud 921600 --chip esp32s3 --no-stub write_flash 0 full.bin --force
Logs are in attachments