Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
5caa14a
Revert "[nrf noup] zephyr: Move KMU base slot configuration to Kconfig"
tomchy Nov 19, 2025
c2a3c8f
Revert "[nrf noup] bootloader: Add support for IronSide counters"
tomchy Nov 17, 2025
1949973
Revert "[nrf noup] bootutil: ed25519_psa: multi verification revocation"
tomchy Nov 6, 2025
c05f58b
Revert "[nrf noup] bootutil: Fix ITS key locking compile error"
tomchy Nov 4, 2025
98e3462
Revert "[nrf noup] Handle pending confirm requests"
tomchy Nov 4, 2025
64b5aa8
Revert "[nrf noup] boot: zephyr: remove nonsecure ram cleanup"
tomchy Oct 23, 2025
b8928ac
Revert "[nrf noup] boot: zephyr: Region protection adjustments for nR…
tomchy Oct 23, 2025
bf24b03
Revert "[nrf noup] boards/thingy53_nrf5340_cpuapp: defaulat to LTO"
tomchy Oct 23, 2025
8caf29a
Revert "[nrf noup] boot/zephyr: improve S2RAM resume support using de…
tomchy Oct 23, 2025
5650d9c
Revert "[nrf noup] bootutil: Use correct set of KMU key slots"
tomchy Oct 23, 2025
95914bc
Revert "[nrf noup] bootutil/loader: integrate nRF54h S2RAM with diect…
tomchy Oct 23, 2025
75b8229
Revert "[nrf noup] mcuboot: Use dedicated type for slot numbers"
tomchy Oct 23, 2025
459f226
Revert "[nrf noup] nrf_cleanup: temporary GRTC cleanup with no counte…
tomchy Oct 23, 2025
e1e9092
Revert "[nrf noup] boot: bootutil: Fix b0 checks"
tomchy Oct 23, 2025
25478d2
Revert "[nrf noup] loader: Too many params when calling bootutil_img_…
tomchy Oct 23, 2025
da71ea0
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
72e6217
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
525310e
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
f02379f
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
0182c0b
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
22c23f0
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
b3f5392
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
7a1602d
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
d74ce74
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
42c8ac7
Revert "[nrf noup] loader: Use BOOT_SLOT_PRIMARY and BOOT_SLOT_SECOND…
tomchy Oct 23, 2025
6b46a7b
Revert "[nrf noup] bootutil: Remove bootutil_find_key from code"
tomchy Oct 23, 2025
cd19b18
Revert "[nrf noup] bootutil: Locking KMU keys"
tomchy Oct 23, 2025
3ddae39
Revert "[nrf noup] bootloader: Fix logging in bootloader requests mod…
tomchy Oct 23, 2025
ea09b35
Revert "[nrf noup] boot: Fix test failing with bootloader requests"
tomchy Oct 23, 2025
355c210
Revert "[nrf noup] Support for ed25519 signature verification using ITS"
tomchy Oct 23, 2025
809e06c
Revert "[nrf noup] boot: Use NCS_ prefix for sdk-nrf specific Kconfigs"
tomchy Oct 23, 2025
f0e32f2
Revert "[nrf noup] Added BOOT_SIGNATURE_USING_ITS for ecdsa configura…
tomchy Oct 23, 2025
6c4dcd7
Revert "[nrf noup] bootutil: key revocation"
tomchy Oct 23, 2025
fcc9b61
Revert "[nrf noup] boot: bootutil: Allow configuring number of KMU keys"
tomchy Oct 23, 2025
779a9b4
Revert "[nrf noup] bootutil: Add support for KMU stored ED25519 signa…
tomchy Oct 23, 2025
1a7a567
Revert "[nrf noup] boot: zephyr: Add experimental selection to compre…
tomchy Oct 23, 2025
8d2e047
Revert "[nrf noup] decompression: Align to changes in nrfcompress API"
tomchy Oct 23, 2025
8f518f0
Revert "[nrf noup] zephyr: Add support for compressed image updates"
tomchy Oct 23, 2025
5549c75
Revert "[nrf noup] boot: Improve bootloader request handling"
tomchy Oct 23, 2025
688b7cc
Revert "[nrf noup] bootloader: Add bootloader requests"
tomchy Oct 23, 2025
09d3daa
Revert "[nrf noup] boot: zephyr: Disable self RWX"
tomchy Oct 23, 2025
300f5ea
Revert "[nrf noup] boot/zephyr/nrf_cleanup: fix index error"
tomchy Oct 23, 2025
8fb1185
Revert "[nrf noup] boot: Use NCS_ prefix for sdk-nrf specific Kconfigs"
tomchy Oct 23, 2025
f33c839
Revert "[nrf noup] boot: Add retry for image verification"
tomchy Oct 23, 2025
f367e86
Revert "[nrf noup] nrf_cleanup: nRF54h: fix missing peripheral cleanup"
tomchy Oct 23, 2025
fe1d296
Revert "[nrf noup] nrf_cleanup: nRF54l: disable cleanup on UARTE pins"
tomchy Oct 23, 2025
9175f60
Revert "[nrf noup] boot/zephyr/nrf_cleanup: cleanup uarte pins"
tomchy Oct 23, 2025
0b393b5
Revert "[nrf noup] boot/zephyr: nrf54h20dk cleanup adaptations"
tomchy Oct 23, 2025
de1eed8
Revert "[nrf noup] partition_manager: Add support for internal flash …
tomchy Oct 23, 2025
cd60239
Revert "[nrf noup] boot: zephyr: boards: Disabled NCS boot banner for…
tomchy Oct 23, 2025
2dbd443
Revert "[nrf noup] sysflash: Add missing _FLASH_0_ID definitions"
tomchy Oct 23, 2025
708c135
Revert "[nrf noup] boot: Remove child/parent references"
tomchy Oct 23, 2025
7acba60
Revert "[nrf noup] boot: bootutil: loader: Add s0/s1 checking of MCUb…
tomchy Oct 23, 2025
09b31e5
Revert "[nrf noup] treewide: Add support for sysbuild assigned images"
tomchy Oct 23, 2025
3867b8d
Revert "[nrf noup] boot: zephyr: Do not lock PCD region with TF-M"
tomchy Oct 23, 2025
a0e7bad
Revert "[nrf noup] bootutil: loader: Fix netcore address checking"
tomchy Oct 23, 2025
6c78e52
Revert "[nrf noup] boot/../loader: reboot after updating s0/s1"
tomchy Oct 23, 2025
e914397
Revert "[nrf noup] boot/../loader: skip downgrade prevention for s1/s0"
tomchy Oct 23, 2025
90f5bce
Revert "[nrf noup] boot/zephyr: fix fw_info search"
tomchy Oct 23, 2025
6e17859
Revert "[nrf noup] loader: remove cleanup for direct xip mode"
tomchy Oct 23, 2025
797c769
Revert "[nrf noup] loader: introduced cleanup of unusable secondary s…
tomchy Oct 23, 2025
640acfe
Revert "[nrf noup] sysflash: Add support for three images"
tomchy Oct 23, 2025
e88fdbe
Revert "[nrf noup] sysflash: Move partition manager definitions to pm…
tomchy Oct 23, 2025
8edcd0c
Revert "[nrf noup] boot: Add support for NSIB and multi-image"
tomchy Oct 23, 2025
aa73c65
Revert "[nrf noup] loader: Fix missing PCD define check"
tomchy Oct 23, 2025
7775939
Revert "[nrf noup] boards: thingy53: disable GPIO ISR support"
tomchy Oct 23, 2025
a8bc86b
Revert "[nrf noup] loader: Add firmware version check downgrade preve…
tomchy Oct 23, 2025
86e82c6
Revert "[nrf noup] zephyr: Boot even if EXT_ABI is not provided"
tomchy Oct 23, 2025
f2d8a8c
Revert "[nrf noup] zephyr: Add RAM flash configuration to cache for s…
tomchy Oct 23, 2025
0b328a8
Revert "[nrf noup] loader: Do not check reset vector for XIP image"
tomchy Oct 23, 2025
2a3f539
Revert "[nrf noup] loader: Fix reading reset addr to support ext flash"
tomchy Oct 23, 2025
9e26c48
Revert "[nrf noup] zephyr: Clean up non-secure RAM if enabled"
tomchy Oct 23, 2025
df47c7c
Revert "[nrf noup] zephyr: clean peripherals state before boot"
tomchy Oct 23, 2025
f1dbfac
Revert "[nrf noup] boot: nrf53-specific customizations"
tomchy Oct 23, 2025
ca0df6d
Revert "[nrf noup] treewide: add NCS partition manager support"
tomchy Oct 23, 2025
550aebd
[nrf fromtree] bootutil: Add MCUBOOT_CHECK_HEADER_LOAD_ADDRESS
de-nordic Oct 7, 2025
63b1ff7
[nrf fromtree] zephyr: Added MCUBOOT_CHECK_HEADER_LOAD_ADDRESS Kconfig
de-nordic Oct 7, 2025
6ae3e0b
[nrf fromtree] sim: Parametrize make_bad_secondary_slot_image
de-nordic Oct 8, 2025
9ebad96
[nrf fromtree] sim: Add test for MCUBOOT_CHECK_HEADER_LOAD_ADDRESS
de-nordic Oct 8, 2025
394f19c
[nrf fromtree] zephyr: Deprecate MCUBOOT_VERIFY_IMG_ADDRESS
de-nordic Oct 8, 2025
1aba197
[nrf fromtree] bootutil: Move boot_enc_init in boot_swap_image
de-nordic Oct 9, 2025
17f9541
[nrf fromtree] bootutil: Replace literal slot indexes with identifiers
de-nordic Oct 14, 2025
527a960
[nrf fromtree] bootutil: Replace boot_write_enc_key with boot_write_e…
de-nordic Oct 14, 2025
6f60150
[nrf fromtree] boot: bootutil: swap_offset: Fix not including unprote…
nordicjm Oct 15, 2025
5c54c29
[nrf fromtree] docs: design: Add update on swap using offset
nordicjm Oct 15, 2025
01fe50d
[nrf fromtree] bootutil: Drop slot number and boot_state from most bo…
de-nordic Oct 17, 2025
85c8c4b
[nrf fromtree] boot: bootutil: fix image_index definition
stgloorious Oct 2, 2025
5467b48
[nrf fromtree] loader: Fix compile-time issues in loader.c
tomchy Oct 22, 2025
7a54863
[nrf fromtree] loader: Rename boot_version_cmp
tomchy Oct 21, 2025
61a52af
[nrf fromtree] loader: Optimize boot_check_header_erased(..)
tomchy Oct 21, 2025
23af6b5
[nrf fromtree] loader: Unify header_valid(..) API
tomchy Oct 21, 2025
d953bbb
[nrf fromtree] loader: Unify image check API.
tomchy Oct 21, 2025
5aa615d
[nrf fromtree] bootutil: Add missing docs
tomchy Oct 21, 2025
c9befb4
[nrf fromtree] bootutil: Move state-independent area APIs
tomchy Oct 21, 2025
72f223f
[nrf fromtree] loader: Move boot_get_max_app_size(..) API
tomchy Oct 21, 2025
2d71bf1
[nrf fromtree] bootutil: Move update-independent code
tomchy Oct 21, 2025
2e9431f
[nrf fromlist] design: Fix UUID TLVs
tomchy Nov 18, 2025
78ed415
[nrf fromlist] boot: Add MCUboot manifest TLV
tomchy Oct 9, 2025
e2b23da
[nrf fromlist] imgtool: Add a possibility to attach manifest TLV
tomchy Oct 9, 2025
f8d18ef
[nrf fromlist] bootutil: Add manifest-based loader for Direct XIP
tomchy Oct 15, 2025
7dcb00d
[nrf fromlist] doc: Add manifest conceptual description
tomchy Nov 4, 2025
3ed02ee
[nrf noup] treewide: add NCS partition manager support
SebastianBoe Dec 12, 2018
d423d5e
[nrf noup] boot: nrf53-specific customizations
sigvartmh Aug 27, 2020
c44f150
[nrf noup] zephyr: clean peripherals state before boot
nvlsianpu Feb 27, 2020
35110a3
[nrf noup] zephyr: Clean up non-secure RAM if enabled
sigvartmh Jan 6, 2023
7c64e87
[nrf noup] loader: Fix reading reset addr to support ext flash
chrta Feb 10, 2022
8f738fe
[nrf noup] loader: Do not check reset vector for XIP image
de-nordic Sep 22, 2023
18ae08b
[nrf noup] zephyr: Add RAM flash configuration to cache for sysbuild
nordicjm Sep 18, 2023
5d2486d
[nrf noup] zephyr: Boot even if EXT_ABI is not provided
sigvartmh Oct 17, 2023
e039de8
[nrf noup] loader: Add firmware version check downgrade prevention
sigvartmh Sep 27, 2023
2afb84e
[nrf noup] boards: thingy53: disable GPIO ISR support
nika-nordic Oct 9, 2023
13856a6
[nrf noup] loader: Fix missing PCD define check
nordicjm Aug 31, 2023
067ee83
[nrf noup] boot: Add support for NSIB and multi-image
sigvartmh May 31, 2023
a6470b7
[nrf noup] sysflash: Move partition manager definitions to pm_sysflash.h
de-nordic Aug 10, 2023
b761cd2
[nrf noup] sysflash: Add support for three images
de-nordic Aug 11, 2023
37dc87a
[nrf noup] loader: introduced cleanup of unusable secondary slot
nvlsianpu Feb 15, 2024
90ba1dc
[nrf noup] loader: remove cleanup for direct xip mode
gchwier May 17, 2024
e89b75e
[nrf noup] boot/zephyr: fix fw_info search
nvlsianpu May 27, 2024
f193892
[nrf noup] boot/../loader: skip downgrade prevention for s1/s0
nvlsianpu Jun 13, 2024
4a38b97
[nrf noup] boot/../loader: reboot after updating s0/s1
nvlsianpu Jun 18, 2024
d3d0c76
[nrf noup] bootutil: loader: Fix netcore address checking
nordicjm Aug 29, 2024
33faac8
[nrf noup] boot: zephyr: Do not lock PCD region with TF-M
MarkusLassila Aug 30, 2024
b08d22e
[nrf noup] treewide: Add support for sysbuild assigned images
nordicjm Sep 10, 2024
56afc49
[nrf noup] boot: bootutil: loader: Add s0/s1 checking of MCUboot image
nordicjm Oct 15, 2024
bb37379
[nrf noup] boot: Remove child/parent references
nordicjm Dec 5, 2024
96d7610
[nrf noup] sysflash: Add missing _FLASH_0_ID definitions
de-nordic Jan 15, 2025
b4cb330
[nrf noup] boot: zephyr: boards: Disabled NCS boot banner for thingy 53
kkasperczyk-no Jan 24, 2025
579fd11
[nrf noup] partition_manager: Add support for internal flash netcore DFU
hellesvik-nordic Feb 6, 2025
329c27c
[nrf noup] boot/zephyr: nrf54h20dk cleanup adaptations
nordic-mik7 Mar 28, 2025
ca472e1
[nrf noup] boot/zephyr/nrf_cleanup: cleanup uarte pins
nvlsianpu Mar 5, 2024
362da91
[nrf noup] nrf_cleanup: nRF54l: disable cleanup on UARTE pins
nvlsianpu Apr 11, 2025
da5dbbc
[nrf noup] nrf_cleanup: nRF54h: fix missing peripheral cleanup
ahasztag Apr 28, 2025
b2e0603
[nrf noup] boot: Add retry for image verification
adsz-nordic Jul 8, 2025
f7377fc
[nrf noup] boot: zephyr: Disable self RWX
michalek-no Aug 5, 2025
19225a5
[nrf noup] bootloader: Add bootloader requests
tomchy Jul 28, 2025
a74759f
[nrf noup] zephyr: Add support for compressed image updates
nordicjm Aug 22, 2024
8d56dde
[nrf noup] decompression: Align to changes in nrfcompress API
nordic-mik7 May 13, 2025
c0588f2
[nrf noup] boot: zephyr: Add experimental selection to compression
nordicjm Nov 7, 2024
b8f315b
[nrf noup] bootutil: Add support for KMU stored ED25519 signature key
de-nordic Sep 20, 2024
205c508
[nrf noup] boot: bootutil: Allow configuring number of KMU keys
nordicjm Dec 2, 2024
e0392a5
[nrf noup] bootutil: key revocation
michalek-no Mar 17, 2025
00d36dd
[nrf noup] Added BOOT_SIGNATURE_USING_ITS for ecdsa configuration
ahasztag Jul 24, 2025
2b25094
[nrf noup] Support for ed25519 signature verification using ITS
nordic-mik7 Aug 22, 2025
1f7b287
[nrf noup] bootutil: Locking KMU keys
de-nordic Jul 3, 2025
7fd3f76
[nrf noup] bootutil/loader: integrate nRF54h S2RAM with diect-xip
nvlsianpu Sep 30, 2025
b0e84eb
[nrf noup] bootutil: Use correct set of KMU key slots
nordicjm Sep 12, 2025
df17ce1
[nrf noup] boot/zephyr: improve S2RAM resume support using dedicated API
nvlsianpu Sep 18, 2025
02c7d23
[nrf noup] boards/thingy53_nrf5340_cpuapp: defaulat to LTO
nvlsianpu Oct 13, 2025
754d226
[nrf noup] Handle pending confirm requests
tomchy Oct 27, 2025
ed5c307
[nrf noup] bootutil: Fix ITS key locking compile error
ahasztag Oct 31, 2025
72772fb
[nrf noup] Add manifest routines for application
tomchy Nov 4, 2025
0676fd7
[nrf noup] bootutil: ed25519_psa: multi verification revocation
michalek-no Nov 3, 2025
ed780f5
[nrf noup] bootloader: Add support for IronSide counters
tomchy Nov 13, 2025
9ba25b8
[nrf noup] zephyr: Move KMU base slot configuration to Kconfig
de-nordic Nov 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions boot/boot_serial/src/boot_serial_encryption.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ boot_image_validate_encrypted(struct boot_loader_state *state,
int rc;

if (MUST_DECRYPT(fa_p, BOOT_CURR_IMG(state), hdr)) {
rc = boot_enc_load(state, 1, hdr, fa_p, bs);
rc = boot_enc_load(state, BOOT_SLOT_SECONDARY, hdr, fa_p, bs);
if (rc < 0) {
FIH_RET(fih_rc);
}
rc = boot_enc_set_key(BOOT_CURR_ENC(state), 1, bs);
rc = boot_enc_set_key(BOOT_CURR_ENC_SLOT(state, BOOT_SLOT_SECONDARY), bs->enckey[BOOT_SLOT_SECONDARY]);
if (rc < 0) {
FIH_RET(fih_rc);
}
Expand Down Expand Up @@ -169,7 +169,7 @@ decrypt_region_inplace(struct boot_loader_state *state,
blk_sz = tlv_off - (off + bytes_copied);
}
}
boot_enc_decrypt(BOOT_CURR_ENC(state), slot,
boot_enc_decrypt(BOOT_CURR_ENC_SLOT(state, slot),
(off + bytes_copied + idx) - hdr->ih_hdr_size, blk_sz,
blk_off, &buf[idx]);
}
Expand Down Expand Up @@ -235,11 +235,11 @@ decrypt_image_inplace(const struct flash_area *fa_p,
#endif
memset(&boot_data, 0, sizeof(struct boot_loader_state));
/* Load the encryption keys into cache */
rc = boot_enc_load(state, 0, hdr, fa_p, bs);
rc = boot_enc_load(state, BOOT_SLOT_PRIMARY, hdr, fa_p, bs);
if (rc < 0) {
FIH_RET(fih_rc);
}
if (rc == 0 && boot_enc_set_key(BOOT_CURR_ENC(state), 0, bs)) {
if (rc == 0 && boot_enc_set_key(BOOT_CURR_ENC_SLOT(state, BOOT_SLOT_PRIMARY), bs->enckey[BOOT_SLOT_PRIMARY])) {
FIH_RET(fih_rc);
}
}
Expand Down
4 changes: 4 additions & 0 deletions boot/bootutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ target_sources(bootutil
src/bootutil_img_hash.c
src/bootutil_img_security_cnt.c
src/bootutil_misc.c
src/bootutil_area.c
src/bootutil_loader.c
src/bootutil_public.c
src/caps.c
src/encrypted.c
Expand All @@ -30,7 +32,9 @@ target_sources(bootutil
src/image_ed25519.c
src/image_rsa.c
src/image_validate.c
src/mcuboot_manifest.c
src/loader.c
src/loader_manifest_xip.c
src/swap_misc.c
src/swap_move.c
src/swap_scratch.c
Expand Down
27 changes: 27 additions & 0 deletions boot/bootutil/include/bootutil/bootutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,36 @@ fih_ret boot_go_for_image_id(struct boot_rsp *rsp, uint32_t image_id);

void boot_state_clear(struct boot_loader_state *state);
fih_ret context_boot_go(struct boot_loader_state *state, struct boot_rsp *rsp);

/**
* Returns a pointer to the boot loader state structure.
*
* @return Pointer to the boot loader state structure.
*/
struct boot_loader_state *boot_get_loader_state(void);

#if defined(MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO) || defined(MCUBOOT_DATA_SHARING)
/**
* Returns pointer to array of image maximum sizes.
*
* @note This function provides a RAW access to the structure. The sizes may not be
* calculated yet. Use boot_get_max_app_size() to ensure the sizes are calculated.
*
* @return Pointer to array of image maximum sizes.
*/
struct image_max_size *boot_get_image_max_sizes(void);

/**
* Fetches the maximum allowed size of all application images.
*
* @note In contrast to boot_get_image_max_sizes(), this function will fetch the sizes
* if they are not yet calculated.
*
* @return A pointer to the structure containing the maximum sizes of images.
*/
const struct image_max_size *boot_get_max_app_size(void);
#endif /* MCUBOOT_SERIAL_IMG_GRP_SLOT_INFO || MCUBOOT_DATA_SHARING */

void boot_fetch_slot_state_sizes(void);
uint32_t boot_get_state_secondary_offset(struct boot_loader_state *state,
const struct flash_area *fap);
Expand Down
14 changes: 7 additions & 7 deletions boot/bootutil/include/bootutil/enc_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ struct boot_loader_state;
/* Decrypt random, symmetric encryption key */
int boot_decrypt_key(const uint8_t *buf, uint8_t *enckey);

int boot_enc_init(struct enc_key_data *enc_state, uint8_t slot);
int boot_enc_drop(struct enc_key_data *enc_state, uint8_t slot);
int boot_enc_set_key(struct enc_key_data *enc_state, uint8_t slot,
const struct boot_status *bs);
int boot_enc_init(struct enc_key_data *enc_state);
int boot_enc_drop(struct enc_key_data *enc_state);
int boot_enc_set_key(struct enc_key_data *enc_state, const uint8_t *key);
int boot_enc_load(struct boot_loader_state *state, int slot,
const struct image_header *hdr, const struct flash_area *fap,
struct boot_status *bs);
bool boot_enc_valid(struct enc_key_data *enc_state, int slot);
void boot_enc_encrypt(struct enc_key_data *enc_state, int slot,
bool boot_enc_valid(const struct enc_key_data *enc_state);
void boot_enc_encrypt(struct enc_key_data *enc_state,
uint32_t off, uint32_t sz, uint32_t blk_off, uint8_t *buf);
void boot_enc_decrypt(struct enc_key_data *enc_state, int slot,
void boot_enc_decrypt(struct enc_key_data *enc_state,
uint32_t off, uint32_t sz, uint32_t blk_off, uint8_t *buf);
/* Note that boot_enc_zeorize takes BOOT_CURR_ENC, not BOOT_CURR_ENC_SLOT */
void boot_enc_zeroize(struct enc_key_data *enc_state);

#ifdef __cplusplus
Expand Down
1 change: 1 addition & 0 deletions boot/bootutil/include/bootutil/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ extern "C" {
#define IMAGE_TLV_COMP_DEC_SIZE 0x73 /* Compressed decrypted image size */
#define IMAGE_TLV_UUID_VID 0x74 /* Vendor unique identifier */
#define IMAGE_TLV_UUID_CID 0x75 /* Device class unique identifier */
#define IMAGE_TLV_MANIFEST 0x76 /* Transaction manifest */
/*
* vendor reserved TLVs at xxA0-xxFF,
* where xx denotes the upper byte
Expand Down
76 changes: 76 additions & 0 deletions boot/bootutil/include/bootutil/mcuboot_manifest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef __MCUBOOT_MANIFEST_H__
#define __MCUBOOT_MANIFEST_H__

/**
* @file mcuboot_manifest.h
*
* @note This file is only used when MCUBOOT_MANIFEST_UPDATES is enabled.
*/

#include <stdint.h>
#include "bootutil/bootutil.h"
#ifdef CONFIG_MCUBOOT
#include "bootutil/crypto/sha.h"
#elif defined(CONFIG_MCUBOOT_BOOTLOADER_USES_SHA512)
#define IMAGE_HASH_SIZE (64)
#else
#define IMAGE_HASH_SIZE (32)
#endif

#ifndef MCUBOOT_IMAGE_NUMBER
#ifdef CONFIG_UPDATEABLE_IMAGE_NUMBER
#define MCUBOOT_IMAGE_NUMBER CONFIG_UPDATEABLE_IMAGE_NUMBER
#else
#error "MCUBOOT_IMAGE_NUMBER must be defined when MCUBOOT_MANIFEST_UPDATES is enabled"
#endif
#endif

#ifndef __packed
#define __packed __attribute__((__packed__))
#endif

#ifdef __cplusplus
extern "C" {
#endif

/** Manifest structure for image updates. */
struct mcuboot_manifest {
uint32_t format;
uint32_t image_count;
/* Skip a digest of the MCUBOOT_MANIFEST_IMAGE_INDEX image. */
uint8_t image_hash[MCUBOOT_IMAGE_NUMBER - 1][IMAGE_HASH_SIZE];
} __packed;

/**
* @brief Check if the specified manifest has the correct format.
*
* @param[in] manifest The reference to the manifest structure.
*
* @return true on success.
*/
bool bootutil_verify_manifest(const struct mcuboot_manifest *manifest);

/**
* @brief Get the image hash from the manifest.
*
* @param[in] manifest The reference to the manifest structure.
* @param[in] image_index The index of the image to get the hash for.
* Must be in range <0, MCUBOOT_IMAGE_NUMBER - 1>, but
* must not be equal to MCUBOOT_MANIFEST_IMAGE_INDEX.
*
* @return true if hash matches with the manifest, false otherwise.
*/
bool bootutil_verify_manifest_image_hash(const struct mcuboot_manifest *manifest,
const uint8_t *exp_hash, uint32_t image_index);

#ifdef __cplusplus
}
#endif

#endif /* __MCUBOOT_MANIFEST_H__ */
Loading