Skip to content

Commit 087ff90

Browse files
committed
image: fix hardened hash compare sense
Use image_CT_compare directly in the protected RSA_VERIFY_HASH macro so signature confirmation only follows a real digest match. F/CI
1 parent e43cdd7 commit 087ff90

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

include/image.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,9 @@ static void __attribute__((noinline)) wolfBoot_image_clear_signature_ok(
424424
asm volatile("mov r0, #50":::"r0"); \
425425
asm volatile("mov r0, #50":::"r0"); \
426426
asm volatile("mov r0, #50":::"r0"); \
427-
compare_res = !image_CT_compare(digest, img->sha_hash, \
427+
compare_res = image_CT_compare(digest, img->sha_hash, \
428428
WOLFBOOT_SHA_DIGEST_SIZE); \
429-
/* Redundant checks that ensure the function actually returned 0 */ \
429+
/* Redundant checks that ensure the function actually returned 1 */ \
430430
asm volatile("cmp r0, #0":::"cc"); \
431431
asm volatile("cmp r0, #0":::"cc"); \
432432
asm volatile("cmp r0, #0":::"cc"); \
@@ -444,10 +444,10 @@ static void __attribute__((noinline)) wolfBoot_image_clear_signature_ok(
444444
asm volatile("cmp r0, #0":::"cc"); \
445445
asm volatile("bne hnope"); \
446446
/* Repeat comparison call */ \
447-
compare_res = !image_CT_compare(digest, img->sha_hash, \
447+
compare_res = image_CT_compare(digest, img->sha_hash, \
448448
WOLFBOOT_SHA_DIGEST_SIZE); \
449449
compare_res; \
450-
/* Redundant checks that ensure the function actually returned 0 */ \
450+
/* Redundant checks that ensure the function actually returned 1 */ \
451451
asm volatile("cmp r0, #0":::"cc"); \
452452
asm volatile("cmp r0, #0":::"cc"); \
453453
asm volatile("cmp r0, #0":::"cc"); \

0 commit comments

Comments
 (0)