Commit Graph

1133 Commits

Author SHA1 Message Date
Fabio Utzig 9a2b5de5d4 sim: derive Default for TlvGen
Avoid having to declare default values in type instantiation.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-22 13:57:27 -03:00
Fabio Utzig 23e99b0d7e boot: encrypted: fix HKDF input size macro
Use correct macro for the size of a DH shared secret. The previously
used macro had the same size (SHA-256 digest length) but incorrect
semantics.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-22 13:56:18 -03:00
David Brown 005e7a0ff3 travis: Add large-write to all overwrite-only tests
Add the large-write feature to all of the tests that test
overwrite-only.  This verifies that these large writes will work in all
of these configurations.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-11-18 10:48:11 -07:00
David Brown 95de450b64 sim: Add test support for large write alignment
To start adding support for devices with a large write size, modify the
simulator to allow a 'large-write' feature that will also run tests with
128 and 512 byte write alignments.

This requires fixing some places in image generation that assumed a
fairly small alignment (namely, padding the buffer at the end, rather
than individual parts), and detecting the large writes when writing the
MAGIC value to the image.

The flash API still passes the alignment back as a uint_8, but in
overwrite mode, this verifies that the boot code won't use this value.

Currently the 'large-write' feature requires 'overwrite-only' as well.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-11-18 10:48:11 -07:00
David Brown eecae52af8 sim: Don't mark permanent in overwrite mode
Overwrite mode is always a permanent upgrade, so skip trying to mark
this in the images.  This marking is problematic with larger write
alignments.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-11-18 10:48:11 -07:00
David Brown 347dc5726d sim: Remove Option from MAGIC
This constant array is always just unwrapped.  Remove the Option from
its type, and just make it an array.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-11-18 10:48:11 -07:00
David Brown 5a317752fb sim: Use `usize` instead of `u8` for alignment
Some devices have a write alignment larger than 128.  Allow this within
the simulator, by using `usize` instead of `u8` for the write alignment.
The value is still returned to the C code as an 8-bit integer, but this
help start debugging issues found on these devices.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-11-18 10:48:11 -07:00
David Brown ab449187b4 boot: store write align as uint32_t
In overwrite-only mode, the write alignment is not used for much.
Making this a larger value will allow the alignment for a particular
device to be larger than a uint8_t.  This will make the trailer size
very large for these devices (and prevent
!defined(MCUBOOT_OVERWRITE_ONLY) from being used), but at least allows
the overwrite only mode to be used on these devices.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-11-18 10:48:11 -07:00
sigvartmh 477ff5bab0 Bugfix: nRF Cryptocell not being disabled
Copy paste bug in cc310 glue layer for nRF where disable does not set
the enable register to 0. Thanks to @solsbarry for pointing this out.

Fixes: #586

Signed-off-by: sigvartmh <sigvart.m@gmail.com>
2019-11-06 18:35:00 -03:00
Fabio Utzig 8554ed5be6 travis: add sig-ecdsa + enc-ec256 to sim
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig ffc673e7d2 sim: remove deprecated usage of sync::ONCE_INIT
Switch to `Once::new()`.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig 90f449ee5c sim: add testing of ECIES-P256 images
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig cbd58e3f83 sim: cargo: update dependencies
Update ring to latest (`0.16.9`) and update crates (`cargo update`).

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig 73243918cd sim: add EC256 encryption key
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig 5fde832bbf bootutil: add ECIES-P256 support
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig 5ef883a9b9 caps: add ECIES-P256
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig ccc0280dd8 boot: zephyr: tabs -> spaces in CMakeLists.txt
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig 42cc29abfe boot: zephyr: add ECIES-P256 configuration
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig c67dd70423 boot: mynewt: add config for ECIES-P256 encrypted images
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig 7a3b2605ac imgtool: add creation of ECIES-P256 encrypted images
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Fabio Utzig b3f058c0ef docs: describe ECIES-P256 encrypted image support
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-11-06 06:55:25 -03:00
Iosif Macesanu 2d18f2577b boot: zephyr: boards: add Actinius Icarus board
Add Actinius Icarus board configuration to be able to enter serial
recovery mode

Signed-off-by: Iosif Macesanu <iosif@actinius.com>
2019-11-04 14:37:07 +01:00
Ruth Fuchss 4023d62849 docs: add link to encrypted_images.md and cleanup
Add a link to the topic about encrypted images to the start page.
Clean up the existing links to make the table of contents more
consistent.

Signed-off-by: Ruth Fuchss <ruth.fuchss@nordicsemi.no>
2019-11-01 13:10:41 -03:00
Ruth Fuchss 721cdbc49e docs: add missing heading
Add an H1 heading to encrypted_images.md.

Signed-off-by: Ruth Fuchss <ruth.fuchss@nordicsemi.no>
2019-11-01 13:10:41 -03:00
Fabio Utzig f5556c3eba imgtool: fix header padding value check
Commit 9117fded47 added support for
supplying an `--erased-val`, which defaults to 0xff. When padding a
header, the checks were still validating against 0, which is the
value used for padding by the Zephyr build system. Now when the
user passes `--pad-header` this check is skipped (we already know
the contents).

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-31 12:10:31 -03:00
Sam Bristow d0ca0ffc27 Fix up typos
Ran automated checker for common typos [1]. Most of these changes have
no functional change *except* for `./ci/sim_run.sh` where, previously
the `bootstrap` feature wasn't being selected properly.

I didn't touch anything in the `./ext/` folder as anything in there
should probably be fixed in the upstream repo.

[1] https://github.com/codespell-project/codespell

Signed-off-by: Sam Bristow <sam@bristow.nz>
2019-10-30 06:24:10 -03:00
Andy Gross 441e997891 mynewt: Make cflags consistent for if or ifdef usage
This patch changes the cflag entry for MCUBOOT_MYNEWT to make it
consistent when using #if or #ifdef.

Signed-off-by: Andy Gross <andy.gross@juul.com>
2019-10-21 17:22:34 -03:00
Fabio Utzig e47ccd63df mynewt: allow overriding the startup routine
Add a new Mynewt option that allows for overriding the default
`hal_system_start` routine; this allows for startup customizations
required by some BSPs.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-21 17:21:27 -03:00
Fabio Utzig e5ac82797f imgtool: release 1.5.0alpha1
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-17 20:00:47 -03:00
Fabio Utzig 8828280d5d imgtool: fix typo in flag name
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-17 20:00:47 -03:00
Fabio Utzig 2269f47eb4 imgtool: Add complete trailer to HEX images
When generating HEX output, instead of just adding the `magic`, also add
the whole trailer (with erased value). This allows for HEX writing tools
to erase the trailer region, avoiding possible issues when garbage
exists there.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-17 20:00:47 -03:00
Fabio Utzig 9117fded47 imgtool: add erased-val cli option
Add `-R`/`--erased-val` CLI option when creating images, which accepts
a value to be used for padding. This is useful when creating images
that run in devices that have flash erased to some value different
from 0xff (like STM32L0x and STM32L1x that have 0s).

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-17 20:00:47 -03:00
David Brown f5c5dd0d90 Revert version.yml after release
Needed by the MyNewt build/release process.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-17 15:47:38 -06:00
David Brown ac55554059 Prepare for v1.4.0 release
Update release notes and various version stamps.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-17 15:47:38 -06:00
David Brown d7581779d8 Prepare for release v1.4.0-rc2
Update version stamps as well as the release notes.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-15 14:50:09 -06:00
David Brown 9bf95afd43 boot: Check overflow/bounds on image header size
Before using the image and header size fields from the image header,
verify that both of these values are sane.  In this case, sanity means
that there is no arithmetic overflow when they are added, and that the
result is within the bounds of the containing flash region.  This is
done in addition to the check of the header's magic number.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-15 09:41:01 -06:00
David Brown effb06e367 boot: Add overflow-safe 32 and 16-bit add functions
To facility better checking for integer overflow, add these two
functions to add while checking for overflow.  If the result overflows,
they will return an error, instead of performing the addition.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-15 09:41:01 -06:00
Fabio Utzig c7fe3b061e Document imgtool release process
Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-15 12:35:01 -03:00
Fabio Utzig edbabcf623 imgtool: allow address adjustment in output hex
Add a new flag `-x` (or `--hex_addr`) which adjusts the memory address
where this file has to be written to. This is useful when generating
upgrade images that will go to the secondary slot, in cases where the
user is not using mcumgr or some other delivery mechanism, and has to
manually adjust the addresses using `objcopy`.

Also when using hex files, image padding now only adds a segment with
the magic at the end instead of filling the whole output with `0xff`.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-15 12:32:33 -03:00
David Brown 1318938006 Upgrade mbedtls submodule to 2.16.3
Upgrade the referenced mbedtls submodule to 2.16.3, the latest stable
release as of this commit.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-15 09:29:20 -06:00
David Brown f984b95735 Move mbedtls submodule from sim to ext
Move the external mbedtls submodule out of the sim/mcuboot-sys directory
into the ext directory.  This will allow the same copy of mbed TLS to be
used by other board support packages, instead of having to make a
duplicate clone.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-15 09:29:20 -06:00
David Brown b748f6fa2a Rename ext/mbedtls to ext/mbedtls-asn1
The ext/mbedtls directory has a copy of the ASN.1 parser from the mbed
TLS library.  To allow a future change to bring the entire mbed TLS
library in as a submodule under ext, rename this to mbedtls-asn1 to make
it clear this is only a subset.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-15 09:29:20 -06:00
Fabio Utzig 1b7777b476 Fix CVE-2019-16892
https://nvd.nist.gov/vuln/detail/CVE-2019-16892

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-15 12:28:34 -03:00
Fabio Utzig ecbea70ba4 Fix overflow in offset variable
In the TLV iterator code a variable is used to save the offset in flash
where the protected TLVs end; this was declared as uint16_t and could
easily overflow so fix it by updating the type to uint32_t.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-15 12:27:00 -03:00
Fabio Utzig f0131cd5b7 imgtool: add mailing list email to setup
Seems like pypi.org is not accepting "None" for email anymore, so this
just adds the mailing list in case someone needs to contact the project.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2019-10-12 18:47:05 -03:00
Andrzej Puzdrowski f000480409 zephyr/serial_recovery: fix serial device binding
zephyr changes the way in which it provide name of
serial device used by serial recover.
see: https://github.com/zephyrproject-rtos/zephyr/pull/18752

This path introduce build time configuration of device name
which is set to exact the same device which was set before.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-10-11 12:11:59 +02:00
Vipul Rahane 7138e354c1 apps: update dependencies & syscfgs as per mcumgr
- Changing dependencies and syscfgs as per mcumgr changes

Signed-off-by: Vipul Rahane <vrahane@gmail.com>
2019-10-10 18:03:59 -03:00
David Brown 4d0c5fa488 Release notes for 1.4.0-rc1
Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-08 10:45:14 -07:00
David Brown 37b96e7aab docs: Fix formatting of security document
Markdown considers a block of indented text after a list item to be part
of that list item.  Insert a small piece of text at the top level to
prevent that.

Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-08 10:45:14 -07:00
David Brown 0d98a9c2b0 docs: Create initial security policy
Signed-off-by: David Brown <david.brown@linaro.org>
2019-10-08 08:56:53 -07:00