Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/sim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- "sig-rsa validate-primary-slot ram-load multiimage"
- "sig-rsa validate-primary-slot direct-xip multiimage"
- "sig-ecdsa hw-rollback-protection multiimage"
- "overwrite-only delta-dfu,sig-ecdsa overwrite-only delta-dfu,sig-ecdsa overwrite-only delta-dfu hw-rollback-protection"
- "sig-ed25519 sig-second-key"
# Logical sectors: swap bookkeeping in fixed 4K units
# independent of the physical page layout. Covers each
Expand Down
1 change: 1 addition & 0 deletions boot/bootutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ target_sources(bootutil
src/bootutil_img_security_cnt.c
src/bootutil_misc.c
src/bootutil_area.c
src/delta.c
src/bootutil_loader.c
src/bootutil_public.c
src/caps.c
Expand Down
1 change: 1 addition & 0 deletions boot/bootutil/include/bootutil/caps.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ uint32_t bootutil_get_caps(void);
#define BOOTUTIL_CAP_HW_ROLLBACK_PROT (1<<18)
#define BOOTUTIL_CAP_ECDSA_P384 (1<<19)
#define BOOTUTIL_CAP_SWAP_USING_OFFSET (1<<20)
#define BOOTUTIL_CAP_DELTA_DFU (1<<21)

/*
* Query the number of images this bootloader is configured for. This
Expand Down
14 changes: 9 additions & 5 deletions boot/bootutil/include/bootutil/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ extern "C" {
#define IMAGE_F_COMPRESSED_LZMA1 0x00000200
#define IMAGE_F_COMPRESSED_LZMA2 0x00000400
#define IMAGE_F_COMPRESSED_ARM_THUMB_FLT 0x00000800
#define IMAGE_F_DELTA 0x00001000

/*
* ECSDA224 is with NIST P-224
Expand Down Expand Up @@ -119,13 +120,13 @@ extern "C" {
#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 */
/* The following flags relate to transformed images and their output image data */
#define IMAGE_TLV_DECOMP_SIZE 0x70 /* Decompressed image size excluding header/TLVs */
#define IMAGE_TLV_DECOMP_SHA 0x71 /*
* Decompressed image shaX hash, this field must match
* the format and size of the raw slot (compressed)
* shaX hash
#define IMAGE_TLV_OUTPUT_SHA 0x71 /*
* Output image shaX hash, this field must match the
* format and size of the input image shaX hash
*/
#define IMAGE_TLV_DECOMP_SHA IMAGE_TLV_OUTPUT_SHA /* Compatibility alias */
#define IMAGE_TLV_DECOMP_SIGNATURE 0x72 /*
* Decompressed image signature, this field must match
* the format and size of the raw slot (compressed)
Expand All @@ -134,6 +135,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_DELTA_BASE_SHA 0x76 /* SHA of image the delta applies to */
/*
* vendor reserved TLVs at xxA0-xxFF,
* where xx denotes the upper byte
Expand Down Expand Up @@ -199,6 +201,8 @@ STRUCT_PACKED image_tlv {
#define MUST_DECOMPRESS(fap, idx, hdr) \
(flash_area_get_id(fap) == FLASH_AREA_IMAGE_SECONDARY(idx) && IS_COMPRESSED(hdr))

#define IS_DELTA(hdr) ((hdr)->ih_flags & IMAGE_F_DELTA)

_Static_assert(sizeof(struct image_header) == IMAGE_HEADER_SIZE,
"struct image_header not required size");

Expand Down
4 changes: 4 additions & 0 deletions boot/bootutil/src/bootutil_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ int boot_copy_region(struct boot_loader_state *state,
#endif
bool boot_status_is_reset(const struct boot_status *bs);

#ifdef MCUBOOT_DELTA_DFU
int boot_delta_apply(struct boot_loader_state *state, struct boot_status *bs);
#endif

#ifdef MCUBOOT_ENC_IMAGES
int boot_write_enc_keys(const struct flash_area *fap, const struct boot_status *bs);
bool boot_read_enc_key(const struct flash_area *fap, uint8_t slot,
Expand Down
3 changes: 3 additions & 0 deletions boot/bootutil/src/caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ uint32_t bootutil_get_caps(void)
#if defined(MCUBOOT_HW_ROLLBACK_PROT)
res |= BOOTUTIL_CAP_HW_ROLLBACK_PROT;
#endif
#if defined(MCUBOOT_DELTA_DFU)
res |= BOOTUTIL_CAP_DELTA_DFU;
#endif

return res;
}
Expand Down
Loading