Skip to content

Commit dfadb54

Browse files
committed
[nrf noup] zephyr: Fix issues with compression TLVs
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 dfadb54

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

boot/zephyr/decompression.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,17 @@ 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+
} else if (type == EXPECTED_HASH_TLV || type == EXPECTED_SIG_TLV) {
667+
/* Exclude the original unprotected TLVs for signature and hash, the length of the
668+
* signature of the compressed data might not be the same size as the signaute of the
669+
* decompressed data, as is the case when using ECDSA-P256
670+
*/
661671
continue;
662672
}
663673

0 commit comments

Comments
 (0)