Skip to content

Commit

Permalink
bootutil: Add compressed image flags and TLV
Browse files Browse the repository at this point in the history
Adds some flags to indicate if the data of an image is compressed
(lzma1 and lzma2) and adds new TLVs for compressed images relating
to the hash, signature and size of the decompressed image data,
this allows the image to be validated before decompressing, then
validated after decompression to ensure an image is always valid
for a device

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
  • Loading branch information
nordicjm committed Aug 9, 2024
1 parent ef598b1 commit 25caa7a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions boot/bootutil/include/bootutil/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ struct flash_area;
*/
#define IMAGE_F_ROM_FIXED 0x00000100

/*
* Flags that indicate if the image data is compressed
*/
#define IMAGE_F_COMPRESSED_LZMA1 0x00000200
#define IMAGE_F_COMPRESSED_LZMA2 0x00000400

/*
* ECSDA224 is with NIST P-224
* ECSDA256 is with NIST P-256
Expand Down Expand Up @@ -101,6 +107,18 @@ struct flash_area;
#define IMAGE_TLV_DEPENDENCY 0x40 /* Image depends on other image */
#define IMAGE_TLV_SEC_CNT 0x50 /* security counter */
#define IMAGE_TLV_BOOT_RECORD 0x60 /* measured boot record */
/* The following flags relate to compressed images and are for the decompressed image data */
#define IMAGE_TLV_COMP_SIZE 0x70 /* Decompressed image size */
#define IMAGE_TLV_COMP_SHA 0x71 /*
* Decompressed image shaX hash, this field must match
* the format and size of the raw slot (compressed)
* shaX hash
*/
#define IMAGE_TLV_COMP_SIGNATURE 0x72 /*
* Decompressed image signature, this field must match
* the format and size of the raw slot (compressed)
* signature
*/
/*
* vendor reserved TLVs at xxA0-xxFF,
* where xx denotes the upper byte
Expand Down

0 comments on commit 25caa7a

Please sign in to comment.