Commit Graph

1574 Commits

Author SHA1 Message Date
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
David Brown 986c212ea9 docs: Add links to wikipage on project
Update the main webpage to contain links to the wiki page docs on the
project charter, and the membership page.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-04-02 09:13:59 -06:00
Roman Okhrimenko 579b30c299 cypress: Update docs with new platforms support info
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@infineon.com>
2021-03-25 13:47:01 +02:00
Roman Okhrimenko cc557319f5 cypress: Update core-lib, mob-pdl-cat1 submodules revision
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@infineon.com>
2021-03-25 13:47:01 +02:00
Roman Okhrimenko 4bc2810cb5 cypress: Rework makefiles, reorganise source, add 062_1M and 062_512k support
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@infineon.com>
2021-03-25 13:47:01 +02:00
Dominik Ermel 48281627e1 bootutil: Fix boot_write_trailer write alignment
The commit fixes alignment issue in boot_write_trailer, that would
occur in case when input buffer length would be greater than
alignment parameter of flash.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-03-25 11:40:39 +01:00
Dominik Ermel a7f9e9f530 bootutil: Remove duplicated code from bootutil_misc.c
Duplicated functions, existing in bootutil_public.c have been removed
from bootutil_misc.c.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-03-25 11:40:39 +01:00
Szymon Janc 1de4877237 mynewt: Update repository.yml with latest release
newt tool uses repository.yml from master branch.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-03-24 13:01:48 -03:00
Andrzej Puzdrowski 8bd3081f89 boot/zephyr: cleanup GPIO pin setup
Removed configuration of gpio pin using flags which were
removed for zephyr-project long ago. Also old method of read
the pin value was removed.
No sense to keep that as nowadays MCUboot is also not compatible
with zephyr version which supports these flags and methods.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-23 12:28:25 +01:00
Bohdan Kovalchuk de51807249 Cypress: add encryption with mbedTLS
Signed-off-by: Bohdan Kovalchuk <bohd@cypress.com>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@infineon.com>
2021-03-16 21:38:06 -03:00
Bohdan Kovalchuk 25c7a0f475 Bootutil/Crypto: add encryption with mbedTLS
Signed-off-by: Bohdan Kovalchuk <bohd@cypress.com>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@infineon.com>
2021-03-16 21:38:06 -03:00
Josh Gao 837cf88f35 zephyr: add an option to use GPIO to enable USB DFU.
Devices with a physical reset button might prefer to use it to enter USB
DFU mode, instead of always entering it with a timeout. Extract the
existing CONFIG_BOOT_SERIAL_DETECT detection code and use it to enter
DFU mode when CONFIG_BOOT_USB_DFU_GPIO is enabled.

This commit depends on zephyrproject-rtos/zephyr#30015, which changes
wait_for_usb_dfu from a nullary function that waits for a compile-time
fixed amount of time, to one that takes a timeout.

Signed-off-by: Josh Gao <josh@jmgao.dev>
2021-03-16 12:48:41 -06:00
Roman Okhrimenko 895300103d cypress: Align cypress mbedtls hw accel implementation with bootutil update
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@infineon.com>
2021-03-12 14:17:28 -07:00
Roman Okhrimenko 2f045a252e bootutil: Align mbedtls_ecdsa signature verification with cypress mbedtls hw accel implementation
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@cypress.com>
Signed-off-by: Roman Okhrimenko <roman.okhrimenko@infineon.com>
2021-03-12 14:17:28 -07:00
David Brown 26edaf3d12 sim: Change a match with empty arm to if let
This reads a little easier.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown f66b2050fa sim: Match structure definition better
This padding field is defined as a u8 and a u16.  Clarify the marshaling
code to match instead of just looping over bytes.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown cae9e2a85b sim: Remove extra blank line
Remove an extra blank line from this file.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 173e6caaea sim: Remove elided lifetime
This lifetime can be inferred by the compiler, so remove the explicit
one.  This makes the code a little easier to read.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 80f836d19d sim: Remove complexity from an if
Clippy suggests that having a closure in the condition of an if can be
confusing in regards to code formatting.  Move the conditional outside
of the if into a temp variable.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown d36f6b1c16 sim: Remove extraneous slice reference
Clippy suggests that the reference is unnecessary when making a
comparison.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 599b2db197 sim: Simplify printing blank line
Per clippy, `println!()` should be used instead of `println!("")`.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown fbc8f7c1c1 sim: Directly iterate instead of using an index
From a clippy suggestion, replace an index iterator over a slice, and
directly use a mutable iterator over the slice.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown aec56b2ba9 sim: Combine a split conditional
Instead of nesting ifs, just use the conditional with an and operator.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 8973f5551b sim: Use Option instead of Err<T, ()>
Instead of using an Err type with no meaningful error type, just use an
Option.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 2547c00e1d sim: Use range `contains` when possible
Clippy suggests using a range with `contains` in situations where we
test if a value is within a range.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown c20bbb22e3 sim: Remove useless `return`s
Apply clippy suggestions to directly result in values instead of
returning those values at the end of a function.  Better matches common
Rust style.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 8608c53f6e sim: Clarify condition
Clippy suggests using an if instead of using a map on an option.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 4bbb93d9ce sim: Clarify condition with is_empty()
Clippy suggests `.is_empty()` over `.len() == 0`.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 4dfb33c7c1 sim: Simplify some struct initializers
In rust, if a struct field is initialized with a variable with the same
name as the field, it is redundant to say `field: field` as the
initializer, and just `field` is sufficient.  Fix the instances of this
that clippy suggests.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 7cc4526db6 sim: unsafe cleanup
Cleanup some of the unsafe usage in mcuboot-sys.  In one case, add a
safety comment to the function documentation.  In the other, move the
unsafe to a narrower scope, reducing the number of instances of unsafe
needed.  From clippy suggestions.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown fc8e3c5b69 sim: Implement Default for a few types
Clippy suggests implementing Default when the `new` function for that
type just initializes the type to default values.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 50b5a12c31 sim: Remove pointless use lines
Top-level crates are available by name.  A use of these names is
redundant, so remove these.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 1997f539f7 sim: Remove extraneous static
According to clippy, `&'static` can just be `&` for static definitions,
which always have a static lifetime.  Clean this up in the arrays in the
code, as well as generation code in imgtool.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
David Brown 91de33d9f7 ptest: Some simple cleanups from clippy
Run the clippy Rust linter, and apply the simple cleanups it suggests.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-03-11 07:25:43 -07:00
Dominik Ermel 5b7ed6a831 boot: zephyr: Fix compilation warnings with ZEPHYR_LOG_MODE_MINIMAL
The commit fixes definition and usage of ZEPHYR_LOG_MODE_MINIMAL
to prevent compilation warnings on possibly non-portable code.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-03-01 09:32:15 +01:00
David Brown d602ed85cf sim: Update Cargo lock file
This incorporates changes both from the dependency changes in simflash,
as well as some minor changes that recent versions of Cargo make.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-02-26 10:13:57 -07:00
David Brown c51949d208 sim: simflash: Convert to thiserror
The thiserror crate seems to be getting more momentum in the community
than failure.  Switch to this for deriving our own error type.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-02-26 10:13:57 -07:00
David Brown 218aee74a0 workflow: Test the Mbed TLS ECDSA configuration
Test the use of Mbed TLS with ECDSA in the simulator for the workflow
testing.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-02-23 10:29:31 -07:00
David Brown 641af4530c boot: Support Mbed TLS ECDSA for signatures
Add Mbed TLS ECDSA signature verification as an option (in addition to
Tinycrypt and the CC310 hardware version).  Although the Mbed TLS ECDSA
verification code is both larger and slower, this will still save space
if there is another reason that the Mbed TLS code is already being
brought in for another reason (such as certificate management, for
example).

Mbed TLS's ECDSA verification works at a different level than the other
two libraries, so this takes a bit of reworking.  There are some
additional parameters passed to the various functions, and a new define
MCUBOOT_ECDSA_NEED_ASN1_SIG to indicate that the ecdsa verification
wants the original ASN1 signature, not a decoded key.

This adds the boot changes and simulator support to test this configuration.

Signed-off-by: David Brown <david.brown@linaro.org>
2021-02-23 10:29:31 -07:00