Commit Graph

2160 Commits

Author SHA1 Message Date
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
Jamie McCrae fc658eb5a2 docs: release: Add note on encryption changes
Adds notes on fixes and changes related to encrypted image handling

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-09 07:45:22 +01:00
Jamie McCrae c9fa60886b boot: boot_serial: Fix issue with encrypted second slot images
Fixes issues whereby encrypted images were not properly listed due
to not treating them as encrypted, also removes a piece of wrong
hack code that would never run as the primary slot cannot be
encrypted.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-09 07:45:22 +01:00
Jamie McCrae 25d2f2cfe0 zephyr: encryption: Improve Kconfig and key generation
Improves the Kconfig layout for encrypted image support and allows
using key files instead of just using a pre-defined, insecure dummy
key.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-09 07:45:22 +01:00
Bence Balogh 70acc4146e release-notes: Add imgtool changes
Signed-off-by: Bence Balogh <bence.balogh@arm.com>
Change-Id: I48eabb1dc9696ef50d12fc8782616169ba8acc45
2023-08-08 18:09:07 +02:00
Bence Balogh 97a20f1286 imgtool: Add public key's SHA256 hash calculation
Signed-off-by: Dávid Házi <david.hazi@arm.com>
Signed-off-by: Bence Balogh <bence.balogh@arm.com>
Change-Id: I91d5c07c1bb2b8abe2592cd49b2053c881465ba2
2023-08-08 18:09:07 +02:00
Bence Balogh ed8d68aff7 imgtool: Add raw output option
Signed-off-by: Dávid Házi <david.hazi@arm.com>
Signed-off-by: Bence Balogh <bence.balogh@arm.com>
Change-Id: Ia7f385e5e1b0471aae7693baa54e9a385ad3ae3f
2023-08-08 18:09:07 +02:00
Bence Balogh 367aefbede imgtool: Add write to file option
Signed-off-by: Dávid Házi <david.hazi@arm.com>
Signed-off-by: Bence Balogh <bence.balogh@arm.com>
Change-Id: I6028955be5cbcd20d49ef2126dce8d4636b824a6
2023-08-08 18:09:07 +02:00
Michael Grand 99613c672f bootutil: fix downgrade prevention
Downgrade prevention check moved to secure both TEST
and PERMANENT upgrade modes. Downgrade can still be
performed during REVERT.

Signed-off-by: Michael Grand <m.grand@trustngo.tech>
2023-08-08 09:02:39 +01:00
Jamie McCrae 88b2865730 doc: design: Add updated information on data sharing
Adds additional information on the new BOOTINFO data sharing
functionality

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-08 08:02:25 +01:00
Jamie McCrae 97d18797a1 docs: Add note on addition of new shared boot info
Adds a note that there is now additional information that can
(optionally) be provided via shared boot information.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-08 08:02:25 +01:00
Jamie McCrae 5b1d5116a9 boot: bootutil: Add optional boot info shared data saving
Adds the ability to share MCUboot configuration with
applications via shared memory.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-08 08:02:25 +01:00
Jamie McCrae ea88860904 bootutil: Add bootloader info TLV entries
Adds TLV defines for use with the bootloader shared data
feature.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-08 08:02:25 +01:00
Jamie McCrae 3016d00cd7 bootutil: Add active slot number and max app size to shared data
This allows the currently executing slot number to be checked by
the external function, which can be used by XIP images to know
which slot is currently being executed from to allow for correct
uploading/positioning of firmware files, and also provides the
maximum size of an upgrade that can be loaded so that applications
can reject images that are too large.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-08-08 08:02:25 +01:00
Dominik Ermel 0540d0fb3f bootutil: Fix for flash_area_id_to_image
The function was incorrectly identifying partition of secondary slot
of image 0 as belonging to image 1, at the same time failing to
identify partition of primary slot of image 1.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-08-07 14:35:39 +02:00
Dominik Ermel f17b005ca1 bootutil: Fix boot_set_next passing wrong image number
The commit fixes boot_set_next always passing image 0 to
boot_write_swap_info, instead of the proper image number.
This has been affecting applications that tried to call boot_set_next
in multi-image MCUboot configuration using scratch-swap algorithm.

Fixes #1762

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-08-04 16:17:38 +02:00
Daniel Mangum fefc398cc1 fix: update zephyr CONFIG_BOOTLOADER_MCUBOOT
Updates the zephyr CONFIG_BOOTLOADER_MCUBOOT documentation link to
target the new location.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2023-08-03 07:46:53 +01:00
Michal Lenc aa7e2b1faa nuttx: switch to flash_area_get_sector
Function flash_area_sector_from_off is replaced with newly used
flash_area_get_sector to cope with calls in bootutil_misc.c file.

This is required for CONFIG_MCUBOOT_SWAP_USING_MOVE to work correctly.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-08-02 11:28:34 +02:00
Jamie McCrae 61898dad92 boot: boot_serial: Add updated SMP header
Adds missing fields which were wrongly treated as part of the
operation value, which they were not, and adds a big/little
endian check.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-31 08:32:50 +01:00
Marcin Niestroj 36ae4fdabf boot: zephyr: split esp32 to esp32_devkitc_{wroom,wrover}
This is a follow-up on upstream Zephyr split from `esp32` to distinct
esp32_devkitc_wroom and esp32_devkitc_wrover (see [1] and [2]).

[1] https://github.com/zephyrproject-rtos/zephyr/pull/58454
[2] 3776402f40

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2023-07-29 09:54:47 -03:00
Jamie McCrae 2c86755278 boot: zephyr: Fix indication LED not selecting GPIO
Makes indication LED Kconfig select GPIO so that it can work.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-27 16:35:01 +01:00
Michal Gorecki 5404130e20 boot_serial: Fix build for 64-bit architectures
Typecasting pointer variables to uint32_t
instead of uintptr_t was causing build error
on 64-bit architecture.

This is useful, because I am currently working
on implementing support for 64-bit native target
in Apache Mynewt. There is unit test for boot_serial
and it cannot be compiled without this changes.

Signed-off-by: Michal Gorecki <michal.gorecki@codecoup.pl>
2023-07-26 13:16:21 +01:00
Jamie McCrae 76d19b3b88 boot: bootutil: Fix missing packed attributes, add hash size define
Fixes an issue with missing packed attributes on image.h's
structures which would lead to faults on some devices e.g. ARM
Cortex M0, and adds a define for the SHA256 hash size.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-25 09:10:14 +01: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 879348be07 docs: espressif: update documentation after ESP-IDF submodule removal
Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-07-24 10:03:18 -03:00
Almir Okato b91485a387 ci: espressif: update CI after the IDF submodule remove
Update the script for cloning and installing Espressif IDF needed
for building MCUboot Espressif's port on CI.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
2023-07-24 10:03:18 -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
Roland Mikhel 018b77032c imgtool: Fix getpriv error return with private key
This commit fixes a bug with the getpriv command using
ECDSA keys.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I66c1365a855e97199921ac136a18e26988bce508
2023-07-24 09:33:50 +02:00
Jamie McCrae 9fad4c1f16 boot: boot_serial: Fix wrong cbor type for confirm
Fixes the wrong variable type being used for the confirm element.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-20 17:00:09 +01:00
Jerzy Kasenberg 52cac94c0e mynewt: Make sysinit() call configurable
In same cases (loging, hash, crypto) main function called
newt tool generated sysinit() function to create
uart device and crypto.

Now user can specify that sysinit should be called for
other cases if needed. This can be useful if some other
package should be included in the build and it has
package initialization function.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-07-17 19:39:05 -03:00
Jerzy Kasenberg 8581168331 boot: mynewt: Respect minimum write size
For MCUs with restriction on minimum write size (STM32H7)
unaligned writes resulted in flash write errors preventing
any sort of update.

Now MCUBOOT_BOOT_MAX_ALIGN can be set accordingly to value
that flash driver uses.
For alignment <= 8 default value provided by mcuboot config
is still used.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-07-17 19:38:11 -03:00
Jerzy Kasenberg 7abfe4fa51 boot: mynewt: Add build version comparison
For downgrade prevention it's possible to use build number
for grater control.
So far only Zephyr has this option in Kconfig now
option is also available in mynewt.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-07-17 19:37:22 -03:00
Jerzy Kasenberg e486b533c1 boot: mynewt: add support for the mcumgr echo command in serial boot mode
This allows user to enable echo for mcumgr command in serial boot.
Code was enabled in zephyr only so far.
Now mynewt build can also have this feature if enabled.

No code changes just option in mynewt build to enable existing
mcuboot feature.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2023-07-17 19:36:07 -03:00
Michal Lenc daabd6a8db nuttx: add support for swap without scratch area
Definition of MCUBOOT_SWAP_USING_MOVE in case swap without scratch area
is configured in NuttX was missing from mcuboot_config.h file.

Also necessary function flash_area_sector_from_off() is defined and
declared in order to support swap without scratch.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-07-08 08:02:31 -03:00
Piotr Dymacz 6a8746d7ac boot_serial: fix image number handle in image upload request
According to the SMP protocol documentation [1], 'image number' value
in 'image upload request' is optional and can be included only in packet
with 'off' (data offset) set to '0' (first packet in upload request).

In one of recent changes (commit 'cb07e888691d'), initialization of the
'img_num' variable was removed which, in extreme case (no image number
provided in upload request), results in use of its uninitialized value
in flash_area_open() call which then might lead to request abort.

This fixes above regression and also makes MCUboot implementation of the
'image upload request' aligned with Zephyr documentation of the protocol
by considering image number only from first (off == 0) 'image upload
request' SMP packet. In addition, 'image number' value is set to '0' if
the request doesn't provide this field.

[1] docs.zephyrproject.org/latest/services/device_mgmt/smp_groups/smp_group_1.html

Fixes: cb07e88869 ("boot_serial: Replace cbor auto-generated code with zcbor functions")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-07-05 16:59:19 -06:00
Piotr Dymacz f2cb55027c boot_serial: fix misuse of 'matched' param from zcbor_map_decode_bulk()
The 'matched' param in zcbor_map_decode_bulk() function is 'pointer to
the counter of matched keys', not length of payload buffer.

Fixes: fac2cabe98 ("boot_serial: Add image state set/get")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2023-07-05 16:58:09 -06:00
Jamie McCrae 82feb9a4c5 boot_serial: Fix showing images that are not valid
Fixes an issue which was introduced in commit
fac2cabe98 which would show all
images, including those with invalid headers in the output of
images being listed.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-07-05 16:57:12 -06:00
Roland Mikhel 23fdb0d20b sim: Revert changes to cap values
This commits reverts the changes made to cap values in 75c7c31.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: Ibbbf66e89d059ef4e4b45218a8a39778c849f21b
2023-06-30 18:02:20 +02:00
Roland Mikhel c5c2b4d7a7 bootutil: Revert changes to cap values
This commit reverts the changes to the cap values made in 206b914.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: Ie47c3f253409932b960f4fc12e3b722b000b3093
2023-06-30 18:02:20 +02:00
Roland Mikhel 7ecffd4e26 ci: Add new variations for ram-load
Adds new test combinations to the CI to
test the ram-load feature more thoroughly.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I56d6f74af55ed078947c092726160b123d36f67f
2023-06-29 13:21:30 +02:00
Roland Mikhel 6945bb6cb4 sim: Add new ram-load test cases
Adds new test cases to various ram-load related logic.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I3a0ca951b2c720be4e6fe2ed0e5d1830fcfb240c
2023-06-29 13:21:30 +02:00
Roland Mikhel 820e9ccef5 sim: fix encryption for ram-load related tests
If ram-load is being used with encryption and
the higher version image is loaded from the primary slot the
verification will fail as the image is always non-encrypted
and will produce an invalid hash. This fix puts encrypted images
into both slots to prevent this issue.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: I4ac9f332434a95d140c5572096b8a9161db2d217
2023-06-29 13:21:30 +02:00
Matthew Dalzell 34d5a6915f Tests: Enable psa-crypto-api feature
This patch enables psa-crypto-api feature

Signed-off-by: Matthew Dalzell <matthew.dalzell@arm.com>
Signed-off-by: Antonio de Angelis <Antonio.deAngelis@arm.com>
2023-06-28 15:24:06 +02:00
Antonio de Angelis 65eb35c2c7 sim: Initialize PSA Crypto subsystem based on psa-crypto-api feature
If the psa-crypto-api feature is defined, the simulator will
initialize the PSA Crypto API exactly once. It needs also to
enable the test external RNG as the assumption is that the
PSA subsystem is configured to use MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG

Signed-off-by: David Brown <david.brown@linaro.org>
Signed-off-by: Antonio de Angelis <Antonio.deAngelis@arm.com>
Signed-off-by: Matthew Dalzell <matthew.dalzell@arm.com>
Change-Id: Id02727b8673867ecf1e4fbbdfa3c4b6d6f98f8df
2023-06-28 15:24:06 +02:00
Roland Mikhel 9a82ecae5c ci: add test case for hw-rollback-protection
Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: If636d9179c6f06d4bf7452b8eb4f07d3829cf2d7
2023-06-27 14:42:34 +02:00