Commit Graph

1762 Commits

Author SHA1 Message Date
Philip Colmer 2a22bcc4c7 Delete CNAME 2021-06-28 07:48:14 +01:00
David Brown 8abacc834b workflow: Back off stale bot a bit
Change the stale bot to 180 days before initial flag.  In addition,
avoid issues entirely that have the 'someday' label applied.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-06-25 12:53:49 -06:00
Carlos Falgueras García ae13c3c183 bootutil: Fix some misspelling variables
There are a couple of misspelled variables (slot -> active_slot).

fix #1028

Signed-off-by: Carlos Falgueras García <carlos.falgueras@wslw.es>
2021-06-25 11:34:36 -06:00
Carlos Falgueras García afb424dd49 bootutil: Fix bug defining slot_usage_t structure
There is a missing semicolon.

Signed-off-by: Carlos Falgueras García <carlos.falgueras@wslw.es>
2021-06-23 16:24:14 +02:00
Andrzej Puzdrowski aea38eb03a boot/boot_serial: call idle for reducing power in single thread
Sine zephyr https://github.com/zephyrproject-rtos/zephyr/pull/34279
was merged there is no silent idle thread created automatically while
CONFIG_MULTITHREADING=n. Since that any single thread application
needs to call k_cpu_idle() (wrapped by MCUBOOT_CPU_IDLE)
by itself for entering idle mode, which allows for reduction
power consumption.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-06-17 12:42:21 +02:00
Andrzej Puzdrowski 142b339667 boot: introduce MCUBOOT_CPU_IDLE() for support low power single thread
Introduced MCUBOOT_CPU_IDLE() macro.
If a port supports single thread or is bare-metal then might be need
to switch to idle mode explicitly form MCUboot code.
The call allows to enable lower power consumption while waiting for
incoming transmission in serial recovery etc.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-06-17 12:42:21 +02:00
Mariusz Poslinski d5e9902352 zephyr: Fix for issue with path length on windows
Switch to use zephyr_library_named() which creates a shorter library name.

Signed-off-by: Mariusz Poslinski <mariusz.poslinski@nordicsemi.no>
2021-06-16 14:21:26 +02:00
Flavio Ceolin 5442658d32 zephyr: Replace deprecated build option
CONFIG_SYS_POWER_MANAGEMENT is a deprecated option that was replaced
by CONFIG_PM.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-06-11 14:22:40 +02:00
Philip Colmer 339d9c4a5c Create CNAME 2021-06-10 11:30:15 +01:00
Philip Colmer cd394ff65d Delete CNAME 2021-06-10 10:52:07 +01:00
Andrzej Puzdrowski 680ed07e42 zephyr: allow to build nRF52840 targets in zephyr-rtos CI
MCUboot was build only for frdm_k64f in zephyr CI.
Extended Zephyr-RTOS integration platform by nrf52840dk_nrf52840
and nrf52840dongle_nrf52840 which allow to build MCUBoot on
these platform in Zephyr-RTOS CI.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-06-09 15:41:04 +02:00
David Brown 77234107cd Create template code of conduct
Incorporate the [Contributor Covenant](https://www.contributor-covenant.org/)
used by a large number of open source communities.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-06-08 10:14:29 -06:00
Dominik Ermel 51c8d761f6 bootutil: Reduce boot_initialize_area variants
The commit removes implementation of boot_initialize_area
specific for flash_area_to_sectors, and applies changes to
the flash_area_get_sectors using variant, to make it
alternatively work with flash_area_to_sectors.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-06-08 07:39:01 -03:00
Dominik Ermel 7d7472343a bootutil: Use uin32_t instead of size_t to count sectors
The change aligns type of "sector counter" to the type
used for *cnt parameter of flash_area_get_sectors.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-06-08 07:39:01 -03:00
Mark Horvath ccaf7f8814 boot: Multi-image boot for direct-xip and ram-load
Multiple image boot support is implemented for direct-xip and ram-load
strategies. Dependency checking is also added, and for ram-load more
executable ram regions can be set.
Wrapper functions are intoduced to all boot strategies.

Change-Id: I59b346277dcb2c17cef4800f1e556b4ea9144845
Signed-off-by: Mark Horvath <mark.horvath@arm.com>
2021-06-08 07:37:43 -03:00
Håkon Øye Amundsen f04aa54409 kconfig: add BOOT_SERIAL_DETECT pin for nrf52833DK
Add missing config for the nRF52833

Ref: NCSIDB-421

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2021-06-07 11:06:19 +02:00
Dominik Ermel 29aed1d8bd bootutil: Application of boot_read_swap_state
The commit reorganizes logic of the boot_swap_sectors and
the boot_set_pending_multi to use the boot_read_swap_state,
instead of previously used boot_read_swap_state_by_id, to utilize
the flash area object the functions area obtaining.

It also fixes double a flash_area_open that happened implicitly within
the boot_swap_sectors, as it has been calling boot_read_swap_state_by_id
on the FLASH_AREA_IMAGE_SCRATCH, after it has already opened the area.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-05-30 08:14:04 -03:00
Dominik Ermel 0ab87b617a bootutil: Remove area ID parameter from fixup_revert
The fixup_revert has been switched to use boot_read_swap_state,
from boot_read_swap_state_by_id, and no longer needs the ID
parameter.  It can now get swap state information by flash_area
object pointer, which is provided as 3rd parameter.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-05-30 08:14:04 -03:00
Dominik Ermel 8115998cb5 bootutil_public: Make boot_read_swap_state declaration public
The function itself is not static within bootutil and may be used
to operate on flash areas, for which the flash_area object has
already been obtained.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-05-30 08:14:04 -03:00
Øyvind Rønningstad 9f4aefd539 boot_serial: Port encoding to use cddl-gen
Non-generated. Using cbor_encode directly
This removes the dependence on TinyCBOR.

Fixes #978

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2021-05-25 11:52:38 -03:00
Øyvind Rønningstad 212a35bc01 boot_serial: Update cddl-gen
Update and rename submodule.
Regenerate code and copy updated files.
Update regeneration script.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2021-05-25 11:52:38 -03:00
Carles Cufi 55918edc66 zephyr: serial: Remove unnecessary call to irq_unlock
The following commit in Zephyr removed the need to unlock interrupts
when booting in single-threaded mode:
3b89cf173b

Remove the now obsolete lines.

Fixes #302.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-05-20 16:20:49 +02:00
David Brown 434bca4fe3 github: Add workflow to mark stale issues
This workflow will add a 'stale' label to any issues that haven't been
modified in 60 days, and then after an additional 14 days, will close
the issue.

The template was copied from Zephyr.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-05-19 14:47:41 -06:00
dependabot[bot] f2ac70db18 build(deps): bump nokogiri from 1.11.2 to 1.11.4 in /docs
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.11.2 to 1.11.4.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.11.2...v1.11.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-19 07:16:47 -03:00
Salome Thirot 7084b2ff9c Workflow: enable AES256 image encryption tests
Signed-off-by: Salome Thirot <salome.thirot@arm.com>
2021-05-18 07:25:12 -03:00
Salome Thirot 6fdbf55756 Sim: Add testcases for AES256 image encryption
Signed-off-by: Salome Thirot <salome.thirot@arm.com>
2021-05-18 07:25:12 -03:00
Salome Thirot 0f64197aff boot: Add AES256 support for image encryption
Support only works when using mbedtls as the cryptographic library.

Signed-off-by: Salome Thirot <salome.thirot@arm.com>
2021-05-18 07:25:12 -03:00
Andrzej Puzdrowski 9b97456eb2 zephyr/main: allow to build when CONFIG_MULTITHREADING=n
K_sleep() is not available when multithreading is disabled.
Let's use k_busy_wait() in that case.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-05-17 15:43:12 +02:00
Andrzej Puzdrowski 0cf0dbdd9c boot_serial: allow to build when CONFIG_MULTITHREADING=n
For zephyr-rtos:
K_sleep() is not available when multithreading is disabled.
Let's use k_busy_wait() in that case.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-05-17 15:43:12 +02:00
George Beckstein d4d90f8eea Fix version comparison result causing boot failure
The variable `rc` is used in `context_boot_go` for a number of operations, mostly checking return codes for an error. It is also used to store the result of comparing the installed application version numbers (using `boot_version_cmp`).

At the end of `context_boot_go`, `rc` is returned as the result of the operation.

In some configurations, namely direct XIP (without revert or any other extra boot checks), it is possible for the comparison result to be the last value of `rc`. In most cases, this will cause `context_boot_go` to report a failure (ie: non-zero return code), as the value of `rc` will be 1 or -1 if the installed applications aren't the same version.

This commit resets the value of `rc` to 0 after the version comparison has taken place.

Fixes #976

Signed-off-by: George Beckstein <george.beckstein@gmail.com>
2021-05-14 14:57:17 -06:00
David Brown fe0bfcfba9 Migrate master->main
Change references in CI and docs from 'master' to 'main' as the primary
branch has been renamed.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-05-14 14:56:39 -06:00
Andrzej Puzdrowski 137d797177 sim: emits *_SWAP_USING_SCRATCH macros
Emits either MCUBOOT_SWAP_USING_SCRATCH and
CONFIG_BOOT_SWAP_USING_SCRATCH when swap using scratch
algorithm is expected.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-05-14 14:19:56 +02:00
Andrzej Puzdrowski c49d7c9398 zephyr: allow to not defined scratch area in upgrade-only mode
Scratch area is unneeded if CONFIG_BOOT_SWAP_USING_SCRATCH=n.
This was not reflected so fare which causes build faliure.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-05-14 14:19:56 +02:00
Andrzej Puzdrowski 414f915518 boot: Don't examine scratch in BOOT_UPGRADE_ONLY mode
During fetching of swap-status scratch was examined unnecessary
in swap_status_source(). Scratch area shouldn't be needed in this mode.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-05-14 14:19:56 +02:00
Sherry Zhang fbeef9b944 bootutil_public.c: add two user APIs
Add boot_set_pending_multi() and boot_set_confirmed_multi() APIs so
that the user can set the image with given index as pending, confirmed.

Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Change-Id: Ifca04d396b38c6c64581703794071f6b42e9dfbf
2021-05-14 06:51:38 -03:00
George Beckstein a80e7c6715 Enable no signature verification configuration for Mbed-OS.
This commit introduces changes to allow the Mbed-OS port to disable use of signature verification. Previously this was not possible even though it is a valid mcuboot configuration.

Signed-off-by: George Beckstein <george.beckstein@gmail.com>
2021-05-12 13:30:06 -06:00
Bora Özgen 66f02e30b0 Mbed: Remove unused header size config
Signed-off-by: Bora Özgen <oezgen@nantis.de>
2021-05-08 07:13:09 -03:00
Jamie McCrae 10a8112089 zephyr: add Laird Connectivity BL5340 recovery pin
Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-05-07 12:20:47 -03:00
Andrzej Puzdrowski 22b856beea bootutil_public: allow to confirm padded image without copy-done flag
This patch is for fixing:
https://github.com/zephyrproject-rtos/zephyr/issues/34683

copy-done flag is used to design completely copied image.
It is used to recognize whether need to complete image upgrade.
If image is running then:
1) it was already verified and copied by MCUboot
   copy-done flag is set for sure.
2) or it was programmed directly using programming interface

For case 2) when image contains magic but not copy-done flag it was
impossible to confirm it. This patch removes needs of having copy-done
flag set while confirming. This make API behavior similar to situation
when the not-padded image was programmed.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-05-07 13:53:00 +02:00
Fabio Utzig c932b32ab0 workflows: enable Mbed TLS based EC backend tests
Enable sig-ecdsa-mbedtls and enc-ec256-mbedtls simulator tests.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2021-05-06 21:05:47 -03:00
Fabio Utzig 6c553d6741 sim: add Mbed TLS EC256 encrypted image support
Add new feature that allows testing EC256 encrypted images using the
Mbed TLS backend.

Move config-ecdsa.h to config-ec.h because definitions are very similar
between ECDSA and ECDH with Mbed TLS so resort to a single config file.

Add new feature and fix the build; add proper Mbed TLS memory
initialization when enc-ec256-mbedtls is used.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2021-05-06 21:05:47 -03:00
Fabio Utzig 74c3bab496 crypto: ecdh: define NUM_ECC_BYTES for Mbed TLS
This is a define from Tinycrypt that was being used in the Mbed TLS
EC256 encrypted images implementation so properly define it.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2021-05-06 21:05:47 -03:00
Maureen Helm b6d75e765f boot: zephyr: Configure mimxrt106x_evk boards
The mimxrt1060_evk and mimxrt1064_evk boards have large slots so we need
to increase CONFIG_BOOT_MAX_IMG_SECTORS from the default.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-05-06 06:53:26 -03:00
Philip Colmer aad01efd58 Create CNAME 2021-05-04 15:47:49 +01:00
dependabot[bot] 000ef72ac4 build(deps): bump rexml from 3.2.4 to 3.2.5 in /docs
Bumps [rexml](https://github.com/ruby/rexml) from 3.2.4 to 3.2.5.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.2.4...v3.2.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-04 07:36:10 -06:00
David Brown 208db88779 Delete CNAME 2021-05-04 01:23:13 -06:00
David Brown d23214eb05 Create CNAME 2021-05-04 01:22:29 -06:00
Gerard Marull-Paretas e20e092b7c boot: boot_serial: use new Zephyr reboot header
Use the new header used for sys_reboot on Zephyr.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-29 12:01:35 +02:00
Nico Lastzka e16f52c033 cmake: fix evaluation with empty signature key file
When CONFIG_BOOT_SIGNATURE_KEY_FILE is left empty, the cmake find command gets
called with a wrong number of arguments. This patch skips the search for the
signature key file within config files in that case.

Signed-off-by: Nico Lastzka <Nico.Lastzka@ATSonline.de>
2021-04-20 12:54:02 +02:00
David Brown cdee0b7885 docs: Upgrade doc generating dependencies
Addresses CVE-2021-28834
https://github.com/advisories/GHSA-52p9-v744-mwjj

Also removed the explicit jekyll dependency, which according to the
instructions should be commented out if the github-pages dependency is
used.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-04-13 08:45:11 -03:00