secure boot: Fix bootloader image verification failure

* Failure prevented secure boot from enabling.
* Also adds unit test cases for esp_image_basic_verify()

Ref https://esp32.com/viewtopic.php?f=2&t=1602
TW11878
This commit is contained in:
Angus Gratton
2017-04-24 16:21:27 +10:00
committed by Angus Gratton
parent b540322dc1
commit e2479b46f7
6 changed files with 71 additions and 22 deletions

View File

@@ -22,16 +22,9 @@ extern "C"
#endif
#include "esp_flash_data_types.h"
#include "soc/soc.h"
#define SPI_SEC_SIZE 0x1000
#define IROM_LOW 0x400D0000
#define IROM_HIGH 0x40400000
#define DROM_LOW 0x3F400000
#define DROM_HIGH 0x3F800000
#define RTC_IRAM_LOW 0x400C0000
#define RTC_IRAM_HIGH 0x400C2000
#define RTC_DATA_LOW 0x50000000
#define RTC_DATA_HIGH 0x50002000
#define SPI_ERROR_LOG "spi flash error"

View File

@@ -475,7 +475,7 @@ static void unpack_load_app(const esp_partition_pos_t* partition)
// TODO: actually check md5
}
if (address >= DROM_LOW && address < DROM_HIGH) {
if (address >= SOC_DROM_LOW && address < SOC_DROM_HIGH) {
ESP_LOGD(TAG, "found drom segment, map from %08x to %08x", data_offs,
segment_header.load_addr);
drom_addr = data_offs;
@@ -485,7 +485,7 @@ static void unpack_load_app(const esp_partition_pos_t* partition)
map = true;
}
if (address >= IROM_LOW && address < IROM_HIGH) {
if (address >= SOC_IROM_LOW && address < SOC_IROM_HIGH) {
ESP_LOGD(TAG, "found irom segment, map from %08x to %08x", data_offs,
segment_header.load_addr);
irom_addr = data_offs;
@@ -495,12 +495,12 @@ static void unpack_load_app(const esp_partition_pos_t* partition)
map = true;
}
if (!load_rtc_memory && address >= RTC_IRAM_LOW && address < RTC_IRAM_HIGH) {
if (!load_rtc_memory && address >= SOC_RTC_IRAM_LOW && address < SOC_RTC_IRAM_HIGH) {
ESP_LOGD(TAG, "Skipping RTC code segment at %08x\n", data_offs);
load = false;
}
if (!load_rtc_memory && address >= RTC_DATA_LOW && address < RTC_DATA_HIGH) {
if (!load_rtc_memory && address >= SOC_RTC_DATA_LOW && address < SOC_RTC_DATA_HIGH) {
ESP_LOGD(TAG, "Skipping RTC data segment at %08x\n", data_offs);
load = false;
}