summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2019-06-20 20:09:07 -0700
committerYe Li <ye.li@nxp.com>2019-06-21 00:50:21 -0700
commit47b0cf6de06ff9b3e2b2755d5c8203210378b26a (patch)
tree008ca6626e7ce3bb9b34cae3c1aaf0cb87239ec2 /common
parente74561bcaa67e11ed5889959ab22afb5a9885c82 (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>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_fit.c3
-rw-r--r--common/spl/spl_imx_romapi.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 4e294015e5..e68b4b5551 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -531,7 +531,8 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
spl_image->flags |= SPL_FIT_FOUND;
#ifdef CONFIG_SECURE_BOOT
- board_spl_fit_post_load((ulong)fit, size);
+ if (!(spl_image->flags & SPL_FIT_BYPASS_POST_LOAD))
+ board_spl_fit_post_load((ulong)fit, size);
#endif
return 0;
diff --git a/common/spl/spl_imx_romapi.c b/common/spl/spl_imx_romapi.c
index 84c222e628..b924c85d1a 100644
--- a/common/spl/spl_imx_romapi.c
+++ b/common/spl/spl_imx_romapi.c
@@ -160,6 +160,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);
return last - (ulong)fit;
}