From: Madan Srinivas Date: Tue, 9 Jan 2018 20:32:41 +0000 (-0600) Subject: arm: am33xx: security: Fix size calculation on header X-Git-Tag: v2018.03-rc1~133 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fbd23b9b94e848f715b8b5d34793fadc60190b35;p=u-boot arm: am33xx: security: Fix size calculation on header Fix the size calculation in the verify boot. The header size should be subtracted from the image size, not be assigned to the image size. Fixes: 0830d72bb9f8 ("arm: am33xx: security: adds auth support for encrypted images") Signed-off-by: Madan Srinivas Signed-off-by: Dan Murphy Signed-off-by: Andrew F. Davis Reviewed-by: Lokesh Vutla --- diff --git a/arch/arm/mach-omap2/sec-common.c b/arch/arm/mach-omap2/sec-common.c index 2630e7d316..674517e30b 100644 --- a/arch/arm/mach-omap2/sec-common.c +++ b/arch/arm/mach-omap2/sec-common.c @@ -130,7 +130,7 @@ int secure_boot_verify_image(void **image, size_t *size) *size = sig_addr - cert_addr; /* Subtract out the signature size */ /* Subtract header if present */ if (strncmp((char *)sig_addr, "CERT_ISW_", 9) == 0) - *size = ((u32 *)*image)[HEADER_SIZE_OFFSET]; + *size -= ((u32 *)*image)[HEADER_SIZE_OFFSET]; cert_size = *size; /* Check if image load address is 32-bit aligned */