summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUtkarsh Gupta <utkarsh.gupta@nxp.com>2017-11-17 19:23:08 -0600
committerUtkarsh Gupta <utkarsh.gupta@nxp.com>2017-11-17 19:23:08 -0600
commit0088d127ab47a3725f2c8eecd008280f375ffd0b (patch)
tree4704346ea65688ff98640504bcbaf3454f7c2c59
parent1167e4dae890dd74f2f181c5b01bf8f5c5ba4977 (diff)
MLK-14945 HAB: Check if IVT valid before authenticating image
For proper authentication users must check the IVT before authenticating the kernel image. If the IVT DCD pointer is not 0, display an error as shown below and return a boot failure. Authenticate image from DDR location 0x12000000... Error: DCD pointer must be 0 Authenticate zImage Fail, Please check Signed-off-by: Utkarsh Gupta <utkarsh.gupta@nxp.com>
-rw-r--r--arch/arm/imx-common/hab.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm/imx-common/hab.c b/arch/arm/imx-common/hab.c
index 0747e499b1..62c51c37f8 100644
--- a/arch/arm/imx-common/hab.c
+++ b/arch/arm/imx-common/hab.c
@@ -671,6 +671,18 @@ uint32_t authenticate_image(uint32_t ddr_start, uint32_t image_size)
}
}
#endif
+
+ /* Report boot failure if DCD pointer is found in IVT */
+ unsigned char *dcd_ptr = (unsigned char *)(ddr_start + ivt_offset + 0xC);
+
+ do {
+ if (*dcd_ptr) {
+ puts("Error: DCD pointer must be 0\n");
+ return result;
+ }
+ dcd_ptr++;
+ } while (dcd_ptr < (unsigned char *)(ddr_start + ivt_offset + 0x10));
+
load_addr = (ulong)hab_rvt_authenticate_image(
HAB_CID_UBOOT,
ivt_offset, (void **)&start,