SHA-256 for running partition all zero?
Posted: Sat Nov 23, 2019 6:02 pm
Following the native OTA example I try to output the SHA-256 for partition table, bootloader and firmware like this:
But I get always all zero for the firmware:
Is this to be expected? It does not change even after multiple successful OTA updates.
Thomas
Code: Select all
// get sha256 digest for the partition table
partition.address = ESP_PARTITION_TABLE_OFFSET;
partition.size = ESP_PARTITION_TABLE_MAX_LEN;
partition.type = ESP_PARTITION_TYPE_DATA;
esp_partition_get_sha256(&partition, sha_256);
print_sha256(sha_256, "SHA-256 for the partition table: ");
// get sha256 digest for bootloader
partition.address = ESP_BOOTLOADER_OFFSET;
partition.size = ESP_PARTITION_TABLE_OFFSET;
partition.type = ESP_PARTITION_TYPE_APP;
esp_partition_get_sha256(&partition, sha_256);
print_sha256(sha_256, "SHA-256 for bootloader: ");
const esp_partition_t *running = esp_ota_get_running_partition();
err = esp_partition_get_sha256(running, sha_256);
if (err == ESP_OK)
{
print_sha256(sha_256, "SHA-256 for current firmware: ");
}
else
{
ESP_LOGW(TAG, "Failed to get SHA-256 for current firmware: %s", esp_err_to_name(err));
}
Code: Select all
I (569) ota_work_example: SHA-256 for the partition table: : 1da6115f8cb1194eca355efc369bc41453a044aedc8937666c307d7ee9db3f92
I (579) boot_comm: chip revision: 1, min. application chip revision: 0
I (609) ota_work_example: SHA-256 for bootloader: : 9dc4f10c8b78988b243757cbc9bb7e1a8164cb7cc7119f129c8a229094b402cc
I (619) boot_comm: chip revision: 1, min. application chip revision: 0
I (1229) ota_work_example: SHA-256 for current firmware: : 0000000000000000000000000000000000000000000000000000000000000000
Thomas