From: Ye Li Date: Mon, 7 Jul 2025 20:42:55 +0000 (+0800) Subject: spl: imx: Add support for new PQC container X-Git-Tag: v2025.10-rc1~53^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42337445b55c79d8a820b4eec9536a7844839372;p=thirdparty%2Fu-boot.git spl: imx: Add support for new PQC container To support PQC container format which is used for post quantum authentication on new i.MX parts like i.MX94 The major changes compared to legacy container format is in signature block, new container tag and version, and new alignment of container header. Signed-off-by: Ye Li Signed-off-by: Jacky Bai Signed-off-by: Alice Guo Acked-by: Peng Fan --- diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c index f84e23f4b2a..3a9e6dcf225 100644 --- a/arch/arm/mach-imx/image-container.c +++ b/arch/arm/mach-imx/image-container.c @@ -66,7 +66,7 @@ static bool is_v2x_fw_container(ulong addr) struct boot_img_t *img_entry; phdr = (struct container_hdr *)addr; - if (phdr->tag != 0x87 || phdr->version != 0x0) { + if ((phdr->tag != 0x87 && phdr->tag != 0x82) || phdr->version != 0x0) { debug("Wrong container header\n"); return false; } diff --git a/common/spl/Kconfig b/common/spl/Kconfig index f69eff21107..ac25fcea21d 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -371,6 +371,13 @@ config SPL_IMX_CONTAINER_USE_TRAMPOLINE help Enable SPL load reader to load data to a trampoline buffer. +config IMX_PQC_SUPPORT + bool "Enable to support i.MX ROM PQC Container" + depends on SPL && SPL_LOAD_IMX_CONTAINER + help + Support i.MX ROM new PQC container format. If your chip does not use + PQC container, say 'n'. + config IMX_CONTAINER_CFG string "i.MX8 Container config file" depends on SPL && SPL_LOAD_IMX_CONTAINER diff --git a/include/imx_container.h b/include/imx_container.h index 691c764b3e5..684fc3bc988 100644 --- a/include/imx_container.h +++ b/include/imx_container.h @@ -12,7 +12,11 @@ #define IV_MAX_LEN 32 #define HASH_MAX_LEN 64 +#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT) +#define CONTAINER_HDR_ALIGNMENT 0x4000 +#else #define CONTAINER_HDR_ALIGNMENT 0x400 +#endif #define CONTAINER_HDR_EMMC_OFFSET 0 #define CONTAINER_HDR_MMCSD_OFFSET SZ_32K #define CONTAINER_HDR_QSPI_OFFSET SZ_4K @@ -72,7 +76,14 @@ int get_container_size(ulong addr, u16 *header_length); static inline bool valid_container_hdr(struct container_hdr *container) { +#if IS_ENABLED(CONFIG_IMX_PQC_SUPPORT) + return (container->tag == CONTAINER_HDR_TAG || + container->tag == 0x82) && + (container->version == CONTAINER_HDR_VERSION || + container->version == 0x2); +#else return container->tag == CONTAINER_HDR_TAG && container->version == CONTAINER_HDR_VERSION; +#endif } #endif