]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: hab: Add function to authenticate kernel image
authorYe Li <ye.li@nxp.com>
Thu, 25 Mar 2021 09:30:06 +0000 (17:30 +0800)
committerStefano Babic <sbabic@denx.de>
Thu, 8 Apr 2021 07:18:29 +0000 (09:18 +0200)
When loading kernel image, the image size is parsed from header, so it
does not include the CSF and IVT.

Add back the authenticate_image function to wrap the imx_hab_authenticate_image
with calculating IVT offset and full image size.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
arch/arm/mach-imx/hab.c

index d0757d8b66af4502f752b338219834488e0e2e7c..66ac44034966c9f91a5babdef92c2d8a1598f79e 100644 (file)
@@ -698,3 +698,15 @@ hab_authentication_exit:
 
        return result;
 }
+
+int authenticate_image(u32 ddr_start, u32 raw_image_size)
+{
+       u32 ivt_offset;
+       size_t bytes;
+
+       ivt_offset = (raw_image_size + ALIGN_SIZE - 1) &
+                                       ~(ALIGN_SIZE - 1);
+       bytes = ivt_offset + IVT_SIZE + CSF_PAD_SIZE;
+
+       return imx_hab_authenticate_image(ddr_start, bytes, ivt_offset);
+}