The IVT is a self-describing structure which contains a self field. The
self field is the absolute physical base address the IVT ought to be at in
memory. Use the IVT self field to validate the calculated ivt_addr bugging
out if the two values differ.

Signed-off-by: Bryan O'Donoghue <bryan.odonog...@linaro.org>
Cc: Stefano Babic <sba...@denx.de>
Cc: Fabio Estevam <fabio.este...@nxp.com>
Cc: Peng Fan <peng....@nxp.com>
Cc: Albert Aribaud <albert.u.b...@aribaud.net>
Cc: Sven Ebenfeld <sven.ebenf...@gmail.com>
Cc: George McCollister <george.mccollis...@gmail.com>
Cc: Breno Matheus Lima <brenomath...@gmail.com>
---
 arch/arm/mach-imx/hab.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index cb6214d..479ed96 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -450,6 +450,13 @@ int authenticate_image(uint32_t ddr_start, uint32_t 
image_size,
        if (verify_ivt_header(ivt_hdr))
                goto hab_caam_clock_disable;
 
+       /* Verify IVT body */
+       if (ivt->self != ivt_addr) {
+               printf("ivt->self 0x%08x pointer is 0x%08x\n",
+                      ivt->self, ivt_addr);
+               goto hab_caam_clock_disable;
+       }
+
        start = ddr_start;
        bytes = image_size;
 #ifdef DEBUG
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to