keys.KeyClass._emit is able to use 'file' parameter not as a file
but some object (not only sys.stdout but io.StringIO, like by
tests).
Fixed all explicit checks for sys.stdio usage in favor of
io.TextIOBase, also improve a single unit test to cover
also all the changed methods.
Signed-off-by: Denis Mingulov <denis@mingulov.com>
Add imgtool test call to workflows, use pytest and
publish artifacts with test results.
Also enable test run on 'pull_request', but limit
the previous default imgtool_run.sh run ('environment' job)
to run on 'push' event only (the same behaviour as before).
Signed-off-by: Denis Mingulov <denis@mingulov.com>
Use socs folder to configure Espressif targets.
Remove all boards confs which was created by copying other boards.
Signed-off-by: Marek Matej <marek.matej@espressif.com>
check_config.h was included manually by custom configuration files.
This caused compilation errors when updating MbedTLS to 3.6.0
because check_config.h was processed too early, before the whole
configuration is defined, effectively causing configuration check errors.
MbedTLS already takes care of including check_config.h at the right time.
Remove those erroneous manual check_config.h includes.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
The bootutil_hmac_sha256_set_key routine performs some dynamic memory
allocations when mbedTLS is used. To properly free the allocated memory,
bootutil_hmac_sha256_drop must be called before reinitializing the HMAC
context using bootutil_hmac_sha256_init. However, in the hkdf routine,
the HMAC context was freed only once even though it was initialized
multiple times.
Signed-off-by: Thomas Altenbach <thomas.altenbach@legrand.com>
This change uses the flash functions to read the applications
reset vector. This allow flexibility on which flash device the
application is programmed.
For e.g: MCUBoot can be programmed and running from Internal
Flash while Zephyr can be loaded from a different Flash device.
This change is made for ARM platform, it can be extended to
non-ARM platforms as well.
Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
The normal simulation test takes several hours to run on most machines. Allow a
few very slow tests to be skipped by setting the environment variable
`MCUBOOT_SKIP_SLOW_TESTS` to some value. For obvious reasons, this shouldn't be
done if these power failure simulation tests are needed.
With this change, on my desktop Linux machine, the test time with the skipping
goes from about 2 hours, to around 5 minutes.
Signed-off-by: David Brown <david.brown@linaro.org>
Adjust the printed numbers, as well as the values to `--test` so that the tests
are numbered starting from 1 instead of zero.
Signed-off-by: David Brown <david.brown@linaro.org>
The `--test` (`-t`) argument allows the caller to limit the tests that are
invoked by ptest. The argument can be specified multiple times to run several
tests. The numbers are based on the output of `--list`.
Signed-off-by: David Brown <david.brown@linaro.org>
Allow the `--workflow` argument to override the workflow file that is used, with
a reasonable default of the workflow used by CI.
Signed-off-by: David Brown <david.brown@linaro.org>
Add a skeleton of a command line parser to the ptest utility. This will allow
future changes to add additional options, such as listing and filtering the
tests that are used.
This adds a single subcommand `run`, which mimics the previous ptest behavior.
Signed-off-by: David Brown <david.brown@linaro.org>
If-statement checks if length is greater than some value right after a check if it is equal to the same value.
This will never be true.
Signed-off-by: Robert Paananen <robert@paananen.nu>
Only allow TLV entries that are needed for signature verification to be placed
in the unprotected area of the TLV.
Signed-off-by: David Brown <david.brown@linaro.org>
Add a query to the TLV iterator that will indicate if the currently iterated TLV
entry was found in the protected region or not.
Signed-off-by: David Brown <david.brown@linaro.org>
There is existing functionality for Zephyr where mcuboot works
with single slot (no swap) and image can be updated via boot_serial.
To have same functionality in mynewet single_loader.c file is copied
from zephyr tree and 2 pkg.yml files are modified to utilize new
file when BOOTUTIL_SINGLE_APPLICATION_SLOT is defined
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
mynewt system for some time now uses mynewt_main() as
starting point called from startup code.
This changes function name main to mynewt_main but
provides backup main function that will be linked if
pre 1.12 mynewt-core is used with mcuboot
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
Enable the usage of builtin keys in the ECDSA verification module with
the PSA Crypto API based cryptographic backend.
This way parsing and importing the verification keys can also be avoided.
Change-Id: I6ada1ef8ed04a3f12c228ef399e3a7b8ebc7fb5e
Signed-off-by: David Vincze <david.vincze@arm.com>
Introduce a new MCUBOOT_BUILTIN_KEY option to enable the usage of
builtin keys for signature verification. This way the details of the key
handling mechanism are abstracted away from the boot code and this
responsibility is delegated to the given crypto library.
This is an alternative option to the existing MCUBOOT_HW_KEY feature,
however in this case we can entirely rely on key IDs and not only the
code, but also the image metadata does not contain any public key data.
Change-Id: Id01b67951310549b2734730c58bfa7210a2d5236
Signed-off-by: David Vincze <david.vincze@arm.com>
So far mynewt code required definition of second slot in bsp.
Even in cases when overwrite only option was used bsp had to
have secondary slot with 0 length or pointing to some
unreachable flash or flash area.
Now when BOOTUTIL_SINGLE_APPLICATION_SLOT is set to 1
there is not need for fake flash areas when mcuboot
provides way for upgrade like boot serial or other
supported ways (USB DFU or USB MSC)
Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
It builds on top of OVERWRITE_ONLY mode and uses secondary slot
as a backup of the primary slot. The main difference is that after
image copy to the primary slot the secondary slot is not erased.
This is meant to be used together with BOOTSTRAP option that will
reinstall the primary image with the backup in case it's not valid.
Signed-off-by: Petr Buchta <petr.buchta@nxp.com>
Fixes an issue whereby the instruction and data caches being
disabled before booting code had bit-rotted and no longer worked,
adds a new Kconfig that allows this option to be turned off if
wanted.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
MX25UM flash on rd_rw612_bga is very large (8MB), so we must increase
the number of max sectors when targeting this board with MCUboot
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
There have been duplicate functions:
boot_verify_dependencies
boot_verify_slot_dependencies
boot_verify_slot_dependency
with, very similar internals, scattered around unit.
The commit have moved them on top and squashed where possible.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Fixes an issue with the estimated size calculation which wrongly
used the maximum align size for some multiplications, this would
mean that in some instances the estimated maximum image size was
smaller than the actual allowed size
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Match version with what is now used in upstream Mynewt. Also add
ARM CMSIS which is now taken from original repo.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>