Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrf noup] boot: bootutil: image_validate: Add KMU support to compres… #388

Merged
merged 1 commit into from
Dec 12, 2024
Merged
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
6 changes: 4 additions & 2 deletions boot/bootutil/src/image_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,
}

#ifdef EXPECTED_SIG_TLV
#ifdef EXPECTED_KEY_TLV
#if !defined(CONFIG_BOOT_SIGNATURE_USING_KMU) && defined(EXPECTED_KEY_TLV)
rc = bootutil_tlv_iter_begin(&it, hdr, fap, EXPECTED_KEY_TLV, false);
if (rc) {
goto out;
Expand Down Expand Up @@ -861,7 +861,7 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,
*/
}
}
#endif /* EXPECTED_KEY_TLV */
#endif /* !CONFIG_BOOT_SIGNATURE_USING_KMU && EXPECTED_KEY_TLV */

rc = bootutil_tlv_iter_begin(&it, hdr, fap, IMAGE_TLV_DECOMP_SIGNATURE, true);
if (rc) {
Expand All @@ -884,10 +884,12 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,

if (type == IMAGE_TLV_DECOMP_SIGNATURE) {
/* Ignore this signature if it is out of bounds. */
#if !defined(CONFIG_BOOT_SIGNATURE_USING_KMU)
if (key_id < 0 || key_id >= bootutil_key_cnt) {
key_id = -1;
continue;
}
#endif

if (!EXPECTED_SIG_LEN(len) || len > sizeof(buf)) {
rc = -1;
Expand Down