Skip to content

Commit

Permalink
[nrf noup] zephyr: Fix compressed image support
Browse files Browse the repository at this point in the history
fixup! [nrf noup] zephyr: Add support for compressed image updates

Fixes some issues with compressed image update support

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
  • Loading branch information
nordicjm committed Oct 7, 2024
1 parent 22adc04 commit 27c83ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions boot/bootutil/src/image_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,16 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,
found_flag = &found_decompressed_sha;
break;
case IMAGE_TLV_DECOMP_SIGNATURE:
expected_size = SIG_BUF_SIZE;
found_flag = &found_decompressed_signature;
break;
default:
continue;
};

if (len != expected_size) {
if (type == IMAGE_TLV_DECOMP_SIGNATURE && !EXPECTED_SIG_LEN(len)) {
rc = -1;
goto out;
} else if (type != IMAGE_TLV_DECOMP_SIGNATURE && len != expected_size) {
rc = -1;
goto out;
}
Expand Down
2 changes: 1 addition & 1 deletion boot/zephyr/decompression.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ int boot_copy_region_decompress(struct boot_loader_state *state, const struct fl

/* Check if we have unwritten data buffered up and, if so, write it out */
if (decomp_buf_size > 0) {
uint32_t write_padding_size = decomp_buf_size % write_alignment;
uint32_t write_padding_size = write_alignment - (decomp_buf_size % write_alignment);

/* Check if additional write padding should be applied to meet the minimum write size */
if (write_padding_size) {
Expand Down

0 comments on commit 27c83ca

Please sign in to comment.