[U-Boot] [PATCH v1 8/9] armv8: layerscape: falcon: Implement FIT image validation

York Sun york.sun at nxp.com
Mon May 15 16:16:08 UTC 2017


Validate OS FIT image for falcon boot. This requires the ESBC header
to be loaded at CONFIG_SYS_SPL_ARGS_ADDR.

Signed-off-by: York Sun <york.sun at nxp.com>
---

 arch/arm/cpu/armv8/fsl-layerscape/spl.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spl.c b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
index 3c366c2..d0dcf47 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
@@ -149,4 +149,29 @@ int board_fit_config_name_match(const char *name)
 	return 0;
 }
 #endif
+
+#ifdef CONFIG_SPL_FIT_IMAGE_SECURE_VALIDATE
+#ifndef CONFIG_SYS_SPL_ARGS_ADDR
+#error Need to load OS FIT header to CONFIG_SYS_SPL_ARGS_ADDR
+#endif
+void board_fit_image_secure_validate(void *fit)
+{
+	uintptr_t hdraddr = CONFIG_SYS_SPL_ARGS_ADDR;
+	uintptr_t img_addr = (uintptr_t)fit;
+	int ret;
+
+	if (fsl_check_boot_mode_secure() != 0) {
+		ret = fsl_secboot_validate(hdraddr,
+					   NULL,
+					   &img_addr);
+		if (ret != 0) {
+			printf("OS FIT validation failed\n");
+			while (1)
+				;
+		} else {
+			printf("OS FIT validation Successful\n");
+		}
+	}
+}
+#endif
 #endif /* CONFIG_SPL_BUILD */
-- 
2.7.4



More information about the U-Boot mailing list