From b728c62f6094b905947df9107770391a2958685f Mon Sep 17 00:00:00 2001 From: Stephane Le Roy Date: Wed, 15 Jan 2025 11:37:35 +0100 Subject: [PATCH] Expected TLV usage put under conditions --- boot/bootutil/src/image_validate.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/boot/bootutil/src/image_validate.c b/boot/bootutil/src/image_validate.c index 3f560f05d..9876b7767 100644 --- a/boot/bootutil/src/image_validate.c +++ b/boot/bootutil/src/image_validate.c @@ -358,10 +358,18 @@ bootutil_get_img_security_cnt(struct image_header *hdr, * TLV section. All other TLV entries must be in the protected section. */ static const uint16_t allowed_unprot_tlvs[] = { +#ifdef EXPECTED_KEY_TLV EXPECTED_KEY_TLV, +#endif /* EXPECTED_KEY_TLV */ +#ifdef EXPECTED_HASH_TLV EXPECTED_HASH_TLV, +#endif /* EXPECTED_HASH_TLV */ +#ifdef EXPECTED_SIG_TLV EXPECTED_SIG_TLV, +#endif /* EXPECTED_SIG_TLV */ +#ifdef EXPECTED_ENC_TLV EXPECTED_ENC_TLV, +#endif /* EXPECTED_ENC_TLV */ /* Mark end with ANY. */ IMAGE_TLV_ANY, };