Commit Graph

1154 Commits

Author SHA1 Message Date
Andrzej Puzdrowski fab12e0524 Revert "bootutil: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()"
This reverts commit 6d417c9c84.

The patch was merged accidentally too early.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-03-23 14:23:16 +01:00
Andrzej Puzdrowski 8ecb89bb1c zephyr: board nrf51_pca10028 renamed to nrf51dk_nrf51422
Name of the board is changing in the zephyr-rtos:
https://github.com/zephyrproject-rtos/zephyr/pull/23447

This patch aligns the board name used which is required for suppression
of build warnings.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-03-19 15:02:56 -06:00
Oleg Zhurakivskyy 6d417c9c84 bootutil: Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()
Replace BUILD_ASSERT_MSG() with BUILD_ASSERT()
after merging BUILD_ASSERT() and BUILD_ASSERT_MSG().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-03-19 15:01:24 -06:00
Andrzej Puzdrowski 9a605b69f0 zephyr: add cleanup ARM core before boot
This patch is needed as MCUBoot should be able to chain-load any
application, not only these built using zephyr.

Introduced cleanup on ARM core control register.
Might be required as for instance the application assumes
that it starts with thread mode configured as by default, not
according to zephyr-rtos configuration.

MCUBoot disables interrupt before application chain-load used
basepr register. This Patch introduce additional celenup on
NVIC register.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-03-19 14:51:50 -06:00
Szymon Janc 05dc5ddbff mynewt: Update latest tags in repository.yml
0-latest and 1-latest should point to latest stable release.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2020-03-19 14:42:08 -06:00
David Brown 4878c27c82 imgtool: Remove default padding of ECDSA sigs
Since commit:

    commit a36082664e
    Author: David Brown <david.brown@linaro.org>
    Date:   Thu Dec 12 15:35:31 2019 -0700

        ecdsa: Allow ECDSA signatures to be actual length

MCUboot no longer requires ECDSA signatures to be padded to a fixed
length.  This change makes imgtool, by default, also no longer add this
padding to images.  There is an option `--pad-sig` that can be given to
the sign command to re-instate this padding.  This flag will be needed
to make images that will work with older (pre 1.5.0) versions of
MCUboot.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-03-18 09:05:21 -06:00
David Brown a4c586421a sim: Remove padding from ecdsa signatures
With support for unpadded ecdsa signatures in place, always generate
unpadded signatures within the sim.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-03-18 09:05:21 -06:00
Barry Solomon 0407553a97 loader: Fix dependency check issue related to swap type
Fix for issue #669

Signed-off-by: Barry Solomon <barry.solomon@dexcom.com>
2020-03-18 12:02:00 -03:00
Anthony Liu 04630cea43 fix #675 ECDSA verification fail when padding is added
Signed-off-by: Anthony Liu <antliu@gmail.com>
2020-03-13 17:52:59 +01:00
Dominik Ermel 470e2f3d5b zephyr: Enabling Zephyr/mynewt-core version of tinycbor
Changes needed due to overwrite of Zephyr fork of Tinycbor with
mynewt-core version.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-03-12 15:00:30 +01:00
Henrik Brix Andersen 0ce958e709 imgtool: add option for confirming a padded image
Add imgtool command line option for confirming (setting image_ok =
0x01) in a padded image.

Fixes: #664

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-03-11 11:15:36 -03:00
Håkon Øye Amundsen cdf94c2623 docs: secondary slot magic is unset after update
This description is needed to explain why MCUBoot won't
revert a recently performed update.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-03-10 15:54:18 +01:00
Håkon Øye Amundsen 11d91c34a3 docs: fix incorrect state reference
The TEST is state I and PERM is state II.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-03-10 15:54:18 +01:00
Roman Okhrimenko 4c1c5b0955 Update Readme file with details on HW crypto acceleration
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-03-05 12:32:18 +02:00
Roman Okhrimenko 38aa6c4d23 Add crypto acceleration config file and support in build system
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-03-05 12:32:18 +02:00
Roman Okhrimenko 39adbe37ce Add Cypress hardware crypto acceleration dependencies as submodules
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-03-05 12:32:18 +02:00
Christian Daudt e1960a9c45 Update instructions to point to correct git URL
Updating the URL for git repository in README file to reflect merge
of PSoC62 into mcuboot master.

Signed-off-by: Christian Daudt <christian.daudt@cypress.com>
2020-03-04 21:03:19 -03:00
Roman Okhrimenko 4650f2011b Add debug configurations for ModusToolbox
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-03-04 13:47:49 +02:00
Roman Okhrimenko 89ecdac3b8 Add initial implementation of MCUBoot application for Cypress PSOC6 platform
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-03-04 13:47:49 +02:00
Roman Okhrimenko e981665aa4 Add cypress dependencies as submodules
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-03-04 13:47:49 +02:00
Fabio Utzig e60b12f9c5 sim: fix paths for mbed-cryto
Signed-off-by: Fabio Utzig <utzig@apache.org>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-03-04 13:47:49 +02:00
Fabio Utzig 3cd904a661 Update mbedTLS to 2.19.3
Signed-off-by: Fabio Utzig <utzig@apache.org>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
2020-03-04 13:47:49 +02:00
Erik Johnson 4906375adc loader: Fixed warning about uninitialized rc variable
Might get past the loop without going in at least once.

Signed-off-by: Erik Johnson <erik.johnson@nimbelink.com>
2020-02-28 09:09:34 -03:00
Andrzej Puzdrowski af14853b7c zephyr: configurable log thread stack size
Introduced Kconfig property for configure log processing
thread stack size.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-02-27 10:01:25 +01:00
Andrzej Puzdrowski 8459163f14 zephyr: terminated log processing gently
Added log processing thread gently termination
before chain-load the application.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-02-27 10:01:25 +01:00
Andrzej Puzdrowski 3f092bd313 zephyr: allow recovery over usb cdc-acm with logs enabled
Modified serial_adapter so log are allowed when using USB
CDC ACM serial port emulation.

Added dedicated thread for log processing of the highest application
priority. This allows to transmit all logs without adding k_sleep
anywhere else int the code.

Introduced boot log thread is simpler than the default log threat
which decreases flash footprint by a few dozen bytes.
Added configuration for nrf52840_pca10056 which shows how
to enable looging along with USB - among other, thread log
processing is required.

build command (form zephyr-project root directory)
west build -d build/mcuboot/nrf52840_pca10056 -b nrf52840_pca10056
./bootloader/mcuboot/boot/zephyr/
 -- -DDTC_OVERLAY_FILE=./boards/nrf52840_pca10056_big.overlay
-DOVERLAY_CONFIG=./usb_cdc_acm_log_recovery.conf

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-02-27 10:01:25 +01:00
Andrzej Puzdrowski 9a4946ce9a zephyr: add default LOG and MULTITHREADING values in kconfig
Add Log processing configuration synchronous as default
if multithreading is disabled.

Additionally Kconfig makes MULTITHREADING default
if USB is selected.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-02-27 10:01:25 +01:00
Andrzej Puzdrowski 5d96bd20a9 zephyr: tabs to spaces in line indentation
Uses spaces instead of tabs.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-02-27 10:01:25 +01:00
David Vincze c308413760 bootutil: Introduce HW rollback protection
- Add image security counter verification (read security counter value
  from the image manifest and compare it against the stored/active
  security counter) as an optional part of the image validation process
  to prevent the restoration of older, potentially vulnerable images.
- This feature can be enabled with the MCUBOOT_HW_ROLLBACK_PROT option.
- Add security counter interface to MCUBoot. If HW rollback protection
  is enabled then the platform must provide a mechanism to store and
  read the security counter value in a robust and secure way.

Change-Id: Iee4961c1da5275a98ef17982a65b361370d2a178
Signed-off-by: David Vincze <david.vincze@arm.com>
2020-02-25 23:43:12 +01:00
David Vincze 1a7a6905c5 imgtool: Add security counter to image manifest
Optionally add new security counter TLV to the protected image manifest
and also introduce a new command line option for the imgtool to specify
the value of this counter. The security counter can be used in rollback
protection to compare the new image's security counter against the
active counter value. Its value can be independent from the image
version, but if the 'auto' keyword is passed in the argument list of the
script then it will be generated from the version number (not including
the build number).

The value of the security counter is security critical data. Therefore,
it must be part of the protected TLV area.

Change-Id: I45926d22364d0528164f50fa379abf050bdf65ff
Signed-off-by: David Vincze <david.vincze@arm.com>
2020-02-25 23:43:12 +01:00
Fabio Utzig 19df5c44de mynewt: allow newt to bypass submodule cloning
A recently added `newt` feature allows it to only clone selected git
submodules: https://github.com/apache/mynewt-newt/pull/377. This changes
the MCUBoot repository to remove submodules from the cloning process,
because they are not used by Mynewt.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-25 11:37:15 -03:00
Fabio Utzig 3647ded973 docs: update nokogiri to fix CVE-2020-7595
https://nvd.nist.gov/vuln/detail/CVE-2020-7595

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-25 09:26:02 -03:00
Fabio Utzig a1ed50bb11 mynewt: rollback version.yml
Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-24 11:09:47 +01:00
Fabio Utzig 310af87f61 Update to v1.5.0
Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-19 10:29:01 -03:00
Fabio Utzig 7de8a29672 Preparing for v1.5.0-rc2
Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-17 11:22:32 -03:00
Fabio Utzig 03cce47291 sim: update dependencies
Updates a few sim dependencies, reducing the amount of crates
required for a build; also gets rid of cases of more than one
version required for some crates. Results in depending on 76
crates instead of 89 before the PR.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-14 06:19:51 -03:00
Håkon Øye Amundsen 6fc259511a zephyr: add default pin for serial recovery for nrf53
Prior to this the kconfig would fail because of invalid value for an int

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-02-12 11:30:03 +01:00
David Brown a222bf3b17 README: update mailing list
Update the top-level README.md file to refer to the new mailing list.

Signed-off-by: David Brown <david.brown@linaro.org>
2020-02-10 11:13:27 -07:00
Fabio Utzig ef7fbd7012 Preparing for v1.5.0-rc1
Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-07 15:30:45 -03:00
Fabio Utzig cb0807355c imgtool: fix passing --erased-val with 0xff value
The `--erased-val` (or `-R`) option was doing conversion of base 10, so
the only value that was acceptable was 0. Although not passing this
option would result in the default `0xff` being used, this fixes the
issue by allowing Python to auto-detects the base from string.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-07 14:19:33 -03:00
Fabio Utzig 970840ccf5 docs: fix mailing list URL
Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-06 06:00:28 -03:00
Andrzej Puzdrowski ac1f1fff50 zephyr: enable usb by the application
Since zephyrproject-rtos/zephyr#20375
Need to enable USB by the application.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-02-05 12:49:05 +01:00
Fabio Utzig 34e93a507b boot: zephyr: mynewt: sha-512 from tinycrypt
* Mynewt always uses sha-512 from tinycrypt
* Zephyr can choose either tinycrypt or mbedTLS

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-04 06:09:01 -03:00
Fabio Utzig a1c142d168 Add Tinycrypt based SHA-512 for ED25519
Add option to build ed25519 with tinycrypt; enable tinycrypt based
sha-512 for ed25519 sim tests.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-04 06:09:01 -03:00
Fabio Utzig e4fe4633ff Add sha-512 port of tinycrypt's sha-256
A patch adding sha-512 to upstream tinycrypt was submitted:
https://github.com/intel/tinycrypt/pull/42

While it is not accepted, add the code under a new ext/tinycrypt-sha512
depedency.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2020-02-04 06:09:01 -03:00
Peter Bigot 36e9029ff0 boot: zephyr: move to non-deprecated GPIO flags
GPIO_DIR_IN has been replaced by GPIO_INPUT, GPIO_PUD_PULL_UP by
GPIO_PULL_UP, and gpio_pin_read() by gpio_pin_get_raw().  Update the
code to use the preferred API if it available.  This avoids
deprecation warnings in the build.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-02-03 16:49:14 +01:00
Robert Lubos 1b19d2a198 boot: zephyr: Fix Kconfig inclusion
According to our CI:

Redundant 'source "$(ZEPHYR_BASE)/Kconfig.zephyr" in
'boot/zephyr/Kconfig'. Just do 'source "Kconfig.zephyr"'
instead. The $srctree environment variable already points
to the Zephyr root, and all 'source's are relative to it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-02-03 08:51:56 +01:00
Håkon Øye Amundsen 09be783644 zephyr: use move swap instead of scratch for nRF devices
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2020-01-25 19:40:31 -03:00
Peter Bigot 54c1e3fb6b zephyr: fix driver include paths
Zephyr will soon no longer add the drivers subdirectory of the include
hierarchy to the search path, so references to driver headers must
include the drivers/ prefix.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-25 10:01:42 -03:00
David Brown 2ee5f7f7f2 sim: Test software rollback protection
Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
Signed-off-by: David Brown <david.brown@linaro.org>
2020-01-23 12:47:05 -07:00