Skip to content

Commit f04198e

Browse files
committed
[nrf noup] zephyr: Fix issues with ARM thumb decompression
fixup! [nrf noup] zephyr: Add support for compressed image updates Fixes an issue when using ECDSA-P256 signing whereby the signature output size is not a fixed length, and varies Signed-off-by: Jamie McCrae <[email protected]>
1 parent 4fc8d2d commit f04198e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

boot/zephyr/decompression.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,19 @@ int boot_size_unprotected_tlvs(const struct image_header *hdr, const struct flas
657657
} else if (rc > 0) {
658658
rc = 0;
659659
break;
660-
} else if (bootutil_tlv_iter_is_prot(&it, off)) {
660+
} else if (bootutil_tlv_iter_is_prot(&it, off) && type != IMAGE_TLV_DECOMP_SHA &&
661+
type != IMAGE_TLV_DECOMP_SIGNATURE) {
662+
/* Include size of protected hash and signature as these will be replacing the
663+
* original ones
664+
*/
665+
continue;
666+
}
667+
668+
/* Exclude the original unprotected TLVs for signature and hash, the length of the
669+
* signature of the compressed data might not be the same size as the signaute of the
670+
* decompressed data, as is the case when using ECDSA-P256
671+
*/
672+
if (type == EXPECTED_HASH_TLV || type == EXPECTED_SIG_TLV) {
661673
continue;
662674
}
663675

0 commit comments

Comments
 (0)