I am trying to implement ENCRYPTED OTA using this doc:
https://github.com/espressif/idf-extra- ... rypted_img
I am using ECIES-P256.
I wanted to read the esp_secure_cert.bin file from the esp_secure_cert partition of the flash memory, without needing to burn an Efuse, but it seems that's not possible with the ECIES-P256. I think it can only be done using RSA-3072.
I am with problems here:
Code: Select all
#define HMAC_UP_KEY_ID 2
esp_decrypt_cfg_t cfg = {0};
cfg.hmac_key_id = HMAC_UP_KEY_ID; // the lib returns hmac not found in efuse(Obviously I didn't burn anything in the efuse).
or
cfg.hmac_key_id = -1; // the lib returns invalid argument.
or
cfg.hmac_key_id = 0; // not works too
esp_decrypt_handle_t decrypt_handle = esp_encrypted_img_decrypt_start(&cfg);
if (decrypt_handle == NULL)
{
ota_task_error("decrypt_handle = NULL.");
}
Is there a way to bypass the HMAC peripheral dependency in esp_encrypted_img to use a raw private key stored in a flash partition (e.g., via esp_secure_cert) instead of deriving it from an eFuse key?
Or is the ECIES implementation hardcoded to hardware-only derivation ?
Note:
If I'm not wrong:
The current implementation of esp_encrypted_img is inconsistent. For RSA-3072, the documentation states the private key can be retrieved via esp_secure_cert. However, for ECIES-P256, the library hardcodes the requirement for an HMAC eFuse Key, preventing the use of a private key stored in a flash partition. This limitation makes no sense when Flash Encryption is enabled, as the flash partition would be just as secure as the eFuse-derived key, but with much more flexibility for development and provisioning.
Environment:
ESP-IDF 6.0.1
ESP32-S3
esp_encrypted_img:
https://github.com/espressif/idf-extra- ... rypted_img
version: 2.7.1
esp_secure_cert_mgr:
https://github.com/espressif/esp_secure_cert_mgr
version: 2.9.2
Thank's.