@@ -166,7 +166,7 @@ struct wolfBoot_image {
166166 * With ARMORED setup, the flag is redundant, and the information is wrapped in
167167 * between canary variables, to mitigate attacks based on memory corruptions.
168168 */
169- static void __attribute__(( noinline )) wolfBoot_image_confirm_signature_ok (
169+ static void NOINLINEFUNCTION wolfBoot_image_confirm_signature_ok (
170170 struct wolfBoot_image * img )
171171{
172172 img -> canary_FEED4567 = 0xFEED4567UL ;
@@ -176,7 +176,7 @@ static void __attribute__((noinline)) wolfBoot_image_confirm_signature_ok(
176176 img -> canary_FEED89AB = 0xFEED89ABUL ;
177177}
178178
179- static void __attribute__(( noinline )) wolfBoot_image_clear_signature_ok (
179+ static void NOINLINEFUNCTION wolfBoot_image_clear_signature_ok (
180180 struct wolfBoot_image * img )
181181{
182182 img -> canary_FEED4567 = 0xFEED4567UL ;
@@ -424,7 +424,8 @@ 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 = XMEMCMP (digest , img -> sha_hash , WOLFBOOT_SHA_DIGEST_SIZE ); \
427+ compare_res = image_CT_compare (digest , img -> sha_hash , \
428+ WOLFBOOT_SHA_DIGEST_SIZE ); \
428429 /* Redundant checks that ensure the function actually returned 0 */ \
429430 asm volatile ("cmp r0, #0" :::"cc" ); \
430431 asm volatile ("cmp r0, #0" :::"cc" ); \
@@ -442,8 +443,9 @@ static void __attribute__((noinline)) wolfBoot_image_clear_signature_ok(
442443 asm volatile ("cmp r0, #0" :::"cc" ); \
443444 asm volatile ("cmp r0, #0" :::"cc" ); \
444445 asm volatile ("bne hnope" ); \
445- /* Repeat memcmp call */ \
446- compare_res = XMEMCMP (digest , img -> sha_hash , WOLFBOOT_SHA_DIGEST_SIZE ); \
446+ /* Repeat comparison call */ \
447+ compare_res = image_CT_compare (digest , img -> sha_hash , \
448+ WOLFBOOT_SHA_DIGEST_SIZE ); \
447449 compare_res ; \
448450 /* Redundant checks that ensure the function actually returned 0 */ \
449451 asm volatile ("cmp r0, #0" :::"cc" ); \
@@ -1234,7 +1236,7 @@ static void UNUSEDFUNCTION wolfBoot_image_clear_signature_ok(
12341236 ret = fn(__VA_ARGS__);
12351237
12361238#define RSA_VERIFY_HASH (img ,digest ) \
1237- if (XMEMCMP (img->sha_hash, digest, WOLFBOOT_SHA_DIGEST_SIZE) == 0) \
1239+ if (image_CT_compare (img->sha_hash, digest, WOLFBOOT_SHA_DIGEST_SIZE) == 0) \
12381240 wolfBoot_image_confirm_signature_ok(img);
12391241
12401242#define PART_SANITY_CHECK (p ) \
@@ -1250,6 +1252,8 @@ static void UNUSEDFUNCTION wolfBoot_image_clear_signature_ok(
12501252#endif
12511253
12521254/* Defined in image.c */
1255+ int image_CT_compare (const uint8_t * expected , const uint8_t * actual ,
1256+ uint32_t len );
12531257int wolfBoot_open_image (struct wolfBoot_image * img , uint8_t part );
12541258#ifdef EXT_FLASH
12551259int wolfBoot_open_image_external (struct wolfBoot_image * img , uint8_t part , uint8_t * addr );
0 commit comments