fix(app_update): Fix reading secure boot digest from register

While reading the key from the register, the register are read by
8 bit access which results in reading wrong data. Reading from the
peripheral should be 32 bit aligned. The commit updates the code
to read the secure boot key from the register using 32 bit access.

Closes https://github.com/espressif/esp-idf/issues/12851
This commit is contained in:
Harshit Malpani
2024-01-31 12:22:26 +05:30
parent acfc9130c0
commit 650c64a840

View File

@ -924,8 +924,8 @@ esp_err_t esp_ota_revoke_secure_boot_public_key(esp_ota_secure_boot_public_key_i
if (trusted_keys.key_digests[i] != NULL) {
bool all_zeroes = true;
for (unsigned j = 0; j < ESP_SECURE_BOOT_DIGEST_LEN; j++) {
all_zeroes = all_zeroes && (*(uint8_t *)(trusted_keys.key_digests[i] + j) == 0);
for (unsigned j = 0; j < ESP_SECURE_BOOT_DIGEST_LEN; j+=4) {
all_zeroes = all_zeroes && (*(uint32_t *)(trusted_keys.key_digests[i] + j) == 0);
}
if (!all_zeroes) {
memcpy(trusted_digests.key_digests[trusted_digests.num_digests++], (uint8_t *)trusted_keys.key_digests[i], ESP_SECURE_BOOT_DIGEST_LEN);