Skip to content

Commit

Permalink
bootutil: loader: Remove images with conflicting flags
Browse files Browse the repository at this point in the history
Marks images as invalid if they have conflicting flags, e.g. more
than one type of LZMA compression or more than one type of
encryption

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
  • Loading branch information
nordicjm committed Aug 23, 2024
1 parent 0f141e3 commit 4a95b38
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions boot/bootutil/src/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,12 +885,24 @@ boot_is_header_valid(const struct image_header *hdr, const struct flash_area *fa
if (IS_ENCRYPTED(hdr)) {
return false;
}
#else
if ((hdr->ih_flags & IMAGE_F_ENCRYPTED_AES128) &&
(hdr->ih_flags & IMAGE_F_ENCRYPTED_AES256))
{
return false;
}
#endif

#if !defined(MCUBOOT_DECOMPRESS_IMAGES)
if (IS_COMPRESSED(hdr)) {
return false;
}
#else
if ((hdr->ih_flags & IMAGE_F_COMPRESSED_LZMA1) &&
(hdr->ih_flags & IMAGE_F_COMPRESSED_LZMA2))
{
return false;
}
#endif

return true;
Expand Down

0 comments on commit 4a95b38

Please sign in to comment.