Commit Graph

2281 Commits

Author SHA1 Message Date
David Brown 847548a9ac sim: Put "C" on externs
Many of these extern functions are missing the "C". It doesn't seem to matter on
any of our targets, but this does make the code more correct, and might be a
problem in the future.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-06-26 16:43:56 -06:00
David Brown 1b1d495338 FIH: Disable FIH labels on Apple targets
The symbols injected here cause some kind of poor interaction with the linker on
MacOS, which results in most of the code becoming hopelessly corrupt.  For now,
just disable these symbols on this target.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-06-26 16:43:56 -06:00
David Brown 9cc8dac569 sim: Put AreaDesc in an Rc
Since there are references to this struct passed to C code, put it into an Rc so
that it won't move around when the data is moved.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-06-26 16:43:56 -06:00
David Brown 5d155132dc sim: Don't take address of movable struct
This struct was having addresses taken of fields within it, and then being
returned.  It is platform-specific whether this causes a move.  It seems to be
working on x86_64, but causes a segfault on aarch64.  Box the struct so that it
isn't moved after being initialized.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-06-26 16:43:56 -06:00
Thomas Altenbach 9ae634f3bf bootutil: Fix signed/unsigned comparison in boot_read_enc_key
When MCUBOOT_SWAP_SAVE_ENCTLV is enabled, a comparison between a signed
and an unsigned integer is made in boot_read_enc_key. This might cause a
warning to be emitted at compile-time.

Signed-off-by: Thomas Altenbach <thomas.altenbach@legrand.com>
2024-06-20 17:54:01 -03:00
David Vincze 8be24f87e3 docs: Replace Slack channel links with Discord
Replace Slack channel links with MCUboot Discord channel
as the discussions have moved there.

Signed-off-by: David Vincze <david.vincze@arm.com>
Change-Id: I132279574e674408dffc9ed377d216775a54fd56
2024-06-14 15:31:51 +02:00
Rustam Ismayilov 533fef2ad7 imgtool: Update version.py to take command line arguments
Main method printed hardcoded versions, update to take argument
to enable the possibility of testing version strings by invoking
the command through command line.

Signed-off-by: Rustam Ismayilov <rustam.ismayilov@arm.com>
Change-Id: If75769ef223944865313ed95336e859ebef85fd6
2024-06-14 13:56:40 +02:00
Rustam Ismayilov 316a139c1c imgtool: dumpinfo improvements
Fix trailer info dumping reads pad characters as values for status
Refactor printing styled texts and frames
Use isinstance() for type checking
Fold notice text depending on line length
Refactoring some parts for readability
Fix additional linting issues

Signed-off-by: Rustam Ismayilov <rustam.ismayilov@arm.com>
Change-Id: I741562bb70b18407bdd32e9c7391048faf6394c6
2024-06-14 13:56:40 +02:00
Rustam Ismayilov f3a5702879 imgtool: Various dumpinfo fixes
Add support for dumping images with custom tlv
Fix uninitialized access to some variables
Fix trailer magic detection
Fix some linting issues (parenthesis, indentation, spacing)

Signed-off-by: Rustam Ismayilov <rustam.ismayilov@arm.com>
Change-Id: I5b6e1dfa74606e2645a258065dd045cc8c7052c5
2024-06-14 13:56:40 +02:00
Rustam Ismayilov d16a613f6d imgtool: Assert "measurement value" is last in boot_record.py
'Measurement Value' added the 'properties' list initially,
rather than adding it separately later.
Added an assertion to ensure 'Measurement Value' remains as
the last item in the 'properties' list

Signed-off-by: Rustam Ismayilov <rustam.ismayilov@arm.com>
Change-Id: I106059c6c903c3d560477d5114d866f48590ad7e
2024-06-14 13:56:40 +02:00
Rustam Ismayilov 36f8bf3085 imgtool: Fix verify command for edcsa-p384 signed images
Fixed hash algorithm defaults to SHA256 in case no key provided.
Verification improved by adding check for key - tlv mismatch,
VerifyResult.KEY_MISMATCH added to indicate this case.
Multiple styling fixes and import optimisation, exception handling.

Signed-off-by: Rustam Ismayilov <rustam.ismayilov@arm.com>
Change-Id: I61a588de5b39678707c0179f4edaa411ceb67c8e
2024-06-14 13:56:40 +02:00
Rustam Ismayilov 2712f74312 imgtool: Add missing requirements to requirements.txt file
Signed-off-by: Rustam Ismayilov <rustam.ismayilov@arm.com>
Change-Id: I9c84e544b466c0e041bb947fb4dd3e01b0d38ae5
2024-06-14 13:56:40 +02:00
Dinesh Kumar K 03171ffdc1 docs: Add release note snippet on MCUBOOT_HW_KEY for image encryption
Signed-off-by: Dinesh Kumar K <dinesh@linumiz.com>
2024-06-12 15:17:54 -06:00
Dinesh Kumar K 0fa46270c0 boot: Add MCUBOOT_HW_KEY support for image encryption
Currently encryption supports only private key embed
in mcuboot itself. To support MCUBOOT_HW_KEY for image
encryption boot_retrieve_private_key() hook is added.

This hook helps retrieving private key from trusted
sources like OTP, TPM.

Signed-off-by: Dinesh Kumar K <dinesh@linumiz.com>
2024-06-12 15:17:54 -06:00
David Vincze 92ad926ecc docs: Add release note snippet for imgtool testing
Signed-off-by: David Vincze <david.vincze@arm.com>
Change-Id: I69ee2da7637363f5a50b9ef3aa3f0aaf5301714a
2024-06-04 09:51:43 +02:00
Mahesh Mahadevan 45d379e715 zephyr: boards: Add files needed for NXP FRDM MCXN947 QSPI variant
1. set BOOT_MAX_IMG_SECTORS value for frmd_mcxn947_qspi. W25Q64 flash on the board
   is very large (8MB), so we must increase the number of max sectors when
   targeting this board with MCUboot.
2. Set the zephyr,flash chosen node to point to internal flash as this board
   supports booting from internal flash only.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-05-24 06:45:03 +01:00
dependabot[bot] 2dcbabcb2c build(deps): bump rexml from 3.2.6 to 3.2.8 in /docs
Bumps [rexml](https://github.com/ruby/rexml) from 3.2.6 to 3.2.8.
- [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.6...v3.2.8)

---
updated-dependencies:
- dependency-name: rexml
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-23 19:59:45 +02:00
Jerzy Kasenberg 29f9540db8 mynewt: Igore swap_scratch.c for single application slot
swap_scratch.c requires definition of SLOT1, in single application
slot build it's not needed and file would not be used anyway so
now it is removed from mynewt build

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-05-23 18:09:36 +02:00
dependabot[bot] f08ace635a build(deps): bump nokogiri from 1.16.2 to 1.16.5 in /docs
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.16.2 to 1.16.5.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.16.2...v1.16.5)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-23 18:08:32 +02:00
Denis Mingulov 3113df8f9f imgtool: initial sanity test
An initial sanity test for imgtool is added, checks
different commands for key operations (keygen, getpriv,
getpub and getpubhash).

Also very basic test for sign / verify is added.

Some tests are disabled (marked as 'xfail') due to
the missing implementation.

Signed-off-by: Denis Mingulov <denis@mingulov.com>
2024-05-23 14:39:17 +02:00
Denis Mingulov a4cb878cae imgtool: Fixed missing dependency to 'pyyaml' (for dumpinfo)
imgtool's dumpinfo depends to pyyaml package, so add it to
requirements.

Signed-off-by: Denis Mingulov <denis@mingulov.com>
2024-05-23 14:39:17 +02:00
Denis Mingulov faf2dd1f6a imgtool: fixed keys/general.py to pass existing unittests
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>
2024-05-23 14:39:17 +02:00
Denis Mingulov 12026047bd ci: add imgtool test to workflows
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>
2024-05-23 14:39:17 +02:00
Marek Matej 898a1ca64a boot: zephyr: add ESP32-C6 support
Update the list of SoCs to support the ESP32-C6.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2024-05-21 16:52:51 +02:00
Marek Matej 018dc01d48 boot/zephyr: use socs conf
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>
2024-05-13 04:25:17 -03:00
David Brown 9c99326b97 Preps for 2.1.0 release
Update version information for 2.1.0 release.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-05-09 08:03:52 -06:00
Tomi Fontanilles d4394c2f9b mbedtls config: fix too early check_config.h includes
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>
2024-04-25 11:05:54 +02:00
David Brown 78bfe750cd docs: Fold additional release notes
Add in a few additional release notes for the 2.1 release.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-04-24 09:18:54 -06:00
David Brown 9bbe0a0462 Preps for 2.1.0-rc1 release
Update release notes and version numbers for 2.1.0-rc1 release.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-04-24 09:18:54 -06:00
David Brown 36eeeef8c4 docs: Update release notes for HKDF fix
Add missing release notes from merged fix.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-04-24 09:18:54 -06:00
David Brown 8b1d5f0629 docs: add release notes for reset vector update
Add missing release notes for this change.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-04-24 09:18:54 -06:00
Thomas Altenbach 73315f7b51 bootutil: Fix memory leak in HKDF implementation
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>
2024-04-23 11:03:22 -06:00
Mahesh Mahadevan 453096b17d zephyr: arm: Update reading the flash image reset vector
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>
2024-04-23 10:32:09 -06:00
Jamie McCrae 02267cfdb5 docs: release-notes: Add note on Zephyr boot banner
Adds a note about the new Zephyr MCUboot boot banner feature

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-23 11:28:48 +01:00
Jamie McCrae 1496129235 boot: zephyr: Add optional MCUboot boot banner
Adds an optional MCUboot boot banner which displays the MCUboot
version and zephyr version

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-23 11:28:48 +01:00
Alex Tsamakos 7174dd2ba8 boot: zephyr: boards: actinius: enable multithreading in config
Adds config with multithreading enabled for all Actinius boards

Signed-off-by: Alex Tsamakos <alex@actinius.com>
2024-04-23 11:26:34 +01:00
David Brown d2e69bf720 docs: Release notes for ptest updates
Signed-off-by: David Brown <david.brown@linaro.org>
2024-04-19 11:50:52 -06:00
David Brown 80704f874b sim: Allow slow tests to be skipped
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>
2024-04-19 11:50:52 -06:00
David Brown 29d97b94a8 ptest: Use 1-based indices for tests
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>
2024-04-19 11:50:52 -06:00
David Brown 0ceb85ad58 ptest: Add `--test` argument
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>
2024-04-19 11:50:52 -06:00
David Brown 67fc1fc181 ptest: Add `list` command
The `list` command will show what tests are available.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-04-19 11:50:52 -06:00
David Brown c32ad20fae ptest: Add workflow argument
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>
2024-04-19 11:50:52 -06:00
David Brown 8798337940 ptest: Add command line parsing
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>
2024-04-19 11:50:52 -06:00
Robert Paananen 556b32a679 boot: Removed unnecessary if-statement
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>
2024-04-18 10:49:14 +01:00
David Brown 69858eb50e doc: Release notes for TLV check
Add a release not stub for the TLV check.

Signed-off-by: David Brown <david.brown@linaro.org>
2024-04-18 11:27:15 +02:00
David Brown da2e2ab4e3 boot: Enforce TLV entries to be protected
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>
2024-04-18 11:27:15 +02:00
David Brown ea1cdfdeff boot: Add tlv query for protected region
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>
2024-04-18 11:27:15 +02:00
Sylvio Alves 8c0e36c886 boot: zephyr: esp32: rename boards to meet hwmv2
Renames boards to account for hwmv2 changes

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-04-16 18:02:13 -03:00
Jerzy Kasenberg ed6460b815 mynewt: Add single_loader support
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>
2024-04-14 20:17:44 -03:00
Jerzy Kasenberg 23d4f12169 mynewt: Change main to mynewt_main
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>
2024-04-14 20:16:39 -03:00