Skip to contentSkip to conversation

imx: hab: Use size parameter

PATCH New Marek Vasut 2 participants 2 messages Aug 31, 2023 – Oct 16, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx: hab: Use size parameter

The current code works by sheer coincidence, because (see HABv4 API documentation, section 3.4) the RVT authenticate_image call updates the size that is passed in with the actual size ROM code pulls from IVT/CSF . So if the input size is larger, that is "fine" . Pass in size instead to make this really correct.

---
NOTE: Rasmus, can you please double-check this one ? Thanks
---
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tim Harvey <[email protected]>

---
 arch/arm/mach-imx/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/spl.c +1 -1
index 6c13b00ef10..b30cd962553 100644
@@ -353,7 +353,7 @@ void *spl_load_simple_fit_fix_load(const void *fit)
 	debug("%s: ivt: %p offset: %lx size: %lx\n", __func__, ivt, offset, size);
 	debug("%s: ivt self: %x\n", __func__, ivt->self);
 
-	if (imx_hab_authenticate_image((uintptr_t)fit, (uintptr_t)ivt, offset))
+	if (imx_hab_authenticate_image((uintptr_t)fit, (uintptr_t)size, offset))
 		panic("spl: ERROR: image authentication unsuccessful\n");
 
 	return (void *)fit;
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/1 imx: hab: Use size parameter

Quoted 6 lines

The current code works by sheer coincidence, because (see HABv4 API documentation, section 3.4) the RVT authenticate_image call updates the size that is passed in with the actual size ROM code pulls from IVT/CSF . So if the input size is larger, that is "fine" . Pass in size instead to make this really correct.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================