Boot: Re-apply modifications after code sync
-Some of the security-related modifications were lost during code
synchronization (change-id: Ibe948792b306e96282fb82447bb3f05a0c6389ef).
Re-apply the usage of constant time memory equality functions and
overflow checks in the corresponding parts of the code.
-Use new boot_find_tlv_offs() function that came from mainstream MCUBoot
with the code synchronization.
Change-Id: I3d32dc128d4fc826ac09d752cb1484d189acfb4f
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/bl2/ext/mcuboot/bootutil/src/bootutil_misc.c b/bl2/ext/mcuboot/bootutil/src/bootutil_misc.c
index 8af74ca..eec7e5e 100644
--- a/bl2/ext/mcuboot/bootutil/src/bootutil_misc.c
+++ b/bl2/ext/mcuboot/bootutil/src/bootutil_misc.c
@@ -362,7 +362,7 @@
return rc;
}
- if (memcmp(magic, boot_img_magic, BOOT_MAGIC_SZ) == 0) {
+ if (boot_secure_memequal(magic, boot_img_magic, BOOT_MAGIC_SZ) == 0) {
return 0;
}