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 <ye.li@nxp.com>
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
Ye Li
2025-07-08 04:42:55 +08:00
committed by Fabio Estevam
parent cb06e1082a
commit 42337445b5
3 changed files with 19 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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