]> git.sur5r.net Git - u-boot/commitdiff
arm: am33xx: security: Fix size calculation on header
authorMadan Srinivas <madans@ti.com>
Tue, 9 Jan 2018 20:32:41 +0000 (14:32 -0600)
committerTom Rini <trini@konsulko.com>
Fri, 19 Jan 2018 20:49:30 +0000 (15:49 -0500)
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 <madans@ti.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
arch/arm/mach-omap2/sec-common.c

index 2630e7d316a0d34af2368d928c7ff12e0e6ab282..674517e30bb88592881097df3132808be97b5816 100644 (file)
@@ -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 */