Skip to content

Commit 4d85e29

Browse files
committed
bootutil: loader: Remove images with conflicting flags
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 <[email protected]>
1 parent 206c7e7 commit 4d85e29

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

boot/bootutil/src/loader.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,12 +888,24 @@ boot_is_header_valid(const struct image_header *hdr, const struct flash_area *fa
888888
if (IS_ENCRYPTED(hdr)) {
889889
return false;
890890
}
891+
#else
892+
if ((hdr->ih_flags & IMAGE_F_ENCRYPTED_AES128) &&
893+
(hdr->ih_flags & IMAGE_F_ENCRYPTED_AES256))
894+
{
895+
return false;
896+
}
891897
#endif
892898

893899
#if !defined(MCUBOOT_DECOMPRESS_IMAGES)
894900
if (IS_COMPRESSED(hdr)) {
895901
return false;
896902
}
903+
#else
904+
if ((hdr->ih_flags & IMAGE_F_COMPRESSED_LZMA1) &&
905+
(hdr->ih_flags & IMAGE_F_COMPRESSED_LZMA2))
906+
{
907+
return false;
908+
}
897909
#endif
898910

899911
return true;

0 commit comments

Comments
 (0)