Commit 4d85e29f authored by Jamie McCrae's avatar Jamie McCrae Committed by Jamie
Browse files

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: default avatarJamie McCrae <jamie.mccrae@nordicsemi.no>
parent 206c7e74
Loading
Loading
Loading
Loading
+12 −0
Changes for boot/bootutil/src/loader.c: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -888,12 +888,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;