@@ -245,6 +245,7 @@ bootutil_img_hash(struct enc_key_data *enc_state, int image_index,
245
245
# define KEY_BUF_SIZE (SIG_BUF_SIZE + 24)
246
246
#endif /* !MCUBOOT_HW_KEY */
247
247
248
+ #if !defined(CONFIG_BOOT_SIGNATURE_USING_KMU )
248
249
#if !defined(MCUBOOT_HW_KEY )
249
250
static int
250
251
bootutil_find_key (uint8_t * keyhash , uint8_t keyhash_len )
@@ -310,6 +311,7 @@ bootutil_find_key(uint8_t image_index, uint8_t *key, uint16_t key_len)
310
311
}
311
312
#endif /* !MCUBOOT_HW_KEY */
312
313
#endif /* !MCUBOOT_BUILTIN_KEY */
314
+ #endif /* !defined(CONFIG_BOOT_SIGNATURE_USING_KMU) */
313
315
#endif /* EXPECTED_SIG_TLV */
314
316
315
317
/**
@@ -627,6 +629,7 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,
627
629
break ;
628
630
}
629
631
#endif /* defined(EXPECTED_HASH_TLV) && !defined(MCUBOOT_SIGN_PURE) */
632
+ #if !defined(CONFIG_BOOT_SIGNATURE_USING_KMU )
630
633
#ifdef EXPECTED_KEY_TLV
631
634
case EXPECTED_KEY_TLV :
632
635
{
@@ -657,14 +660,17 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,
657
660
break ;
658
661
}
659
662
#endif /* EXPECTED_KEY_TLV */
663
+ #endif /* !defined(CONFIG_BOOT_SIGNATURE_USING_KMU) */
660
664
#ifdef EXPECTED_SIG_TLV
661
665
case EXPECTED_SIG_TLV :
662
666
{
667
+ #if !defined(CONFIG_BOOT_SIGNATURE_USING_KMU )
663
668
/* Ignore this signature if it is out of bounds. */
664
669
if (key_id < 0 || key_id >= bootutil_key_cnt ) {
665
670
key_id = -1 ;
666
671
continue ;
667
672
}
673
+ #endif /* !defined(CONFIG_BOOT_SIGNATURE_USING_KMU) */
668
674
if (!EXPECTED_SIG_LEN (len ) || len > sizeof (buf )) {
669
675
rc = -1 ;
670
676
goto out ;
@@ -810,7 +816,7 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,
810
816
}
811
817
812
818
#ifdef EXPECTED_SIG_TLV
813
- #ifdef EXPECTED_KEY_TLV
819
+ #if !defined( CONFIG_BOOT_SIGNATURE_USING_KMU ) && defined( EXPECTED_KEY_TLV )
814
820
rc = bootutil_tlv_iter_begin (& it , hdr , fap , EXPECTED_KEY_TLV , false);
815
821
if (rc ) {
816
822
goto out ;
@@ -856,7 +862,7 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,
856
862
*/
857
863
}
858
864
}
859
- #endif /* EXPECTED_KEY_TLV */
865
+ #endif /* !CONFIG_BOOT_SIGNATURE_USING_KMU && EXPECTED_KEY_TLV */
860
866
861
867
rc = bootutil_tlv_iter_begin (& it , hdr , fap , IMAGE_TLV_DECOMP_SIGNATURE , true);
862
868
if (rc ) {
@@ -879,10 +885,12 @@ bootutil_img_validate(struct enc_key_data *enc_state, int image_index,
879
885
880
886
if (type == IMAGE_TLV_DECOMP_SIGNATURE ) {
881
887
/* Ignore this signature if it is out of bounds. */
888
+ #if !defined(CONFIG_BOOT_SIGNATURE_USING_KMU )
882
889
if (key_id < 0 || key_id >= bootutil_key_cnt ) {
883
890
key_id = -1 ;
884
891
continue ;
885
892
}
893
+ #endif
886
894
887
895
if (!EXPECTED_SIG_LEN (len ) || len > sizeof (buf )) {
888
896
rc = -1 ;
0 commit comments