diff options
author | Breno Lima <breno.lima@nxp.com> | 2021-03-25 17:30:12 +0800 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2021-04-08 09:18:29 +0200 |
commit | f217470b392806be340e9c03d46e98bb29d7caec (patch) | |
tree | 49d83c656929031a4e22c713501ac6014e691cc3 | |
parent | cd8355664db363768b672f9a362044e2db9bd86c (diff) | |
download | u-boot-f217470b392806be340e9c03d46e98bb29d7caec.zip u-boot-f217470b392806be340e9c03d46e98bb29d7caec.tar.gz u-boot-f217470b392806be340e9c03d46e98bb29d7caec.tar.bz2 |
imx: hab: Check if IVT header is HABv4
The HABv4 implementation in ROM checks if HAB major version
in IVT header is 4.x.
The current implementation in hab.c code is only validating
HAB v4.0 and HAB v4.1 and may be incompatible with newer
HABv4 versions.
Modify verify_ivt_header() function to align with HABv4
implementation in ROM code.
Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r-- | arch/arm/include/asm/mach-imx/hab.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/hab.c | 3 |
2 files changed, 1 insertions, 4 deletions
diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index c4393ef..6221881 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -18,8 +18,6 @@ */ #define IVT_HEADER_MAGIC 0xD1 #define IVT_TOTAL_LENGTH 0x20 -#define IVT_HEADER_V1 0x40 -#define IVT_HEADER_V2 0x41 struct __packed ivt_header { uint8_t magic; diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 264e148..5f46df0 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -45,8 +45,7 @@ static int verify_ivt_header(struct ivt_header *ivt_hdr) if (be16_to_cpu(ivt_hdr->length) != IVT_TOTAL_LENGTH) result = ivt_header_error("bad length", ivt_hdr); - if (ivt_hdr->version != IVT_HEADER_V1 && - ivt_hdr->version != IVT_HEADER_V2) + if ((ivt_hdr->version & HAB_MAJ_MASK) != HAB_MAJ_VER) result = ivt_header_error("bad version", ivt_hdr); return result; |