]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spl: imx: Add support for new PQC container
authorYe Li <ye.li@nxp.com>
Mon, 7 Jul 2025 20:42:55 +0000 (04:42 +0800)
committerFabio Estevam <festevam@gmail.com>
Thu, 17 Jul 2025 12:56:33 +0000 (09:56 -0300)
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>
arch/arm/mach-imx/image-container.c
common/spl/Kconfig
include/imx_container.h

index f84e23f4b2a2f124b152f94cb06c91d818b53e23..3a9e6dcf2257f2ceb227d43739601290cd0ecea7 100644 (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;
        }
index f69eff2110708c4af5799d83a86fe5d5a414f902..ac25fcea21d541d8bb214daa5f8021bf437e45e4 100644 (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
index 691c764b3e5bd9f9fc4c44bca8ede845c648d7d3..684fc3bc9886dcf630540df0b6e0dc44d8a4d74c 100644 (file)
 #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