-
Notifications
You must be signed in to change notification settings - Fork 146
Fixes 20260408 #745
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
base: master
Are you sure you want to change the base?
Fixes 20260408 #745
Changes from all commits
1c82453
87d5a7f
114140c
6f40afa
3278303
8399e3e
1442e1c
de4c33e
364b9d0
c6e7f79
2ab04ed
9715b4d
44c5b4a
12dd6be
30fb32f
47b61ba
0bcc49a
153ad2b
a5ea3ff
e22eade
1528bc8
dfc73ca
8e2f8b3
f5d50d4
0c4be70
e4e96ad
35142e6
04cc957
2f75363
e855c59
435e8d4
fc9e7a3
b705ca7
4d6f1d5
6ffae1a
1c07a99
0ab76ea
b8131a1
e60db57
399e875
c51bb6a
e5a42e3
62f6eca
040bcdb
fab609d
fff5222
d78c625
cdf8402
4c704a9
a5ef464
eca76ef
47815c0
642def1
4a007ab
9247787
491595b
ee9f21c
9b36e62
f8ec206
8842493
8033366
498453e
e43cdd7
087ff90
0a8a40f
546d4f4
8cdb8e9
0d6ad20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -424,8 +424,9 @@ static void __attribute__((noinline)) wolfBoot_image_clear_signature_ok( | |||||
| asm volatile("mov r0, #50":::"r0"); \ | ||||||
| asm volatile("mov r0, #50":::"r0"); \ | ||||||
| asm volatile("mov r0, #50":::"r0"); \ | ||||||
| compare_res = XMEMCMP(digest, img->sha_hash, WOLFBOOT_SHA_DIGEST_SIZE); \ | ||||||
| /* Redundant checks that ensure the function actually returned 0 */ \ | ||||||
| compare_res = image_CT_compare(digest, img->sha_hash, \ | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 [Critical] RSA_VERIFY_HASH armored inline asm checks r0==0 but image_CT_compare returns 1 on match The Suggestion:
Suggested change
|
||||||
| WOLFBOOT_SHA_DIGEST_SIZE); \ | ||||||
| /* Redundant checks that ensure the function actually returned 1 */ \ | ||||||
| asm volatile("cmp r0, #0":::"cc"); \ | ||||||
| asm volatile("cmp r0, #0":::"cc"); \ | ||||||
| asm volatile("cmp r0, #0":::"cc"); \ | ||||||
|
|
@@ -442,10 +443,11 @@ static void __attribute__((noinline)) wolfBoot_image_clear_signature_ok( | |||||
| asm volatile("cmp r0, #0":::"cc"); \ | ||||||
| asm volatile("cmp r0, #0":::"cc"); \ | ||||||
| asm volatile("bne hnope"); \ | ||||||
| /* Repeat memcmp call */ \ | ||||||
| compare_res = XMEMCMP(digest, img->sha_hash, WOLFBOOT_SHA_DIGEST_SIZE); \ | ||||||
| /* Repeat comparison call */ \ | ||||||
| compare_res = image_CT_compare(digest, img->sha_hash, \ | ||||||
| WOLFBOOT_SHA_DIGEST_SIZE); \ | ||||||
| compare_res; \ | ||||||
| /* Redundant checks that ensure the function actually returned 0 */ \ | ||||||
| /* Redundant checks that ensure the function actually returned 1 */ \ | ||||||
| asm volatile("cmp r0, #0":::"cc"); \ | ||||||
| asm volatile("cmp r0, #0":::"cc"); \ | ||||||
| asm volatile("cmp r0, #0":::"cc"); \ | ||||||
|
|
@@ -1234,7 +1236,7 @@ static void UNUSEDFUNCTION wolfBoot_image_clear_signature_ok( | |||||
| ret = fn(__VA_ARGS__); | ||||||
|
|
||||||
| #define RSA_VERIFY_HASH(img,digest) \ | ||||||
| if (XMEMCMP(img->sha_hash, digest, WOLFBOOT_SHA_DIGEST_SIZE) == 0) \ | ||||||
| if (image_CT_compare(img->sha_hash, digest, WOLFBOOT_SHA_DIGEST_SIZE)) \ | ||||||
danielinux marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| wolfBoot_image_confirm_signature_ok(img); | ||||||
|
|
||||||
| #define PART_SANITY_CHECK(p) \ | ||||||
|
|
@@ -1250,6 +1252,8 @@ static void UNUSEDFUNCTION wolfBoot_image_clear_signature_ok( | |||||
| #endif | ||||||
|
|
||||||
| /* Defined in image.c */ | ||||||
| int image_CT_compare(const uint8_t *expected, const uint8_t *actual, | ||||||
| uint32_t len); | ||||||
| int wolfBoot_open_image(struct wolfBoot_image *img, uint8_t part); | ||||||
| #ifdef EXT_FLASH | ||||||
| int wolfBoot_open_image_external(struct wolfBoot_image* img, uint8_t part, uint8_t* addr); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -58,8 +58,8 @@ | |||||
| /* Globals */ | ||||||
| static uint8_t digest[WOLFBOOT_SHA_DIGEST_SIZE] XALIGNED(4); | ||||||
|
|
||||||
| static int image_CT_compare(const uint8_t *expected, const uint8_t *actual, | ||||||
| uint32_t len) | ||||||
| int __attribute__((noinline)) image_CT_compare( | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ [Info] image_CT_compare uses attribute((noinline)) without portability guard The function uses Suggestion:
Suggested change
|
||||||
| const uint8_t *expected, const uint8_t *actual, uint32_t len) | ||||||
| { | ||||||
| uint8_t diff = 0; | ||||||
| uint32_t i; | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.