summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2019-06-20 20:09:07 -0700
committerYe Li <ye.li@nxp.com>2022-04-06 18:02:52 +0800
commit44375ce44f45b7b9f6078bd35719511ce1ee990e (patch)
tree64087876735a8a4ce155c359f57f456e3c4f7340
parent9356fdb1673075822ab90691c2da81935dcb11b5 (diff)
MLK-22078 romapi: Fix issue for stream mode with secure boot enabled
When download image through ROM API for stream mode (USB, eMMC fastboot). We uses tricky way to get the total image size: The spl_load_simple_fit is called but the data reading is invalid, so the image data is not really downloaded. We should not call HAB authenticate in this tricky way. Otherwise it will alway fail. This patch add a new flag SPL_FIT_BYPASS_POST_LOAD to skip the authentication only for this tricky using. Signed-off-by: Ye Li <ye.li@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> (cherry picked from commit 47b0cf6de06ff9b3e2b2755d5c8203210378b26a) (cherry picked from commit 3e50573a7007771586e737b343bdde4d98c21c23) (cherry picked from commit 50ea462702262c65afbd1985d831edf16e47e212) (cherry picked from commit f1c7088597ea5a9d7172e2f0eb06348fb3beed5d) (cherry picked from commit 12859567e106cc47ab546c7aa059a4a4e0a0bb16)
-rw-r--r--arch/arm/mach-imx/spl_imx_romapi.c4
-rw-r--r--common/spl/spl_fit.c2
-rw-r--r--include/spl.h1
3 files changed, 6 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c
index d827de375a..4df9205af8 100644
--- a/arch/arm/mach-imx/spl_imx_romapi.c
+++ b/arch/arm/mach-imx/spl_imx_romapi.c
@@ -171,6 +171,10 @@ static ulong get_fit_image_size(void *fit)
spl_load_info.read = spl_ram_load_read;
spl_load_info.priv = &last;
+ /* We call load_simple_fit is just to get total size, the image is not downloaded,
+ * so should bypass authentication
+ */
+ spl_image.flags = SPL_FIT_BYPASS_POST_LOAD;
spl_load_simple_fit(&spl_image, &spl_load_info,
(uintptr_t)fit, fit);
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 967c20a452..26d3aff94a 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -852,7 +852,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
spl_image->flags |= SPL_FIT_FOUND;
- if (IS_ENABLED(CONFIG_IMX_HAB))
+ if (IS_ENABLED(CONFIG_IMX_HAB) && !(spl_image->flags & SPL_FIT_BYPASS_POST_LOAD))
board_spl_fit_post_load(ctx.fit);
return 0;
diff --git a/include/spl.h b/include/spl.h
index 8ceb3c0f09..ca60879eae 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -329,6 +329,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
#define SPL_COPY_PAYLOAD_ONLY 1
#define SPL_FIT_FOUND 2
+#define SPL_FIT_BYPASS_POST_LOAD 4
/**
* spl_load_legacy_img() - Loads a legacy image from a device.