From 84a17fea21f8877a668f535145a105db4ccf791e Mon Sep 17 00:00:00 2001 From: Ye Li Date: Tue, 28 Apr 2026 18:09:58 +0800 Subject: imx: ahab: Use authenticated header for images loading When loading container image, the container header is loaded into heap memory. If ahab is enabled, the header is be copied to another fixed RAM for authentication in ahab_auth_cntr_hdr. The better method is using container header memory being authenticated for following image loading. So update ahab_auth_cntr_hdr to return the address of container header being authenticated. Caller uses this header for following parsing and image loading. Signed-off-by: Ye Li Reviewed-by: Peng Fan --- common/spl/spl_imx_container.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/spl/spl_imx_container.c b/common/spl/spl_imx_container.c index 79d021f81dc..57cd75b9b5e 100644 --- a/common/spl/spl_imx_container.c +++ b/common/spl/spl_imx_container.c @@ -88,6 +88,7 @@ static int read_auth_container(struct spl_image_info *spl_image, struct spl_load_info *info, ulong offset) { struct container_hdr *container = NULL; + struct container_hdr *authhdr; u16 length; int i, size, ret = 0; @@ -140,15 +141,19 @@ static int read_auth_container(struct spl_image_info *spl_image, } } + authhdr = container; + #ifdef CONFIG_AHAB_BOOT - ret = ahab_auth_cntr_hdr(container, length); - if (ret) + authhdr = ahab_auth_cntr_hdr(authhdr, length); + if (!authhdr) { + ret = -EINVAL; goto end_auth; + } #endif - for (i = 0; i < container->num_images; i++) { + for (i = 0; i < authhdr->num_images; i++) { struct boot_img_t *image = read_auth_image(spl_image, info, - container, i, + authhdr, i, offset); if (!image) { -- cgit v1.3.1