Commit a3495105 authored by Gustavo Henrique Nihei's avatar Gustavo Henrique Nihei Committed by Gustavo Henrique Nihei
Browse files

espressif: Fix support for signing algorithms



The build system previously restricted the usage of some signing
algorithms due to build issues.

Signed-off-by: default avatarGustavo Henrique Nihei <gustavo.nihei@espressif.com>
parent 1bc106e4
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -82,17 +82,10 @@ else()
endif()

if (DEFINED CONFIG_ESP_SIGN_RSA)
    if ("${MCUBOOT_TARGET}" STREQUAL "esp32s2" OR
        "${MCUBOOT_TARGET}" STREQUAL "esp32c3")
        message(FATAL_ERROR "RSA signature verification is currently not supported on the target")
    endif()
    include(${CMAKE_CURRENT_LIST_DIR}/include/crypto_config/rsa.cmake)
elseif (DEFINED CONFIG_ESP_SIGN_EC256)
    include(${CMAKE_CURRENT_LIST_DIR}/include/crypto_config/ec256.cmake)
elseif (DEFINED CONFIG_ESP_SIGN_ED25519)
    if ("${MCUBOOT_TARGET}" STREQUAL "esp32c3")
        message(FATAL_ERROR "ED25519 signature verification is currently not supported on the target")
    endif()
    include(${CMAKE_CURRENT_LIST_DIR}/include/crypto_config/ed25519.cmake)
else()
    # No signature verification
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
#include <mbedtls/platform.h>
#include <mbedtls/memory_buffer_alloc.h>

#define CRYPTO_HEAP_SIZE 16384
#define CRYPTO_HEAP_SIZE 8192

static unsigned char memory_buf[CRYPTO_HEAP_SIZE];

+149 −126
Original line number Diff line number Diff line
/*
 * Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
 * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/*
 * Linker file used to link the bootloader.
/* Simplified memory map for the bootloader.
 *
 * The main purpose is to make sure the bootloader can load into main memory
 * without overwriting itself.
 */

MEMORY
{
    iram_loader_seg (RWX) : org = 0x4009D000, len = 0x3000
    iram_seg (RWX) : org = 0x40085000, len = 0x9000
    dram_seg (RW) : org = 0x3FFF5000, len = 0xB000
  iram_seg (RWX) :                  org = 0x40093000, len = 0x9000
  iram_loader_seg (RWX) :           org = 0x4009C000, len = 0x4000
  dram_seg (RW) :                   org = 0x3FFF5000, len = 0x8000
}

ENTRY(main)
/*  Default entry point:  */
ENTRY(main);

SECTIONS
{
@@ -27,6 +30,31 @@ SECTIONS
    *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
    *libhal.a:bootloader_flash.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_flash_config_esp32.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_common_loader.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_flash.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_random.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
    *libhal.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable)
    *libhal.a:bootloader_efuse_esp32.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_utility.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_sha.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_panic.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_soc.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_image_format.*(.literal .text .literal.* .text.*)
    *libhal.a:flash_encrypt.*(.literal .text .literal.* .text.*)
    *libhal.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
    *libhal.a:flash_partitions.*(.literal .text .literal.* .text.*)
    *libhal.a:secure_boot.*(.literal .text .literal.* .text.*)
    *libhal.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*)
    *libhal.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
    *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_table.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_fields.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_api.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_utility.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_api_key_esp32.*(.literal .text .literal.* .text.*)
    *esp_mcuboot.*(.literal .text .literal.* .text.*)
    *esp_loader.*(.literal .text .literal.* .text.*)
    *(.fini.literal)
@@ -34,7 +62,6 @@ SECTIONS
    *(.gnu.version)
    _loader_text_end = ABSOLUTE(.);
  } > iram_loader_seg

  .iram.text :
  {
    . = ALIGN (16);
@@ -42,7 +69,6 @@ SECTIONS
    *(.init.literal)
    *(.init)
  } > iram_seg

  .dram0.bss (NOLOAD) :
  {
    . = ALIGN (8);
@@ -64,7 +90,6 @@ SECTIONS
    . = ALIGN (8);
    _bss_end = ABSOLUTE(.);
  } >dram_seg

  .dram0.data :
  {
    _data_start = ABSOLUTE(.);
@@ -81,7 +106,6 @@ SECTIONS
    *(.jcr)
    _data_end = ABSOLUTE(.);
  } >dram_seg

  .dram0.rodata :
  {
    _rodata_start = ABSOLUTE(.);
@@ -125,7 +149,6 @@ SECTIONS
    . = ALIGN(4);
    _dram_end = ABSOLUTE(.);
  } >dram_seg

  .iram.text :
  {
    _stext = .;
+12 −6
Original line number Diff line number Diff line
/*
 * Linker file used to link the bootloader.
 * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/* Simplified memory map for the bootloader.
 *
 * The main purpose is to make sure the bootloader can load into main memory
 * without overwriting itself.
 */

MEMORY
{
  iram_seg (RWX) :                  org = 0x403CB000, len = 0x5000
  iram_loader_seg (RWX) :           org = 0x403D0000, len = 0x6000
  dram_seg (RW) :                   org = 0x3FCD6000, len = 0x7000
  iram_seg (RWX) :                  org = 0x403C8000, len = 0x8000
  iram_loader_seg (RWX) :           org = 0x403D0000, len = 0x4800
  dram_seg (RW) :                   org = 0x3FCD5000, len = 0x8800
}

/*  Default entry point:  */
ENTRY(main);


SECTIONS
{

  .iram_loader.text :
  {
    . = ALIGN (16);
+37 −6
Original line number Diff line number Diff line
/*
 * Linker file used to link the bootloader.
 * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/* Simplified memory map for the bootloader.
 *
 * The main purpose is to make sure the bootloader can load into main memory
 * without overwriting itself.
 */
 
MEMORY
{
  iram_seg (RWX) :                  org = 0x40048000, len = 0x8000
  iram_loader_seg (RWX) : org = 0x40050000, len = 0x3000
  dram_seg (RW) :     org = 0x3FFE6000, len = 0x8000
  iram_loader_seg (RWX) :           org = 0x40050000, len = 0x5000
  dram_seg (RW) :                   org = 0x3FFE5000, len = 0x8000
}

/*  Default entry point:  */
ENTRY(main);


SECTIONS
{

  .iram_loader.text :
  {
    . = ALIGN (16);
@@ -24,6 +30,31 @@ SECTIONS
    *(.iram1 .iram1.*) /* catch stray IRAM_ATTR */
    *libhal.a:bootloader_flash.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_flash_config_esp32s2.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_clock_loader.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_common_loader.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_flash.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_random.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_random*.*(.literal.bootloader_random_disable .text.bootloader_random_disable)
    *libhal.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable)
    *libhal.a:bootloader_efuse_esp32s2.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_utility.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_sha.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_console_loader.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_panic.*(.literal .text .literal.* .text.*)
    *libhal.a:bootloader_soc.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_image_format.*(.literal .text .literal.* .text.*)
    *libhal.a:flash_encrypt.*(.literal .text .literal.* .text.*)
    *libhal.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*)
    *libhal.a:flash_partitions.*(.literal .text .literal.* .text.*)
    *libhal.a:secure_boot.*(.literal .text .literal.* .text.*)
    *libhal.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*)
    *libhal.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*)
    *libhal.a:wdt_hal_iram.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_table.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_fields.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_api.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_utility.*(.literal .text .literal.* .text.*)
    *libhal.a:esp_efuse_api_key_esp32xx.*(.literal .text .literal.* .text.*)
    *esp_mcuboot.*(.literal .text .literal.* .text.*)
    *esp_loader.*(.literal .text .literal.* .text.*)
    *(.fini.literal)