Commit Graph

56 Commits

Author SHA1 Message Date
Almir Okato d3819c90b4 espressif: allow the use of a different toolchain for building
TOOLCHAIN_BIN_DIR can be defined for a different toolchain use.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-10-17 04:41:37 -03:00
Almir Okato db2024eb20 espressif: update secure boot and flash encryption
Adjust secure boot and flash encryption after IDF v5.x updates.
It also allows to enable secure boot on ESP32-C2.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-09-20 09:46:27 -03:00
Almir Okato 4a051181c4 espressif: esp32xx: adjust memory map on linker script
Reorganize memory mapping and document the address ranges that
the OS must avoid overlapping.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-08-10 10:59:33 -07:00
Almir Okato 68a2980f97 espressif: esp32c2: remove unsupported configs
Remove unsupported USB JTAG configuration
Remove unsupported Secure Boot V2 configuration

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-08-10 10:59:33 -07:00
Almir Okato 2f17549ef3 espressif: esp32c6 esp32h2: fix custom uart and secure boot build
Fix missing header on console_uart_custom.c
Update secure_boot.c includes removing soc ifdefs

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-08-10 10:59:33 -07:00
Almir Okato c3fe516f44 espressif: ESP32-C2 initial support
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-07-24 22:51:11 -03:00
Almir Okato d43cf8956d espressif: ESP32-H2 initial support
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-07-24 22:51:11 -03:00
Almir Okato ecaf8bd521 espressif: ESP32-C6 initial support
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-07-24 22:51:11 -03:00
Almir Okato 3ccc6a6a59 espressif: add flash parameters to esptool command for building
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-07-24 22:51:11 -03:00
Almir Okato 54ef484afa espressif: remove IDF git submodule and add its reference by param
Remove the ESP-IDF from git submodules to avoid potential
duplicated repo clones on the user system. IDF HAL code is still
a dependency for Espressif port, therefore now the HAL code
reference needs to be passed by parameter when building.

The Espressif port was also updated to work with last v5.1 IDF
code.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-07-24 10:03:18 -03:00
Almir Okato 26ed3f448f espressif: preferred use of a installed esptool
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-07-24 10:03:18 -03:00
Antonio de Angelis 02bf072d2d bootutil/crypto: Refactor the RSA signature verification and encryption
This patch refactor the RSA operations done by the signature verification
module and by the encrypted images decryption module. Previous solution is
tightly coupled with Mbed TLS, while this patch provides an abstraction of
the RSA functionalities in a dedicated crypto abstraction header, crypto/rsa.h
that supports both Mbed TLS APIs and PSA Crypto APIs. In case of PSA Crypto,
the verification scheme is directly provided by the crypto backend hence it
simplifies the operations done in the image verification module.

Signed-off-by: Antonio de Angelis <Antonio.deAngelis@arm.com>
Change-Id: I973bc3374b62eee2d7717c2368bce7611d37a0c8
2023-06-09 14:35:28 +02:00
Jamie McCrae cb07e88869 boot_serial: Replace cbor auto-generated code with zcbor functions
Replaces the auto-generated decoding/encoding files with inline code
for encoding/decoding cbor data structures, this adds the benefit of
allowing the elements to be in any order and reduces code size. To
accommodate this, zcbor_bulk has been imported from Zephyr.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-15 10:22:51 +02:00
Jamie McCrae db6ba46244 boot_serial: Unify zcbor include paths
Moves zcbor files to a subdirectory and replaces differing
include path styles to be unified.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-05-12 10:33:28 +01:00
Marek Matej 6769344276 boot: zephyr: esp32: zephyr port
Add support for ESP32xx targets to build
as Zephyr application.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2023-04-27 20:30:35 -03:00
Antonio de Angelis 10529d3032 bootutil/crypto: Have a single ECDSA verification module
Remove the generic ECDSA verification module and keep the
existing one, just renaming it image_ecdsa.c. Make sure
that the abstraction layer is generically called ecdsa.h
and the abstraction names are not P256 specific.

Signed-off-by: Antonio de Angelis <Antonio.deAngelis@arm.com>
Change-Id: I6f78cfc1b1c2851cdad67efa91c6cb49498187bb
2023-04-26 13:57:53 +02:00
Roland Mikhel 206b914852 bootutil: Remove P224 curve
Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I49fad7ede202de4e3c710bf4aa1df195a310b037
2023-04-11 07:05:38 +02:00
Dominik Ermel bd0d94ce4b espressif: Add flash_area_get_sector
Commits adds implementation of flash_area_get_sector that
is supposed to replace flash_area_sector_from_off.
The flash_area_get_sector gets additional parameter of flash_area
type, while flash_area_sector_from_off uses hardcoded flash_area.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-14 08:13:20 -06:00
Almir Okato bfdf934e3a espressif: ci: Add new building jobs configs for Espressif chips
Add jobs for testing build ESP32-XX within more features:
Serial Recovery, Multi Image and Multi Boot

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-02-03 18:05:07 -03:00
Michael Grand 5047f032c9 fih: Hardening of fault injection countermeasures
Returned values are now hardcoded. Indeed, while it is not
strictly needed (few return values different from SUCCESS
or FAILURE) complexity added by encoding return values might
cause the software to be vulnerable to fault attacks.

Return type changed from fih_int to fih_ret to make
the whole thing much simpler and therefore more robust
to fault attacks. In addition, its easier to predict
compiler behavior.

Affectation of sentive variables has been hardened using macro
FIH_SET (affectation + check wether write access has been properly
done). FIH_DECLARE() is added to ease the declaration of sentive
variables.

Equality tests fih_eq() and fih_not_eq() are now macros because
inlining produce more complex code (and weaker) than macros.
In addition fih_not_eq is modified to be the negation of fih_eq
which was not the case until now.

when FIH_NOT_EQ is used , FIH_SET(fih_rc, FIH_FAILURE) has been added
in some part of the code.

variable image_mask (bootutil_priv.h) is now volatile because a
double IF test is made on it.

some others parts of the code have been hardenned (eg. loop on images)

Signed-off-by: Michael Grand <m.grand@trustngo.tech>
2023-01-30 09:34:34 -07:00
Almir Okato 78d50b2f07 espressif:ESP32-S3: Fix multiboot APP CPU start
Add missing function for starting the APP CPU when booting the
second image (multi image).

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-01-24 22:56:02 -03:00
Almir Okato 84da51b646 espressif: add downgrade prevention feature
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-12-19 11:02:55 -03:00
Almir Okato fc1eabf6bb boot_serial: espressif: ESP32-S3 serial recovery mode interface
Add the serial adapter for ESP32-S3 for boot recovery and MCUMGR
communication.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-11-11 11:22:00 -03:00
Almir Okato 4099583c12 boot_serial: espressif: ESP32-S2 serial recovery mode interface
Add the serial adapter for ESP32-S2 for boot recovery and MCUMGR
communication.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-11-11 11:22:00 -03:00
Almir Okato 09cca3815a boot_serial: espressif: ESP32-C3 serial recovery mode
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-09-29 11:37:13 -03:00
Almir Okato 707a69d40c boot_serial: espressif: enable erase progressively option on serial recovery
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-09-29 11:37:13 -03:00
Almir Okato 0dcdbab886 boot_serial: espressif: split serial adapter implementation for each chip
This commit also fixes array access on serial console read.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-09-29 11:37:13 -03:00
Almir Okato e8cbc0d0f1 boot_serial: espressif: ESP32 serial recovery mode interface
Add the serial adapter for ESP32 for boot recovery and MCUMGR
communication.

Signed-off-by: Almir Okato <almir.okato@espressif.com>

espressif: Configure console via bootloader_support functions

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2022-07-19 11:07:04 -03:00
Gustavo Henrique Nihei 1eb3ecaeda espressif: Fix flash_area_write support for unaligned write accesses
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-07-19 11:07:04 -03:00
Almir Okato c4b305863a espressif:esp32: Move app entry point call back to iram_loader_seg region
Entry point call was moved back from main to esp_loader, so it is
called from iram_loader_seg memory region

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-05-11 07:57:27 -03:00
Almir Okato fa173df366 espressif: Add warning for unsupported chip revision
Added checking and warning for ESP32, ESP32-S2, ESP32-C3, ESP32-S3
unsupported chip revisions on their initialization.

Made respectively changes for build system and documentation.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-05-09 15:55:23 -03:00
Almir Okato 1dc71368b2 espressif: grouping common functions for esp chips init functions
Grouped common bootloader init functions among esp32, esp32s2,
esp32c3 and esp32s3 into common files.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-05-09 15:55:23 -03:00
Almir Okato a1d641d59e espressif:esp32: Add multi image support
Changes on configuration and flash area organization for supporting
multi image and implementation for booting on different processors
on esp32

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-03-16 03:58:01 -03:00
Almir Okato b365e234a3 espressif: add missing information for secure features
Add instructions on the readme-espressif.md on how to encrypt
data on the host.
Also add configuration and instructions for disabling/switch
UART ROM Download Mode.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-03-14 11:19:31 -03:00
Almir Okato 42e679d60a espressif:esp32s3: Add esp32s3 initial support
ESP32-S3 target and related files added to the Espressif port.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2022-01-26 20:52:04 -03:00
Almir Okato 14763b1cd2 espressif: ESP32, ESP32S2 and ESP32C3 native flash encryption
Native flash encryption was added as option for Espressif chips and
added to the initialization process before MCUboot workflow.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2021-12-28 10:51:54 -03:00
Gustavo Henrique Nihei 818964d513 espressif: Use "TAG" field from SOC_LOG* macros from IDF libraries
This also removes the need for passing "-Wno-unused-variable" compiler
flag, since now TAG is being used as part of the log message.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-22 10:54:52 -03:00
Gustavo Henrique Nihei 67b73d3c79 espressif: Add CI jobs for Secure boot enabled images
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-20 09:20:14 -03:00
Gustavo Henrique Nihei a3495105af espressif: Fix support for signing algorithms
The build system previously restricted the usage of some signing
algorithms due to build issues.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-20 09:20:14 -03:00
Gustavo Henrique Nihei 4aa286d2db flash_map: Increase minimum supported write align via flash_area_align
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-16 13:19:12 -07:00
Gustavo Henrique Nihei 3ee626f36e espressif: Fix ESP32-C3 support for booting signed apps
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-09 13:15:45 -03:00
Gustavo Henrique Nihei 523ef3fc2f espressif: Add support for hardware Secure Boot
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-09 13:15:45 -03:00
Gustavo Henrique Nihei ce3668fd60 espressif: Use "TAG" field from ESP_LOG* macros from IDF libraries
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-09 13:15:45 -03:00
Gustavo Henrique Nihei 6a6b8915a8 espressif: Bump IDF version to v4.4
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-12-09 13:15:45 -03:00
Gustavo Henrique Nihei d985d22abe espressif: Use BOOT_LOG_* macros instead of the MCUBOOT_LOG_*
Also refined the include directives, by removing unused headers and
making the usage of brackets and quotes a bit more coherent,

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-11-14 10:26:55 -03:00
Gustavo Henrique Nihei 33a3831b13 espressif: Remove write alignment handling
Write operations are always expected to be aligned according to the port
configuration.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-11-05 15:23:42 -06:00
Gustavo Henrique Nihei 74a2742c3d espressif: Fix flash_area_read support for unaligned accesses
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-11-05 15:23:42 -06:00
Gustavo Henrique Nihei 72627c5029 espressif: Allow use of imgtool other than the one from repository
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-11-04 06:15:47 -03:00
Almir Okato eb6b7bf3eb espressif: Enable signature verification (RSA, EC256 and ED25519)
MbedTLS and Tinycrypt security lib options added to Espressif's
configuration and build.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2021-10-07 18:30:20 -03:00
Almir Okato 712fdb5ad0 espressif: Add ESP32-C3 initial basic support
ESP32-C3 target added to the Espressif port, CMakeLists, and
added related files to ESP32-C3 target directory as well.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2021-09-23 20:28:07 -03:00