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>
The defines have been taken from the Zephyr flash_map.h
but as they are provided there for MCUboot only, they can be just
defined here.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
In multi image swap validation of images could fail due to
headers being incorrectly re-read from storage.
Fixes#1768
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Adds default Kconfig configuration that allows to build MCUboot
for NRF54L.
Currently this configuration turns off WDT and FPROTECT,
which is TODO to fix.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
Signed-off-by: Mateusz Michalek <mateusz.michalek@nordicsemi.no>
Adds a new field which is set to the estimated size of the
upgrade slot data, this is used to know how much space should
be reserved in an update image to determine if an update will
fit or not
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
New arguments in zcbor_new_state are set to NULL/0 because they are
only needed when using the zcbor_unordered_map API.
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
Fixes an issue whereby slot sizes were checked but the check was
not done properly. This also adds debug log messages to show the
sector configuration including if slot sizes are not optimal
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds debug level logging which shows the offset of where a
sector swap status write is occurring at
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes an issue whereby a device might not have a write or erase
entry for the flash controller in devicetree. In the case whereby
the other slot has this information, use that instead. In the case
whereby neither slot has this information, use default values and
show a warning to the user
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Prevents enabling the option to save encrypted TLVs if encryption
support is not enabled, as it is required to make use of this
functionality.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds MCUboot's estimated overhead footer size to the application's
cache when using sysbuild, this allows that information to be
propagated to applications which can use the information to reduce
the available size for an application, preventing the MCUboot
error of image too large to swap.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Add support for ESP32xx_luatos_core targets to build
as Zephyr application.
This target is simular to esp32 devkitm,
copy conf file from esp32xx_devkitm
Signed-off-by: YuLong Yao <feilongphone@gmail.com>
The static declaration of 'led0' was moved to 'io.c' which broke
building with the 'MCUBOOT_INDICATION_LED' enabled:
mcuboot/boot/zephyr/main.c:380:22: error:
'led0' undeclared (first use in this function)
380 | gpio_pin_set_dt(&led0, 1);
| ^~~~
This adds simple function 'io_led_set()' for changing LED's value.
Fixes: 433b8480 ("zephyr: Move IO functions out of main to separate file")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This fixes below error when building with 'MCUBOOT_INDICATION_LED' and
'LOG' enabled:
In file included from zephyr/include/zephyr/logging/log.h:11,
from zephyr/include/zephyr/usb/usb_device.h:43,
from bootloader/mcuboot/boot/zephyr/io.c:26:
mcuboot/boot/zephyr/io.c: In function 'io_led_init':
zephyr/include/zephyr/logging/log_core.h:151:20: error:
'__log_level' undeclared (first use in this function)
151 | (_level <= __log_level) && \
| ^~~~~~~~~~~
Fixes: 433b8480 ("zephyr: Move IO functions out of main to separate file")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This fixes below warning when building with 'MCUBOOT_INDICATION_LED'
enabled:
mcuboot/boot/zephyr/main.c:410:5:
warning: implicit declaration of function 'led_init';
did you mean 'io_led_init'? [-Wimplicit-function-declaration]
410 | led_init();
| ^~~~~~~~
| io_led_init
Fixes: 433b8480 ("zephyr: Move IO functions out of main to separate file")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
Adds a new operation style in which the secondary slot has an
image which is used to update the primary image only.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>