Skip to contentSkip to conversation

imx8: support container

PATCH New Peng Fan 7 participants 49 messages May 7, 2019 – Jun 6, 2019

Subsystems (4)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

cover imx8: support container

This patchset is to support i.MX8 container loading from SPL, i.MX8 AHAB secure boot not support FIT image, so we need to use container image.

Currently still use a fixed offset for the 2nd container(u-boot.cnt), future patches will drop this fixed offset and use dynamaic offset according to the size of 1st container for spl.
Only MMC is supported now, future patches will also support SPI/NOR/NAND following similar style as mmc part, if the mmc part is ok.

Build pass: https://travis-ci.org/MrVan/u-boot/builds/529180267

Peng Fan (6):
imx: mach-imx: clean up Makefile
spl: Add function to get u-boot raw sector
imx8: support parsing i.MX8 Container file
spl: mmc: support loading i.MX container format file
imx: add container target
imx8qxp_mek: switch to use container image

 Makefile                                        |   8 ++
 arch/arm/include/asm/arch-imx8/image.h          |  56 +++++++++++
 arch/arm/mach-imx/Makefile                      |  26 +++--
 arch/arm/mach-imx/imx8/Kconfig                  |  13 +++
 arch/arm/mach-imx/imx8/Makefile                 |   4 +
 arch/arm/mach-imx/imx8/parse-container.c        | 120 ++++++++++++++++++++++++
 board/freescale/imx8qxp_mek/README              |   4 +-
 board/freescale/imx8qxp_mek/uboot-container.cfg |  13 +++
 common/spl/spl_mmc.c                            |  21 ++++-
 configs/imx8qxp_mek_defconfig                   |   5 +-
 include/spl.h                                   |  12 +++
 11 files changed, 268 insertions(+), 14 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-imx8/image.h
 create mode 100644 arch/arm/mach-imx/imx8/parse-container.c
 create mode 100644 board/freescale/imx8qxp_mek/uboot-container.cfg
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH 1/6 imx: mach-imx: clean up Makefile

Only eval the variables when building related target, then we will not see unrelated warning that when building spl and u-boot.

---
 arch/arm/mach-imx/Makefile | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-imx/Makefile +6 -6
index 37675d0558..0562640599 100644
@@ -104,18 +104,15 @@ IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%)
 	$(Q)mkdir -p $(dir $@)
 	$(call if_changed_dep,cpp_cfg)
 
+DEPFILE_EXISTS := 0
 ifeq ($(CONFIG_ARCH_IMX8), y)
 CNTR_DEPFILES := $(srctree)/tools/imx_cntr_image.sh
 IMAGE_TYPE := imx8image
-SPL_DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout $(srctree)/$(IMX_CONFIG); if [ -f spl/u-boot-spl.cfgout ]; then $(CNTR_DEPFILES) spl/u-boot-spl.cfgout; echo $$?; fi)
-DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout $(srctree)/$(IMX_CONFIG); if [ -f u-boot-dtb.cfgout ]; then $(CNTR_DEPFILES) u-boot-dtb.cfgout; echo $$?; fi)
 else ifeq ($(CONFIG_ARCH_IMX8M), y)
 IMAGE_TYPE := imx8mimage
 IMX8M_DEPFILES := $(srctree)/tools/imx8m_image.sh
-DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout $(srctree)/$(IMX_CONFIG);if [ -f spl/u-boot-spl.cfgout ]; then $(IMX8M_DEPFILES) spl/u-boot-spl.cfgout 0; echo $$?; fi)
 else
 IMAGE_TYPE := imximage
-DEPFILE_EXISTS := 0
 endif
 
 MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
@@ -139,30 +136,33 @@ endif
 
 ifdef CONFIG_ARM64
 ifeq ($(CONFIG_ARCH_IMX8M), y)
-SPL:
+SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
 
 MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout \
 		   -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE)
 flash.bin: MKIMAGEOUTPUT = flash.log
 
 spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
+	$(eval DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout $(srctree)/$(IMX_CONFIG);if [ -f spl/u-boot-spl.cfgout ]; then $(IMX8M_DEPFILES) spl/u-boot-spl.cfgout 0; echo $$?; fi))
 ifeq ($(DEPFILE_EXISTS),0)
 	$(IMX8M_DEPFILES) spl/u-boot-spl.cfgout 1
 endif
 
 flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE
+	$(eval DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout $(srctree)/$(IMX_CONFIG);if [ -f spl/u-boot-spl.cfgout ]; then $(IMX8M_DEPFILES) spl/u-boot-spl.cfgout 0; echo $$?; fi))
 ifeq ($(DEPFILE_EXISTS),0)
 	$(call if_changed,mkimage)
 endif
 endif
 
 ifeq ($(CONFIG_ARCH_IMX8), y)
-SPL:
+SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
 
 MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e 0x100000
 flash.bin: MKIMAGEOUTPUT = flash.log
 
 flash.bin: spl/u-boot-spl.bin u-boot.itb FORCE
+	$(eval SPL_DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout $(srctree)/$(IMX_CONFIG); if [ -f spl/u-boot-spl.cfgout ]; then $(CNTR_DEPFILES) spl/u-boot-spl.cfgout; echo $$?; fi))
 ifeq ($(SPL_DEPFILE_EXISTS),0)
 	$(call if_changed,mkimage)
 endif
Signature · 1 line
2.16.4
author
#2 lore raw

PATCH 2/6 spl: Add function to get u-boot raw sector

In reply to Peng Fan

Add a weak function spl_mmc_get_uboot_raw_sector to get u-boot raw sector. At default it returns CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR. Users can overwrite it to return customized offset.

This is to support i.MX8 specific image type container image type.

Cc Tien Fong Chee <[email protected]>
Cc Peng Fan <[email protected]>
Cc Simon Goldschmidt <[email protected]>
Cc York Sun <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Alex Kiernan <[email protected]>
---
 common/spl/spl_mmc.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
common/spl/spl_mmc.c +9 -2
index 324d91c884..bf53a1dadf 100644
@@ -149,6 +149,13 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
 	return 0;
 }
 
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+unsigned long __weak spl_mmc_get_uboot_raw_sector(struct mmc *mmc)
+{
+	return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
+}
+#endif
+
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
 static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
 					struct mmc *mmc, int partition)
@@ -181,7 +188,7 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
 	return mmc_load_image_raw_sector(spl_image, mmc,
-			info.start + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+			info.start + spl_mmc_get_uboot_raw_sector(mmc));
 #else
 	return mmc_load_image_raw_sector(spl_image, mmc, info.start);
 #endif
@@ -366,7 +373,7 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,
 #endif
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
 		err = mmc_load_image_raw_sector(spl_image, mmc,
-			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+			spl_mmc_get_uboot_raw_sector(mmc));
 		if (!err)
 			return err;
 #endif
Signature · 1 line
2.16.4
author
#3 lore raw

PATCH 3/6 imx8: support parsing i.MX8 Container file

In reply to Peng Fan

Add parsing i.MX8 Container file support, this is to let SPL could load images in a container file to destination address.

---
 arch/arm/include/asm/arch-imx8/image.h   |  56 +++++++++++++++
 arch/arm/mach-imx/imx8/Kconfig           |   6 ++
 arch/arm/mach-imx/imx8/Makefile          |   4 ++
 arch/arm/mach-imx/imx8/parse-container.c | 120 +++++++++++++++++++++++++++++++
 4 files changed, 186 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-imx8/image.h
 create mode 100644 arch/arm/mach-imx/imx8/parse-container.c
arch/arm/include/asm/arch-imx8/image.h new file +56 -0
new file mode 100644
index 0000000000..c1e5700859
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2018-2019 NXP
+ */
+
+#ifndef __CONTAINER_HEADER_H_
+#define __CONTAINER_HEADER_H_
+
+#include <linux/sizes.h>
+#include <linux/types.h>
+
+#define IV_MAX_LEN			32
+#define HASH_MAX_LEN			64
+
+#define CONTAINER_HDR_ALIGNMENT 0x400
+#define CONTAINER_HDR_EMMC_OFFSET 0
+#define CONTAINER_HDR_MMCSD_OFFSET SZ_32K
+#define CONTAINER_HDR_QSPI_OFFSET SZ_4K
+#define CONTAINER_HDR_NAND_OFFSET SZ_128M
+
+struct container_hdr {
+	u8 version;
+	u8 length_lsb;
+	u8 length_msb;
+	u8 tag;
+	u32 flags;
+	u16 sw_version;
+	u8 fuse_version;
+	u8 num_images;
+	u16 sig_blk_offset;
+	u16 reserved;
+} __packed;
+
+struct boot_img_t {
+	u32 offset;
+	u32 size;
+	u64 dst;
+	u64 entry;
+	u32 hab_flags;
+	u32 meta;
+	u8 hash[HASH_MAX_LEN];
+	u8 iv[IV_MAX_LEN];
+} __packed;
+
+struct signature_block_hdr {
+	u8 version;
+	u8 length_lsb;
+	u8 length_msb;
+	u8 tag;
+	u16 srk_table_offset;
+	u16 cert_offset;
+	u16 blob_offset;
+	u16 signature_offset;
+	u32 reserved;
+} __packed;
+#endif
arch/arm/mach-imx/imx8/Kconfig +6 -0
index c32f7dbb61..8e6b79eb77 100644
@@ -23,6 +23,12 @@ config IMX8QXP
 config SYS_SOC
 	default "imx8"
 
+config SPL_LOAD_IMX_CONTAINER
+	bool "Enable SPL loading U-Boot as a i.MX Container image"
+	depends on SPL
+	help
+	  This is to let SPL could load i.MX8 Container image
+
 choice
 	prompt "i.MX8 board select"
 	optional
arch/arm/mach-imx/imx8/Makefile +4 -0
index 31ad169ccf..19690110a5 100644
@@ -5,3 +5,7 @@
 #
 
 obj-y += cpu.o iomux.o
+
+ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_SPL_LOAD_IMX_CONTAINER) += parse-container.o
+endif
arch/arm/mach-imx/imx8/parse-container.c new file +120 -0

120 lines not on this page · raw message

Signature · 1 line
2.16.4
author
#4 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

In reply to Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container support to let SPL could load container images.

Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
Cc York Sun <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Alex Kiernan <[email protected]>
Cc Simon Glass <[email protected]>
Cc Philipp Tomsich <[email protected]>
Cc Kever Yang <[email protected]>
Cc Heiko Schocher <[email protected]>
---
 common/spl/spl_mmc.c | 10 ++++++++++
 include/spl.h        | 12 ++++++++++++
 2 files changed, 22 insertions(+)
common/spl/spl_mmc.c +10 -0
index bf53a1dadf..6320af055b 100644
@@ -79,6 +79,16 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
 		load.bl_len = mmc->read_bl_len;
 		load.read = h_spl_load_read;
 		ret = spl_load_simple_fit(spl_image, &load, sector, header);
+	} else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) {
+		struct spl_load_info load;
+
+		load.dev = mmc;
+		load.priv = NULL;
+		load.filename = NULL;
+		load.bl_len = mmc->read_bl_len;
+		load.read = h_spl_load_read;
+
+		ret = spl_load_imx_container(spl_image, &load, sector);
 	} else {
 		ret = mmc_load_legacy(spl_image, mmc, sector, header);
 	}
include/spl.h +12 -0
index f09909e189..b7c8a972dd 100644
@@ -125,6 +125,18 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 #define SPL_COPY_PAYLOAD_ONLY	1
 #define SPL_FIT_FOUND		2
 
+/**
+ * spl_load_imx_container() - Loads a imx container image from a device.
+ * @spl_image:	Image description to set up
+ * @info:	Structure containing the information required to load data.
+ * @sector:	Sector number where container image is located in the device
+ *
+ * Reads the container image @sector in the device. Loads u-boot image to
+ * specified load address.
+ */
+int spl_load_imx_container(struct spl_image_info *spl_image,
+			   struct spl_load_info *info, ulong sector);
+
 /* SPL common functions */
 void preloader_console_init(void);
 u32 spl_boot_device(void);
Signature · 1 line
2.16.4
#5 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 3 lines · Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container

Why not FIT?

Quoted 1 line

support to let SPL could load container images.

What is a container image? Can you please point to documentation?

Quoted 11 lines
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
Cc York Sun <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Alex Kiernan <[email protected]>
Cc Simon Glass <[email protected]>
Cc Philipp Tomsich <[email protected]>
Cc Kever Yang <[email protected]>
Cc Heiko Schocher <[email protected]>
Quoted 4 lines
---
 common/spl/spl_mmc.c | 10 ++++++++++
 include/spl.h        | 12 ++++++++++++
 2 files changed, 22 insertions(+)

Regards,
Simon

author
#6 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Simon,

Quoted 10 lines

Subject: Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 3 lines · Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container

Why not FIT?

Actually before we implement secure boot, we use FIT image, however i.MX8 only support i.MX container format image for secure boot,
The chip will verify the container image when secure boot. It could not recognize FIT image. So we have to drop FIT image.

Quoted 4 lines
Quoted 2 lines

support to let SPL could load container images.

What is a container image? Can you please point to documentation?

Sadly, there is no public reference manual. There is a doc that has a bit of information. https://community.nxp.com/docs/DOC-343178

Thanks,
Peng.

Quoted 19 lines
Quoted 12 lines
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
Cc York Sun <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Alex Kiernan <[email protected]>
Cc Simon Glass <[email protected]>
Cc Philipp Tomsich <[email protected]>
Cc Kever Yang <[email protected]>
Cc Heiko Schocher <[email protected]>
Quoted 4 lines
---
 common/spl/spl_mmc.c | 10 ++++++++++
 include/spl.h        | 12 ++++++++++++
 2 files changed, 22 insertions(+)

Regards,
Simon

#7 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Quoted 19 lines · Peng Fan

Hi Simon,

Quoted 10 lines

Subject: Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 3 lines · Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container

Why not FIT?

Actually before we implement secure boot, we use FIT image, however i.MX8 only support i.MX container format image for secure boot,
The chip will verify the container image when secure boot. It could not recognize FIT image. So we have to drop FIT image.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

support to let SPL could load container images.

What is a container image? Can you please point to documentation?

Sadly, there is no public reference manual. There is a doc that has a bit of information. https://community.nxp.com/docs/DOC-343178

Shouldn't it suffice for the SPL to be in this custom format , while the rest of the binaries can be in fitImage ?

Signature · 2 lines
Best regards,
Marek Vasut
author
#8 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 39 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 20 lines · Peng Fan

Hi Simon,

Quoted 11 lines

Subject: Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 3 lines · Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container

Why not FIT?

Actually before we implement secure boot, we use FIT image, however i.MX8 only support i.MX container format image for secure boot, The chip will verify the container image when secure boot. It could not recognize FIT image. So we have to drop FIT image.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

support to let SPL could load container images.

What is a container image? Can you please point to documentation?

Sadly, there is no public reference manual. There is a doc that has a bit of information.

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcomm

Quoted 1 line

unity.nxp.com%2Fdocs%2FDOC-343178&amp;data=02%7C01%7Cpeng.fan%4 0nxp.co

Quoted 1 line

m%7C8626e7a1d20c44b8715408d6dcc4d866%7C686ea1d3bc2b4c6fa92cd9 9c5c30163

Quoted 1 line
Quoted 6 lines

5%7C0%7C0%7C636939135344595378&amp;sdata=vmIaO78XmuL1tQJufqf7 HCGdWHTCJ

Quoted 1 line

bEpmGBio15j46U%3D&amp;reserved=0

Shouldn't it suffice for the SPL to be in this custom format , while the rest of the binaries can be in fitImage ?

The issue is the SoC only support i.MX container format for secure boot(AHAB boot), if we not use secure boot, FIT image do work and could work well.

We investigated using FIT for i.MX8 secure boot, but it does not make sense we did a FIT wrapper for container. Container itself is also an image format, it contains image load/entry/size and etc information.

I add a kconfig entry in SPL code, it does not hurt others if the Kconfig entry not chosen.

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

Thanks,
Peng.

Quoted 4 lines

--
Best regards,
Marek Vasut

#9 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Quoted 51 lines · Peng Fan

Hi Marek,

Quoted 39 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 20 lines · Peng Fan

Hi Simon,

Quoted 11 lines

Subject: Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 3 lines · Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container

Why not FIT?

Actually before we implement secure boot, we use FIT image, however i.MX8 only support i.MX container format image for secure boot, The chip will verify the container image when secure boot. It could not recognize FIT image. So we have to drop FIT image.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

support to let SPL could load container images.

What is a container image? Can you please point to documentation?

Sadly, there is no public reference manual. There is a doc that has a bit of information.

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcomm

Quoted 1 line

unity.nxp.com%2Fdocs%2FDOC-343178&amp;data=02%7C01%7Cpeng.fan%4 0nxp.co

Quoted 1 line

m%7C8626e7a1d20c44b8715408d6dcc4d866%7C686ea1d3bc2b4c6fa92cd9 9c5c30163

Quoted 1 line
Quoted 6 lines

5%7C0%7C0%7C636939135344595378&amp;sdata=vmIaO78XmuL1tQJufqf7 HCGdWHTCJ

Quoted 1 line

bEpmGBio15j46U%3D&amp;reserved=0

Shouldn't it suffice for the SPL to be in this custom format , while the rest of the binaries can be in fitImage ?

The issue is the SoC only support i.MX container format for secure boot(AHAB boot), if we not use secure boot, FIT image do work and could work well.

Quoted 8 lines

We investigated using FIT for i.MX8 secure boot, but it does not make sense we did a FIT wrapper for container. Container itself is also an image format, it contains image load/entry/size and etc information.

I add a kconfig entry in SPL code, it does not hurt others if the Kconfig entry not chosen.

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

Signature · 2 lines
Best regards,
Marek Vasut
author
#10 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 66 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 35 lines · Peng Fan

Hi Marek,

Quoted 33 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 28 lines · Peng Fan

Hi Simon,

Quoted 5 lines

Subject: Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 7 lines
Quoted 4 lines · Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container

Why not FIT?

Actually before we implement secure boot, we use FIT image, however i.MX8 only support i.MX container format image for secure boot, The chip will verify the container image when secure boot. It could not recognize FIT image. So we have to drop FIT image.

Quoted 4 lines
Quoted 2 lines

support to let SPL could load container images.

What is a container image? Can you please point to documentation?

Sadly, there is no public reference manual. There is a doc that has a bit of information.

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcom

Quoted 3 lines
Quoted 3 lines

m

Quoted 1 line

unity.nxp.com%2Fdocs%2FDOC-343178&amp;data=02%7C01%7Cpeng.fan%4

Quoted 3 lines
Quoted 3 lines

0nxp.co

Quoted 1 line

m%7C8626e7a1d20c44b8715408d6dcc4d866%7C686ea1d3bc2b4c6fa92cd9

Quoted 3 lines
Quoted 3 lines

9c5c30163

Quoted 1 line

5%7C0%7C0%7C636939135344595378&amp;sdata=vmIaO78XmuL1tQJufqf7

Quoted 8 lines
Quoted 5 lines

HCGdWHTCJ

Quoted 1 line

bEpmGBio15j46U%3D&amp;reserved=0

Shouldn't it suffice for the SPL to be in this custom format , while the rest of the binaries can be in fitImage ?

The issue is the SoC only support i.MX container format for secure boot(AHAB boot), if we not use secure boot, FIT image do work and could

work well.

Quoted 5 lines

We investigated using FIT for i.MX8 secure boot, but it does not make sense we did a FIT wrapper for container. Container itself is also an image format, it contains image load/entry/size and etc information.

Quoted 8 lines
Quoted 1 line

I add a kconfig entry in SPL code, it does not hurt others if the Kconfig entry

not chosen.

Quoted 3 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Thanks,
Peng.

Quoted 4 lines

--
Best regards,
Marek Vasut

#11 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Quoted 71 lines · Peng Fan

Hi Marek,

Quoted 69 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 35 lines · Peng Fan

Hi Marek,

Quoted 33 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 28 lines · Peng Fan

Hi Simon,

Quoted 5 lines

Subject: Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 7 lines
Quoted 4 lines · Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container

Why not FIT?

Actually before we implement secure boot, we use FIT image, however i.MX8 only support i.MX container format image for secure boot, The chip will verify the container image when secure boot. It could not recognize FIT image. So we have to drop FIT image.

Quoted 4 lines
Quoted 2 lines

support to let SPL could load container images.

What is a container image? Can you please point to documentation?

Sadly, there is no public reference manual. There is a doc that has a bit of information.

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcom

Quoted 3 lines
Quoted 3 lines

m

Quoted 1 line

unity.nxp.com%2Fdocs%2FDOC-343178&amp;data=02%7C01%7Cpeng.fan%4

Quoted 3 lines
Quoted 3 lines

0nxp.co

Quoted 1 line

m%7C8626e7a1d20c44b8715408d6dcc4d866%7C686ea1d3bc2b4c6fa92cd9

Quoted 3 lines
Quoted 3 lines

9c5c30163

Quoted 1 line

5%7C0%7C0%7C636939135344595378&amp;sdata=vmIaO78XmuL1tQJufqf7

Quoted 8 lines
Quoted 5 lines

HCGdWHTCJ

Quoted 1 line

bEpmGBio15j46U%3D&amp;reserved=0

Shouldn't it suffice for the SPL to be in this custom format , while the rest of the binaries can be in fitImage ?

The issue is the SoC only support i.MX container format for secure boot(AHAB boot), if we not use secure boot, FIT image do work and could

work well.

Quoted 6 lines

We investigated using FIT for i.MX8 secure boot, but it does not make sense we did a FIT wrapper for container. Container itself is also an image format, it contains image load/entry/size and etc information.

I add a kconfig entry in SPL code, it does not hurt others if the Kconfig entry

not chosen.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Signature · 2 lines
Best regards,
Marek Vasut
author
#12 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 86 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 43 lines · Peng Fan

Hi Marek,

Quoted 41 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 36 lines · Peng Fan

Hi Marek,

Quoted 34 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 29 lines · Peng Fan

Hi Simon,

Quoted 5 lines

Subject: Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 7 lines
Quoted 4 lines · Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container

Why not FIT?

Actually before we implement secure boot, we use FIT image, however
i.MX8 only support i.MX container format image for secure boot, The chip will verify the container image when secure boot. It could not recognize FIT image. So we have to drop FIT image.

Quoted 4 lines
Quoted 2 lines

support to let SPL could load container images.

What is a container image? Can you please point to documentation?

Sadly, there is no public reference manual. There is a doc that has a bit of information.

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcom

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

m

Quoted 1 line

unity.nxp.com%2Fdocs%2FDOC-343178&amp;data=02%7C01%7Cpeng.fan%4

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

0nxp.co

Quoted 1 line

m%7C8626e7a1d20c44b8715408d6dcc4d866%7C686ea1d3bc2b4c6fa92cd9

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

9c5c30163

Quoted 1 line

5%7C0%7C0%7C636939135344595378&amp;sdata=vmIaO78XmuL1tQJufqf7

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

HCGdWHTCJ

Quoted 1 line

bEpmGBio15j46U%3D&amp;reserved=0

Shouldn't it suffice for the SPL to be in this custom format , while the rest of the binaries can be in fitImage ?

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

The issue is the SoC only support i.MX container format for secure boot(AHAB boot), if we not use secure boot, FIT image do work and could

work well.

Quoted 4 lines

We investigated using FIT for i.MX8 secure boot, but it does not make sense we did a FIT wrapper for container. Container itself is also an image format, it contains image load/entry/size and etc

information.

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

I add a kconfig entry in SPL code, it does not hurt others if the Kconfig entry

not chosen.

Quoted 3 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Thanks,
Peng.

Quoted 4 lines

--
Best regards,
Marek Vasut

#13 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 6 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Quoted 3 lines

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Shouldn't the CPU have some sort of facility, like a crypto engine, which authenticates whatever blob with the right signature against a key burned into the CPU ? If so, then you would just implement a crypto driver and pass the blob and signature to it. I suspect that's how it should work, how else would Linux be able to make use of these secure bits if it cannot call the bootrom anymore ?

Signature · 2 lines
Best regards,
Marek Vasut
author
#14 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Quoted 25 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 6 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 5 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM.
sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

SPL will call this API, one parameter is address which needs a container image there.

Quoted 11 lines
Quoted 4 lines

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Shouldn't the CPU have some sort of facility, like a crypto engine, which authenticates whatever blob with the right signature against a key burned into the CPU ? If so, then you would just implement a crypto driver and pass the blob and signature to it. I suspect that's how it should work, how else would Linux be able to make use of these secure bits if it cannot call the bootrom anymore ?

sc_seco_authenticate on i.MX8 will always be available. It is exported by a runtime firmware running on a Cortex-M core inside i.MX8. The API will do authentication, its accepts container format image as input and no other format.

Thanks,
Peng.

Quoted 4 lines

--
Best regards,
Marek Vasut

#15 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 32 lines
Quoted 26 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 7 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 5 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Quoted 8 lines

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM. sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

SPL will call this API, one parameter is address which needs a container image there.

Please consider following scenario (I think that this is in sync with Marek's point):

1. You wrap SPL into i.MX8 "container", so the SPL would be recognised an checked by secure code in ROM.

2. Then we do have SPL "trusted". It is up to SPL to:

2.1. Use its private key to check u-boot, dtb, etc embedded into FitImage (as written here: ./doc/uImage.FIT/verified-boot.txt).

2.2. Use crypto engine (it's API) with fused keys to speed-up the process of boot (by HW support to check the binary). Such approach is in i.MX6Q.

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

Quoted 22 lines
Quoted 6 lines
Quoted 5 lines

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Quoted 6 lines

Shouldn't the CPU have some sort of facility, like a crypto engine, which authenticates whatever blob with the right signature against a key burned into the CPU ? If so, then you would just implement a crypto driver and pass the blob and signature to it. I suspect that's how it should work, how else would Linux be able to make use of these secure bits if it cannot call the bootrom anymore ?

sc_seco_authenticate on i.MX8 will always be available. It is exported by a runtime firmware running on a Cortex-M core inside i.MX8. The API will do authentication, its accepts container format image as input and no other format.

Thanks,
Peng.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

--
Best regards,
Marek Vasut

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190521/64c1ffcf/attachment.sig>

#16 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Quoted 40 lines · Lukasz Majewski

Hi Peng,

Quoted 38 lines
Quoted 26 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 7 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 5 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM. sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

Quoted 5 lines
Quoted 2 lines

SPL will call this API, one parameter is address which needs a container image there.

Please consider following scenario (I think that this is in sync with Marek's point):

It's not in sync, see 2.1 below.

Quoted 7 lines

1. You wrap SPL into i.MX8 "container", so the SPL would be recognised an checked by secure code in ROM.

2. Then we do have SPL "trusted". It is up to SPL to:

2.1. Use its private key to check u-boot, dtb, etc embedded into FitImage (as written here: ./doc/uImage.FIT/verified-boot.txt).

Then you have two private keys, one which is potentially exposed by being in the SPL. You want to use the crypto engine, which has a key in it and which cannot be easily extracted.

Quoted 8 lines

2.2. Use crypto engine (it's API) with fused keys to speed-up the process of boot (by HW support to check the binary). Such approach is in i.MX6Q.

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

My question is, how can Linux crypto API make use of the built-in private key in the iMX8 to authenticate payload ? There surely is a way.

Signature · 2 lines
Best regards,
Marek Vasut
#17 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 53 lines · Lukasz Majewski
Quoted 41 lines

Hi Peng,

Quoted 39 lines
Quoted 26 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 7 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 5 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM. sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

Quoted 5 lines
Quoted 2 lines

SPL will call this API, one parameter is address which needs a container image there.

Please consider following scenario (I think that this is in sync with Marek's point):

It's not in sync, see 2.1 below.

Quoted 3 lines

1. You wrap SPL into i.MX8 "container", so the SPL would be recognised an checked by secure code in ROM.

Quoted 6 lines
Quoted 4 lines

2. Then we do have SPL "trusted". It is up to SPL to:

2.1. Use its private key to check u-boot, dtb, etc embedded into FitImage (as written here: ./doc/uImage.FIT/verified-boot.txt).

Then you have two private keys,

There shall be s/private key/public key/g in the SPL (but then the SPL needs to be trusted).

And I fully agree that we shall use crypto engine whenever possible.

Quoted 9 lines

one which is potentially exposed by
being in the SPL. You want to use the crypto engine, which has a key in it and which cannot be easily extracted.

Quoted 5 lines

2.2. Use crypto engine (it's API) with fused keys to speed-up the process of boot (by HW support to check the binary). Such approach is in i.MX6Q.

Quoted 8 lines
Quoted 4 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

My question is, how can Linux crypto API make use of the built-in private key in the iMX8 to authenticate payload ? There surely is a way.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190521/610d9fa4/attachment.sig>

author
#18 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

In reply to Lukasz Majewski

Hi Lukasz,

Quoted 60 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月21日 16:33
To: Peng Fan <[email protected]>
Cc: Marek Vasut <[email protected]>; Marek Vasut <[email protected]>; Simon Glass <[email protected]>; u-boot at lists.denx.de; Tien Fong Chee <[email protected]>; York Sun <[email protected]>; dl-uboot-imx <[email protected]>
Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 32 lines
Quoted 26 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 7 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 5 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Quoted 8 lines

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM. sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

SPL will call this API, one parameter is address which needs a container image there.

Please consider following scenario (I think that this is in sync with Marek's point):

1. You wrap SPL into i.MX8 "container", so the SPL would be recognised an checked by secure code in ROM.

Quoted 7 lines

2. Then we do have SPL "trusted". It is up to SPL to:

2.1. Use its private key to check u-boot, dtb, etc embedded into FitImage (as written here: ./doc/uImage.FIT/verified-boot.txt).

2.2. Use crypto engine (it's API) with fused keys to speed-up the process of boot (by HW support to check the binary). Such approach is in i.MX6Q.

I suppose you talking HAB.

Quoted 5 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

If I switch to FIT, I need to use FIT to wrap a container image, it does not make sense to me.

Thanks,
Peng.

Quoted 44 lines
Quoted 23 lines
Quoted 7 lines
Quoted 6 lines

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Quoted 6 lines

Shouldn't the CPU have some sort of facility, like a crypto engine, which authenticates whatever blob with the right signature against a key burned into the CPU ? If so, then you would just implement a crypto driver and pass the blob and signature to it. I suspect that's how it should work, how else would Linux be able to make use of these secure bits if it cannot call the bootrom anymore ?

sc_seco_authenticate on i.MX8 will always be available. It is exported by a runtime firmware running on a Cortex-M core inside i.MX8. The API will do authentication, its accepts container format image as input and no other format.

Thanks,
Peng.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

--
Best regards,
Marek Vasut

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#19 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 66 lines

Hi Lukasz,

Quoted 64 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月21日 16:33
To: Peng Fan <[email protected]>
Cc: Marek Vasut <[email protected]>; Marek Vasut <[email protected]>; Simon Glass <[email protected]>; u-boot at lists.denx.de; Tien Fong Chee <[email protected]>; York Sun <[email protected]>; dl-uboot-imx <[email protected]>
Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 40 lines
Quoted 26 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 7 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 6 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM. sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

Quoted 2 lines

SPL will call this API, one parameter is address which needs a container image there.

Please consider following scenario (I think that this is in sync with Marek's point):

1. You wrap SPL into i.MX8 "container", so the SPL would be recognised an checked by secure code in ROM.

2. Then we do have SPL "trusted". It is up to SPL to:

Quoted 8 lines
Quoted 6 lines

2.1. Use its private key to check u-boot, dtb, etc embedded into FitImage (as written here: ./doc/uImage.FIT/verified-boot.txt).

2.2. Use crypto engine (it's API) with fused keys to speed-up the process of boot (by HW support to check the binary). Such approach is in i.MX6Q.

I suppose you talking HAB.

Yes. As described here:

https://www.nxp.com/docs/en/application-note/AN4581.pdf

Quoted 10 lines
Quoted 7 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Or is it just the function executed by ROM on the very beginning to load SPL?

Quoted 3 lines

If I switch to FIT, I need to use FIT to wrap a container image, it does not make sense to me.

Please correct me if I'm wrong, but isn't the container image only needed to wrap SPL?

In which other cases the container image is needed in U-Boot proper or Linux kernel?

Quoted 48 lines

Thanks,
Peng.

Quoted 45 lines
Quoted 24 lines
Quoted 7 lines
Quoted 6 lines

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Quoted 7 lines

Shouldn't the CPU have some sort of facility, like a crypto engine, which authenticates whatever blob with the right signature against a key burned into the CPU ? If so, then you would just implement a crypto driver and pass the blob and signature to it. I suspect that's how it should work, how else would Linux be able to make use of these secure bits if it cannot call the bootrom anymore ?

sc_seco_authenticate on i.MX8 will always be available. It is exported by a runtime firmware running on a Cortex-M core inside i.MX8. The API will do authentication, its accepts container format image as input and no other format.

Thanks,
Peng.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

--
Best regards,
Marek Vasut

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190522/f055de0b/attachment.sig>

author
#20 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Quoted 71 lines
Quoted 50 lines
Quoted 50 lines
Quoted 39 lines
Quoted 26 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

I am not able to follow you, could you share more details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 7 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 5 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS,
etc) ; the BootROM is already out of the picture at this point.

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM. sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

Quoted 2 lines

SPL will call this API, one parameter is address which needs a container image there.

Please consider following scenario (I think that this is in sync with Marek's point):

1. You wrap SPL into i.MX8 "container", so the SPL would be recognised an checked by secure code in ROM.

2. Then we do have SPL "trusted". It is up to SPL to:

Quoted 8 lines
Quoted 6 lines

2.1. Use its private key to check u-boot, dtb, etc embedded into FitImage (as written here: ./doc/uImage.FIT/verified-boot.txt).

2.2. Use crypto engine (it's API) with fused keys to speed-up the process of boot (by HW support to check the binary). Such approach is in i.MX6Q.

I suppose you talking HAB.

Yes. As described here:

https://www.nxp.com/docs/en/application-note/AN4581.pdf

Quoted 8 lines
Quoted 7 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

Quoted 5 lines
Quoted 2 lines

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Quoted 9 lines

Or is it just the function executed by ROM on the very beginning to load SPL?

Quoted 3 lines

If I switch to FIT, I need to use FIT to wrap a container image, it does not make sense to me.

Please correct me if I'm wrong, but isn't the container image only needed to wrap SPL?

Container image will wrap SPL to make ROM could load SPL, Kick SPL and authenticate SPL.

When SPL booting U-Boot, SPL could use FIT to load and boot uboot. But when SPL need to authenticate U-Boot with AHAB on i.MX8, a container format header/image needs to be passed to sc_seco_authenticate API, the API internal implementation is it will parse the container header/image.

So in vendor tree, uboot/atf/optee are wrapped into a container format image.

Quoted 3 lines

In which other cases the container image is needed in U-Boot proper or Linux kernel?

When uboot authenticate kernel, we also wrap kernel image into a container format file using CST. I do not know how Linux kernel itself authenticate others.

Thanks,
Peng.

Quoted 63 lines
Quoted 49 lines

Thanks,
Peng.

Quoted 45 lines
Quoted 24 lines
Quoted 7 lines
Quoted 6 lines

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Quoted 7 lines

Shouldn't the CPU have some sort of facility, like a crypto engine, which authenticates whatever blob with the right signature against a key burned into the CPU ? If so, then you would just implement a crypto driver and pass the blob and signature to it. I suspect that's how it should work, how else would Linux be able to make use of these secure bits if it cannot call the bootrom anymore ?

sc_seco_authenticate on i.MX8 will always be available. It is exported by a runtime firmware running on a Cortex-M core inside i.MX8. The API will do authentication, its accepts container format image as input and no other format.

Thanks,
Peng.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

--
Best regards,
Marek Vasut

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#21 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 73 lines
Quoted 73 lines
Quoted 52 lines
Quoted 52 lines
Quoted 41 lines
Quoted 27 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

Quoted 6 lines
Quoted 2 lines

I am not able to follow you, could you share more
details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 7 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 6 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM. sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

Quoted 2 lines

SPL will call this API, one parameter is address which needs a container image there.

Please consider following scenario (I think that this is in sync with Marek's point):

1. You wrap SPL into i.MX8 "container", so the SPL would be recognised an checked by secure code in ROM.

2. Then we do have SPL "trusted". It is up to SPL to:

Quoted 8 lines
Quoted 6 lines

2.1. Use its private key to check u-boot, dtb, etc embedded into FitImage (as written here: ./doc/uImage.FIT/verified-boot.txt).

2.2. Use crypto engine (it's API) with fused keys to speed-up the process of boot (by HW support to check the binary). Such approach is in i.MX6Q.

I suppose you talking HAB.

Yes. As described here:

https://www.nxp.com/docs/en/application-note/AN4581.pdf

Quoted 8 lines
Quoted 7 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

Quoted 5 lines
Quoted 5 lines

Or is it just the function executed by ROM on the very beginning to load SPL?

Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

If I switch to FIT, I need to use FIT to wrap a container image, it does not make sense to me.

Please correct me if I'm wrong, but isn't the container image only needed to wrap SPL?

Container image will wrap SPL to make ROM could load SPL, Kick SPL and authenticate SPL.

Ok. So it is needed in the ROM "part" of security.

Quoted 6 lines

When SPL booting U-Boot, SPL could use FIT to load and boot uboot. But when SPL need to authenticate U-Boot with AHAB on i.MX8, a container format header/image needs to be passed to sc_seco_authenticate API, the API internal implementation is it will parse the container header/image.

Ok. So every time we want to use the sc_seco_authenticate API the provided image for checking needs to be wrapped into the "container" iMX8 specific format.

Quoted 3 lines

So in vendor tree, uboot/atf/optee are wrapped into a container format image.

Ok.

Quoted 5 lines
Quoted 4 lines

In which other cases the container image is needed in U-Boot proper or Linux kernel?

Quoted 71 lines

When uboot authenticate kernel, we also wrap kernel image into a container format file using CST. I do not know how Linux kernel itself authenticate others.

Thanks,
Peng.

Quoted 64 lines
Quoted 50 lines

Thanks,
Peng.

Quoted 46 lines
Quoted 25 lines
Quoted 8 lines
Quoted 7 lines

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Quoted 7 lines

Shouldn't the CPU have some sort of facility, like a crypto engine, which authenticates whatever blob with the right signature against a key burned into the CPU ? If so, then you would just implement a crypto driver and pass the blob and signature to it. I suspect that's how it should work, how else would Linux be able to make use of these secure bits if it cannot call the bootrom anymore ?

sc_seco_authenticate on i.MX8 will always be available. It is exported by a runtime firmware running on a Cortex-M core inside i.MX8. The API will do authentication, its accepts container format image as input and no other format.

Thanks,
Peng.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

--
Best regards,
Marek Vasut

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190522/fff7327a/attachment.sig>

author
#22 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Quoted 77 lines
Quoted 77 lines
Quoted 77 lines
Quoted 53 lines
Quoted 53 lines
Quoted 42 lines
Quoted 28 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

I do not know how other SoC vendor did FIT hardware secure boot, please share you have any information.

The SPL can be in the custom format, but then can load fitImage with the next stage(s), right ?

Quoted 6 lines
Quoted 2 lines

I am not able to follow you, could you share more
details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 7 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 6 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM. sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

Quoted 2 lines

SPL will call this API, one parameter is address which needs a container image there.

Please consider following scenario (I think that this is in sync with Marek's point):

1. You wrap SPL into i.MX8 "container", so the SPL would be recognised an checked by secure code in ROM.

2. Then we do have SPL "trusted". It is up to SPL to:

Quoted 8 lines
Quoted 6 lines

2.1. Use its private key to check u-boot, dtb, etc embedded into FitImage (as written here: ./doc/uImage.FIT/verified-boot.txt).

2.2. Use crypto engine (it's API) with fused keys to speed-up the process of boot (by HW support to check the binary). Such approach is in i.MX6Q.

I suppose you talking HAB.

Yes. As described here:

https://www.nxp.com/docs/en/application-note/AN4581.pdf

Quoted 10 lines
Quoted 7 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter? i.MX6 HAB secure boot also requires CSF padding into image, we could not pass other format image to ROM when using HAB, right?

Quoted 24 lines
Quoted 6 lines
Quoted 6 lines

Or is it just the function executed by ROM on the very beginning to load SPL?

Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

If I switch to FIT, I need to use FIT to wrap a container image, it does not make sense to me.

Please correct me if I'm wrong, but isn't the container image only needed to wrap SPL?

Container image will wrap SPL to make ROM could load SPL, Kick SPL and authenticate SPL.

Ok. So it is needed in the ROM "part" of security.

Quoted 6 lines

When SPL booting U-Boot, SPL could use FIT to load and boot uboot. But when SPL need to authenticate U-Boot with AHAB on i.MX8, a container format header/image needs to be passed to sc_seco_authenticate API, the API internal implementation is it will parse the container header/image.

Quoted 3 lines

Ok. So every time we want to use the sc_seco_authenticate API the provided image for checking needs to be wrapped into the "container" iMX8 specific format.

Yes. Otherwise sc_seco_authenticate will return failure. I could not think out better solution, another approach is let uboot generating a container header, and use FIT to wrap the header and other payload images, but I think directly generating a container image is simpler, because we already have SPL been wrapped into container format.

Thanks,
Peng.

Quoted 98 lines
Quoted 4 lines

So in vendor tree, uboot/atf/optee are wrapped into a container format image.

Ok.

Quoted 5 lines
Quoted 4 lines

In which other cases the container image is needed in U-Boot proper or Linux kernel?

Quoted 54 lines

When uboot authenticate kernel, we also wrap kernel image into a container format file using CST. I do not know how Linux kernel itself authenticate others.

Thanks,
Peng.

Quoted 47 lines
Quoted 47 lines

Thanks,
Peng.

Quoted 43 lines
Quoted 25 lines
Quoted 8 lines
Quoted 7 lines

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Quoted 7 lines

Shouldn't the CPU have some sort of facility, like a crypto engine, which authenticates whatever blob with the right signature against a key burned into the CPU ? If so, then you would just implement a crypto driver and pass the blob and signature to it. I suspect that's how it should work, how else would Linux be able to make use of these secure bits if it cannot call the bootrom anymore ?

sc_seco_authenticate on i.MX8 will always be available. It is exported by a runtime firmware running on a Cortex-M core inside i.MX8. The API will do authentication, its accepts container format image as input and no other format.

Thanks,
Peng.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

--
Best regards,
Marek Vasut

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#23 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 83 lines
Quoted 83 lines
Quoted 83 lines
Quoted 82 lines
Quoted 59 lines
Quoted 59 lines
Quoted 44 lines
Quoted 30 lines

Subject: Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 5/21/19 4:55 AM, Peng Fan wrote:
[...]

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

I do not know how other SoC vendor did FIT
hardware secure boot, please share you have any
information.

The SPL can be in the custom format, but then can
load fitImage with the next stage(s), right ?

Quoted 6 lines
Quoted 2 lines

I am not able to follow you, could you share more
details?

Wrap the SPL into this custom format and then have the SPL load/authenticate fitImage with the rest (U-Boot, Linux, DTB etc). Would that work ?

Quoted 8 lines

It not work.
We already wrap SPL in i.MX container format, this patchset is to let SPL could load the 2nd container file which contains U-Boot/DTB/OP-TEE/ATF. If we let SPL load a fitimage which contains (U-Boot/DTB and etc), it could not pass secure boot authentication, because ROM not know fitimage, it only know i.MX container format.

Quoted 6 lines

It's not bootrom that authenticates the next stage, it's U-Boot SPL. BootROM already authenticated and started the U-Boot SPL, so that's a trusted code. Now this trusted code can authenticate and start the next stage (U-Boot, ATF, OpTee OS, etc) ; the BootROM is already out of the picture at this point.

Sorry for not clear. On i.MX8, SCFW (a runtime firmware )exports API for others to use, sc_seco_authenticate is the API that used for authentication. I could not share more information about this API works inside SCFW and ROM. sc_err_t sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd, sc_faddr_t addr)

Quoted 2 lines

SPL will call this API, one parameter is address which needs a container image there.

Please consider following scenario (I think that this is in sync with Marek's point):

1. You wrap SPL into i.MX8 "container", so the SPL would be recognised an checked by secure code in ROM.

2. Then we do have SPL "trusted". It is up to SPL to:

2.1. Use its private key to check u-boot, dtb, etc embedded into FitImage (as written
here: ./doc/uImage.FIT/verified-boot.txt).

Quoted 5 lines
Quoted 3 lines

2.2. Use crypto engine (it's API) with fused keys to speed-up the process of boot (by HW support to check the binary). Such approach is in i.MX6Q.

I suppose you talking HAB.

Yes. As described here:

https://www.nxp.com/docs/en/application-note/AN4581.pdf

Quoted 10 lines
Quoted 7 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

I would check it just out of curiosity.

Quoted 4 lines

i.MX6 HAB secure boot also requires CSF padding
into image, we could not pass other format image to ROM when using HAB, right?

Yes.

Quoted 28 lines
Quoted 24 lines
Quoted 6 lines
Quoted 6 lines

Or is it just the function executed by ROM on the very beginning to load SPL?

Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

If I switch to FIT, I need to use FIT to wrap a container image, it does not make sense to me.

Please correct me if I'm wrong, but isn't the container image only needed to wrap SPL?

Container image will wrap SPL to make ROM could load SPL, Kick SPL and authenticate SPL.

Ok. So it is needed in the ROM "part" of security.

Quoted 6 lines

When SPL booting U-Boot, SPL could use FIT to load and boot uboot. But when SPL need to authenticate U-Boot with AHAB on i.MX8, a container format header/image needs to be passed to sc_seco_authenticate API, the API internal implementation is it will parse the container header/image.

Quoted 3 lines

Ok. So every time we want to use the sc_seco_authenticate API the provided image for checking needs to be wrapped into the "container" iMX8 specific format.

Quoted 6 lines

Yes. Otherwise sc_seco_authenticate will return failure. I could not think out better solution, another approach is let uboot generating a container header, and use FIT to wrap the header and other payload images, but I think directly generating a container image is simpler, because we already have SPL been wrapped into container format.

I just wanted to understand the issue and help to get the simplest possible solution.

Quoted 103 lines

Thanks,
Peng.

Quoted 100 lines
Quoted 4 lines

So in vendor tree, uboot/atf/optee are wrapped into a container format image.

Ok.

Quoted 5 lines
Quoted 4 lines

In which other cases the container image is needed in U-Boot proper or Linux kernel?

Quoted 56 lines

When uboot authenticate kernel, we also wrap kernel image into a container format file using CST. I do not know how Linux kernel itself authenticate others.

Thanks,
Peng.

Quoted 49 lines
Quoted 49 lines

Thanks,
Peng.

Quoted 45 lines
Quoted 27 lines
Quoted 8 lines
Quoted 7 lines

For authentication, we always let ROM to authenticate including SPL authenticating U-Boot, so we need pass an image to ROM that ROM could recognize when SPL booting 2nd image.

Quoted 8 lines

Shouldn't the CPU have some sort of facility, like a crypto engine, which authenticates whatever blob with the right signature against a key burned into the CPU ? If so, then you would just implement a crypto driver and pass the blob and signature to it. I suspect that's how it should work, how else would Linux be able to make use of these secure bits if it cannot call the bootrom anymore ?

sc_seco_authenticate on i.MX8 will always be available. It is exported by a runtime firmware running on a Cortex-M core inside i.MX8. The API will do authentication, its accepts container format image as input and no other format.

Thanks,
Peng.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

--
Best regards,
Marek Vasut

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190522/c0ff8fef/attachment.sig>

#24 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific container ? And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated signature.

[...]

Signature · 2 lines
Best regards,
Marek Vasut
#25 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 24 lines · Marek Vasut

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 20 lines
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

Quoted 8 lines
Quoted 1 line

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific container ? And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated signature.

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in container. AHAB will check the public key with the on-chip SRK before using it to authenticate the image. Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported. And the fuse of SRK is locked, can't be read directly.

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is imx8 needs container format for signed image. We prefer directly loading container image than fit image. If we pack fit image into container, obviously this will cause one more copy.
As a boot loader, isn't it better to have more image format supported? We don't force to use container, just set it as default. Users still can choose fit or raw image.

Quoted 6 lines

[...]

--
Best regards,
Marek Vasut

author
#26 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek, Lukasz,

Quoted 48 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 24 lines · Marek Vasut

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 20 lines
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

Quoted 8 lines
Quoted 1 line

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific container ? And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated signature.

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in container.
AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Quoted 9 lines

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more copy. As a boot loader, isn't it better to have more image format supported? We don't force to use container, just set it as default. Users still can choose fit or raw image.

Do you have more comment?

Thanks,
Peng.

Quoted 10 lines
Quoted 8 lines

[...]

--
Best regards,
Marek Vasut

#27 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 57 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 55 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 24 lines · Marek Vasut

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 20 lines
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

Quoted 8 lines
Quoted 1 line

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific container ? And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated signature.

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in container.
AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more copy. As a boot loader, isn't it better to have more image format supported?

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 2 lines

Do you have more comment?

How could Linux use this iMX8 chain of trust stuff to authenticate e.g. userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Signature · 2 lines
Best regards,
Marek Vasut
#28 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 72 lines · Marek Vasut

Caution: EXT Email

Quoted 57 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 55 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 24 lines · Marek Vasut

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 20 lines
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

Quoted 8 lines
Quoted 1 line

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific container ? And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated signature.

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in container.
AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more copy. As a boot loader, isn't it better to have more image format supported?

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 1 line
Quoted 6 lines
Quoted 1 line

Do you have more comment?

How could Linux use this iMX8 chain of trust stuff to authenticate e.g. userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Userspace binaries don't use the same key pair. They are signed by software vendors' key. The private key for chip secure boot is only hold by device manufacturer.
For example, android needs to authenticate a signed APK. Its public key (Key A) is in system FS. iMX trust chain only reaches to kernel + ramdisk. Then the chain hands over to android. In ramdisk, android puts another public Key (Key B) used by dm-verify for system FS. So once system FS is verified ok, then the public key A becomes trusted. Finally we can use public key A for APK authentication.

Best regards,
Ye Li

Quoted 4 lines

--
Best regards,
Marek Vasut

#29 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 80 lines · Ye Li
Quoted 72 lines · Marek Vasut

Caution: EXT Email

Quoted 57 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 55 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 24 lines · Marek Vasut

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 20 lines
Quoted 19 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

By using above approach we do have the NXP's "container" format only seen in the SPL (which is OK, as for example Samsung does similar thing with FBL/BL1). When SPL is "trused" we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

Quoted 8 lines
Quoted 1 line

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific container ? And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated signature.

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in container.
AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more copy. As a boot loader, isn't it better to have more image format supported?

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 1 line
Quoted 6 lines
Quoted 1 line

Do you have more comment?

How could Linux use this iMX8 chain of trust stuff to authenticate e.g. userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Quoted 7 lines

Userspace binaries don't use the same key pair. They are signed by software vendors' key. The private key for chip secure boot is only hold by device manufacturer.
For example, android needs to authenticate a signed APK. Its public key (Key A) is in system FS. iMX trust chain only reaches to kernel + ramdisk. Then the chain hands over to android. In ramdisk, android puts another public Key (Key B) used by dm-verify for system FS. So once system FS is verified ok, then the public key A becomes trusted. Finally we can use public key A for APK authentication.

So can we put a public key into the SPL and use it to verify a fitImage ?

Signature · 2 lines
Best regards,
Marek Vasut
author
#30 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 92 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 11 lines · Ye Li
Quoted 10 lines · Marek Vasut

Caution: EXT Email

Quoted 7 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 5 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Marek Vasut
Quoted 7 lines

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

By using above approach we do have the NXP's "container"
format only seen in the SPL (which is OK, as for example
Samsung does similar thing with FBL/BL1). When SPL is

"trused"

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

we may use available facilities.

The issue to me is that sc_seco_authenticate could not take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I am not familiar with that, so might be stupid question below. Does it really matter?

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific

container ?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 3 lines

And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated signature.

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in container. AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is
imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more

copy.

Quoted 15 lines
Quoted 15 lines
Quoted 1 line
Quoted 1 line

As a boot loader, isn't it better to have more image format supported?

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 2 lines

Do you have more comment?

Quoted 7 lines
Quoted 4 lines

How could Linux use this iMX8 chain of trust stuff to authenticate e.g. userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Userspace binaries don't use the same key pair. They are signed by software vendors' key. The private key for chip secure boot is only hold by

device manufacturer.

Quoted 1 line

For example, android needs to authenticate a signed APK. Its public key (Key

Quoted 8 lines

A) is in system FS.

Quoted 1 line

iMX trust chain only reaches to kernel + ramdisk. Then the chain hands over

to android.

Quoted 3 lines

In ramdisk, android puts another public Key (Key B) used by dm-verify for system FS. So once system FS is verified ok, then the public key A becomes trusted. Finally we can use public key A for APK authentication.

So can we put a public key into the SPL and use it to verify a fitImage ?

Technically doable. But compared with the current approach that reuse ROM public API, Using crypto driver in SPL will be complicated and code size larger without calling ROM API.

I do not understand the problem the SPL loading NXP i.MX8 container format. SPL should only support raw and fit format? vendor format is not allowed and not accepted?

Stefano, Simon, Tom

Any comments?

Thanks,
Peng.

Quoted 4 lines

--
Best regards,
Marek Vasut

#31 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 101 lines · Peng Fan
Quoted 92 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 11 lines · Ye Li
Quoted 10 lines · Marek Vasut

Caution: EXT Email

Quoted 7 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 5 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Marek Vasut
Quoted 7 lines

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

By using above approach we do have the NXP's "container"
format only seen in the SPL (which is OK, as for example
Samsung does similar thing with FBL/BL1). When SPL is

"trused"

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

we may use available facilities.

The issue to me is that sc_seco_authenticate could not take
a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL, U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I am not familiar with that, so might be stupid question below. Does it really matter?

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific

container ?

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 3 lines

And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated signature.

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in container. AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is
imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more

copy.

Quoted 15 lines
Quoted 15 lines
Quoted 1 line
Quoted 1 line

As a boot loader, isn't it better to have more image format supported?

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 2 lines

Do you have more comment?

Quoted 7 lines
Quoted 4 lines

How could Linux use this iMX8 chain of trust stuff to authenticate e.g. userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Userspace binaries don't use the same key pair. They are signed by software vendors' key. The private key for chip secure boot is only hold by

device manufacturer.

Quoted 1 line

For example, android needs to authenticate a signed APK. Its public key (Key

Quoted 8 lines

A) is in system FS.

Quoted 1 line

iMX trust chain only reaches to kernel + ramdisk. Then the chain hands over

to android.

Quoted 3 lines

In ramdisk, android puts another public Key (Key B) used by dm-verify for system FS. So once system FS is verified ok, then the public key A becomes trusted. Finally we can use public key A for APK authentication.

So can we put a public key into the SPL and use it to verify a fitImage ?

Quoted 7 lines

Technically doable. But compared with the current approach that reuse ROM public API, Using crypto driver in SPL will be complicated and code size larger without calling ROM API.

I do not understand the problem the SPL loading NXP i.MX8 container format. SPL should only support raw and fit format? vendor format is not allowed and not accepted?

The problem I have is with the duplication of functionality -- the iMX8 custom format does exactly the same as fitImage, except differently and with smaller user base, thus with less users and reviewers and thus with less potential bugfixes, which I think in crypto code is important.

Signature · 2 lines
Best regards,
Marek Vasut
author
#32 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 117 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 43 lines · Peng Fan
Quoted 43 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 11 lines · Ye Li
Quoted 10 lines · Marek Vasut

Caution: EXT Email

Quoted 7 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 5 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Marek Vasut
Quoted 7 lines

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

By using above approach we do have the NXP's "container"
format only seen in the SPL (which is OK, as for example
Samsung does similar thing with FBL/BL1). When SPL is

"trused"

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

we may use available facilities.

The issue to me is that sc_seco_authenticate could not
take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL,
U-Boot proper or Linux crypro engine driver?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Yes, it is an API accessible in SPL/U-Boot stage. I do not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

I would check it just out of curiosity.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific

container ?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated

signature.

Quoted 46 lines
Quoted 46 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 1 line

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in container. AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is
imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more

copy.

Quoted 15 lines
Quoted 15 lines
Quoted 1 line
Quoted 1 line

As a boot loader, isn't it better to have more image format supported?

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 2 lines

Do you have more comment?

Quoted 8 lines
Quoted 4 lines

How could Linux use this iMX8 chain of trust stuff to authenticate e.g. userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Userspace binaries don't use the same key pair. They are signed by software vendors' key. The private key for chip secure boot is only hold by

device manufacturer.

Quoted 2 lines

For example, android needs to authenticate a signed APK. Its public key (Key

Quoted 7 lines
Quoted 7 lines

A) is in system FS.

Quoted 2 lines

iMX trust chain only reaches to kernel + ramdisk. Then the chain hands over

to android.

Quoted 3 lines

In ramdisk, android puts another public Key (Key B) used by dm-verify for system FS. So once system FS is verified ok, then the public key A becomes trusted. Finally we can use public key A for APK

authentication.

Quoted 8 lines
Quoted 2 lines

So can we put a public key into the SPL and use it to verify a fitImage ?

Technically doable. But compared with the current approach that reuse ROM public API, Using crypto driver in SPL will be complicated and code size larger without calling ROM API.

I do not understand the problem the SPL loading NXP i.MX8 container

Quoted 8 lines

format.

Quoted 2 lines

SPL should only support raw and fit format? vendor format is not allowed and not accepted?

The problem I have is with the duplication of functionality -- the iMX8 custom format does exactly the same as fitImage, except differently and with smaller user base, thus with less users and reviewers and thus with less potential bugfixes, which I think in crypto code is important.

The change to spl mmc common code is as below:

common/spl/spl_mmc.c +10 -0
index bf53a1dadf..6320af055b 100644
@@ -79,6 +79,16 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
                load.bl_len = mmc->read_bl_len;
                load.read = h_spl_load_read;
                ret = spl_load_simple_fit(spl_image, &load, sector, header);
+       } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) {
+               struct spl_load_info load;
+
+               load.dev = mmc;
+               load.priv = NULL;
+               load.filename = NULL;
+               load.bl_len = mmc->read_bl_len;
+               load.read = h_spl_load_read;
+
+               ret = spl_load_imx_container(spl_image, &load, sector);
        } else {
 

If IMX_CONTAINER is not preferred, I'll change it to CONFIG_SPL_LOAD_VENDOR_FORMAT. In this way, only i.MX users need to take care container format, non i.MX users no need to care about that.

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

Thanks,
Peng.

Quoted 4 lines

--
Best regards,
Marek Vasut

#33 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 147 lines · Peng Fan
Quoted 117 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 43 lines · Peng Fan
Quoted 43 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 11 lines · Ye Li
Quoted 10 lines · Marek Vasut

Caution: EXT Email

Quoted 7 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 5 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Marek,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Marek Vasut
Quoted 7 lines

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

By using above approach we do have the NXP's "container"
format only seen in the SPL (which is OK, as for example
Samsung does similar thing with FBL/BL1). When SPL is

"trused"

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

we may use available facilities.

The issue to me is that sc_seco_authenticate could not
take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL,
U-Boot proper or Linux crypro engine driver?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Yes, it is an API accessible in SPL/U-Boot stage. I do not
know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this? Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

I would check it just out of curiosity.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific

container ?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated

signature.

Quoted 46 lines
Quoted 46 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 1 line

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in container. AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is
imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more

copy.

Quoted 15 lines
Quoted 15 lines
Quoted 1 line
Quoted 1 line

As a boot loader, isn't it better to have more image format supported?

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 2 lines

Do you have more comment?

Quoted 8 lines
Quoted 4 lines

How could Linux use this iMX8 chain of trust stuff to authenticate e.g. userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Userspace binaries don't use the same key pair. They are signed by software vendors' key. The private key for chip secure boot is only hold by

device manufacturer.

Quoted 2 lines

For example, android needs to authenticate a signed APK. Its public key (Key

Quoted 7 lines
Quoted 7 lines

A) is in system FS.

Quoted 2 lines

iMX trust chain only reaches to kernel + ramdisk. Then the chain hands over

to android.

Quoted 3 lines

In ramdisk, android puts another public Key (Key B) used by dm-verify for system FS. So once system FS is verified ok, then the public key A becomes trusted. Finally we can use public key A for APK

authentication.

Quoted 8 lines
Quoted 2 lines

So can we put a public key into the SPL and use it to verify a fitImage ?

Technically doable. But compared with the current approach that reuse ROM public API, Using crypto driver in SPL will be complicated and code size larger without calling ROM API.

I do not understand the problem the SPL loading NXP i.MX8 container

Quoted 8 lines

format.

Quoted 2 lines

SPL should only support raw and fit format? vendor format is not allowed and not accepted?

The problem I have is with the duplication of functionality -- the iMX8 custom format does exactly the same as fitImage, except differently and with smaller user base, thus with less users and reviewers and thus with less potential bugfixes, which I think in crypto code is important.

The change to spl mmc common code is as below:

common/spl/spl_mmc.c +10 -0
index bf53a1dadf..6320af055b 100644
@@ -79,6 +79,16 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
                load.bl_len = mmc->read_bl_len;
                load.read = h_spl_load_read;
                ret = spl_load_simple_fit(spl_image, &load, sector, header);
+       } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) {
+               struct spl_load_info load;
+
+               load.dev = mmc;
+               load.priv = NULL;
+               load.filename = NULL;
+               load.bl_len = mmc->read_bl_len;
+               load.read = h_spl_load_read;
+
+               ret = spl_load_imx_container(spl_image, &load, sector);
        } else {
 
Quoted 1 line

If IMX_CONTAINER is not preferred

I never implied that.

Quoted 3 lines

, I'll change it to CONFIG_SPL_LOAD_VENDOR_FORMAT.
In this way, only i.MX users need to take care container format, non i.MX users no need to care about that.

That would make it even worse, since if we follow this course of development, I suspect iMX9 will have another different container format and the list will grow on.

Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic fitImage? What is the selling point here ?

Signature · 2 lines
Best regards,
Marek Vasut
author
#34 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 166 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 17 lines · Peng Fan
Quoted 17 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 13 lines · Peng Fan
Quoted 13 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 9 lines · Ye Li
Quoted 8 lines · Marek Vasut

Caution: EXT Email

Quoted 5 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 3 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Hi Marek,

Quoted 5 lines · Marek Vasut

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 1 line
Quoted 1 line
Quoted 1 line

By using above approach we do have the NXP's

"container"

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

format only seen in the SPL (which is OK, as for
example Samsung does similar thing with FBL/BL1).

When

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

SPL is

"trused"

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 13 lines

we may use available facilities.

The issue to me is that sc_seco_authenticate could not
take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL,
U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not
know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this?
Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below. Does it really matter?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific

container ?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated

Quoted 6 lines
Quoted 6 lines

signature.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in

container.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is
imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

copy.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

As a boot loader, isn't it better to have more image format

supported?

Quoted 42 lines
Quoted 42 lines
Quoted 25 lines
Quoted 25 lines
Quoted 14 lines
Quoted 14 lines

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 2 lines

Do you have more comment?

Quoted 8 lines
Quoted 4 lines

How could Linux use this iMX8 chain of trust stuff to authenticate e.g. userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Userspace binaries don't use the same key pair. They are signed by software vendors' key. The private key for chip secure boot is only hold by

device manufacturer.

Quoted 2 lines

For example, android needs to authenticate a signed APK. Its public key (Key

Quoted 8 lines
Quoted 8 lines

A) is in system FS.

Quoted 2 lines

iMX trust chain only reaches to kernel + ramdisk. Then the chain hands over

to android.

Quoted 4 lines

In ramdisk, android puts another public Key (Key B) used by dm-verify for system FS. So once system FS is verified ok, then the public key A becomes trusted. Finally we can use public key A for APK

authentication.

Quoted 8 lines
Quoted 2 lines

So can we put a public key into the SPL and use it to verify a fitImage ?

Technically doable. But compared with the current approach that reuse ROM public API, Using crypto driver in SPL will be complicated and code size larger without calling ROM API.

I do not understand the problem the SPL loading NXP i.MX8 container

Quoted 8 lines
Quoted 8 lines

format.

Quoted 2 lines

SPL should only support raw and fit format? vendor format is not allowed and not accepted?

The problem I have is with the duplication of functionality -- the iMX8 custom format does exactly the same as fitImage, except differently and with smaller user base, thus with less users and reviewers and thus with less potential bugfixes, which I think in crypto

code is important.

common/spl/spl_mmc.c int mmc_load_image_raw_sector(struct

Quoted 7 lines

The change to spl mmc common code is as below:

common/spl/spl_mmc.c index renamed from common/spl/spl_mmc.c +0 -0

bf53a1dadf..6320af055b 100644

common/spl/spl_mmc.c +0 -0
@@ -79,6 +79,16 @@ int mmc_load_image_raw_sector(struct

spl_image_info *spl_image,

Quoted 17 lines
common/spl/spl_mmc.c +11 -0
                load.bl_len = mmc->read_bl_len;
                load.read = h_spl_load_read;
                ret = spl_load_simple_fit(spl_image, &load, sector,
 header);
+       } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) {
+               struct spl_load_info load;
+
+               load.dev = mmc;
+               load.priv = NULL;
+               load.filename = NULL;
+               load.bl_len = mmc->read_bl_len;
+               load.read = h_spl_load_read;
+
+               ret = spl_load_imx_container(spl_image, &load,
+ sector);
        } else {
Quoted 1 line

If IMX_CONTAINER is not preferred

I never implied that.

Quoted 7 lines
Quoted 3 lines

, I'll change it to CONFIG_SPL_LOAD_VENDOR_FORMAT.
In this way, only i.MX users need to take care container format, non i.MX users no need to care about that.

That would make it even worse, since if we follow this course of development, I suspect iMX9 will have another different container format and the list will grow on.

Let me summary the previous SoC that NXP is actively maintaining i.MX6/7/7ULP/8M use IVT
i.MX8/8X use container

I could not disclose information about future i.MX SoC.

Quoted 5 lines
Quoted 3 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://www.nxp.com/docs/en/reference-manual/IMX8DQXPRM.pdf
Chapter 5 has information about container set and container.

Quoted 3 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic fitImage?

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other images. ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Thanks,
Peng.

Quoted 4 lines

--
Best regards,
Marek Vasut

#35 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 174 lines · Peng Fan
Quoted 166 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 17 lines · Peng Fan
Quoted 17 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 13 lines · Peng Fan
Quoted 13 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 9 lines · Ye Li
Quoted 8 lines · Marek Vasut

Caution: EXT Email

Quoted 5 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 3 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Hi Marek,

Quoted 5 lines · Marek Vasut

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 1 line
Quoted 1 line

By using above approach we do have the NXP's

"container"

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

format only seen in the SPL (which is OK, as for
example Samsung does similar thing with FBL/BL1).

When

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

SPL is

"trused"

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines

we may use available facilities.

The issue to me is that sc_seco_authenticate could not
take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL,
U-Boot proper or Linux crypro engine driver?

Yes, it is an API accessible in SPL/U-Boot stage. I do not
know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this?
Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question below.
Does it really matter?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific

container ?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated

Quoted 6 lines
Quoted 6 lines

signature.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in

container.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is
imx8 needs container format for signed image. We prefer directly loading container image than fit image.
If we pack fit image into container, obviously this will cause one more

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

copy.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

As a boot loader, isn't it better to have more image format

supported?

Quoted 42 lines
Quoted 42 lines
Quoted 25 lines
Quoted 25 lines
Quoted 14 lines
Quoted 14 lines

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 2 lines

Do you have more comment?

Quoted 8 lines
Quoted 4 lines

How could Linux use this iMX8 chain of trust stuff to authenticate e.g. userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Userspace binaries don't use the same key pair. They are signed by software vendors' key. The private key for chip secure boot is only hold by

device manufacturer.

Quoted 2 lines

For example, android needs to authenticate a signed APK. Its public key (Key

Quoted 8 lines
Quoted 8 lines

A) is in system FS.

Quoted 2 lines

iMX trust chain only reaches to kernel + ramdisk. Then the chain hands over

to android.

Quoted 4 lines

In ramdisk, android puts another public Key (Key B) used by dm-verify for system FS. So once system FS is verified ok, then the public key A becomes trusted. Finally we can use public key A for APK

authentication.

Quoted 8 lines
Quoted 2 lines

So can we put a public key into the SPL and use it to verify a fitImage ?

Technically doable. But compared with the current approach that reuse ROM public API, Using crypto driver in SPL will be complicated and code size larger without calling ROM API.

I do not understand the problem the SPL loading NXP i.MX8 container

Quoted 8 lines
Quoted 8 lines

format.

Quoted 2 lines

SPL should only support raw and fit format? vendor format is not allowed and not accepted?

The problem I have is with the duplication of functionality -- the iMX8 custom format does exactly the same as fitImage, except differently and with smaller user base, thus with less users and reviewers and thus with less potential bugfixes, which I think in crypto

code is important.

common/spl/spl_mmc.c int mmc_load_image_raw_sector(struct

Quoted 7 lines

The change to spl mmc common code is as below:

common/spl/spl_mmc.c index renamed from common/spl/spl_mmc.c +0 -0

bf53a1dadf..6320af055b 100644

common/spl/spl_mmc.c +0 -0
@@ -79,6 +79,16 @@ int mmc_load_image_raw_sector(struct

spl_image_info *spl_image,

Quoted 17 lines
common/spl/spl_mmc.c +11 -0
                load.bl_len = mmc->read_bl_len;
                load.read = h_spl_load_read;
                ret = spl_load_simple_fit(spl_image, &load, sector,
 header);
+       } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) {
+               struct spl_load_info load;
+
+               load.dev = mmc;
+               load.priv = NULL;
+               load.filename = NULL;
+               load.bl_len = mmc->read_bl_len;
+               load.read = h_spl_load_read;
+
+               ret = spl_load_imx_container(spl_image, &load,
+ sector);
        } else {
Quoted 1 line

If IMX_CONTAINER is not preferred

I never implied that.

Quoted 7 lines
Quoted 3 lines

, I'll change it to CONFIG_SPL_LOAD_VENDOR_FORMAT.
In this way, only i.MX users need to take care container format, non i.MX users no need to care about that.

That would make it even worse, since if we follow this course of development, I suspect iMX9 will have another different container format and the list will grow on.

Quoted 5 lines

Let me summary the previous SoC that NXP is actively maintaining i.MX6/7/7ULP/8M use IVT
i.MX8/8X use container

I could not disclose information about future i.MX SoC.

My assumption is that the future iMX SoC will use yet another different container format.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://www.nxp.com/docs/en/reference-manual/IMX8DQXPRM.pdf
Chapter 5 has information about container set and container.

Thanks, any specific part of those 80 pages ?

Quoted 5 lines
Quoted 2 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic fitImage?

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Great

Quoted 7 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other images. ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Signature · 2 lines
Best regards,
Marek Vasut
author
#36 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 207 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 43 lines · Peng Fan
Quoted 43 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 17 lines · Peng Fan
Quoted 17 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 13 lines · Peng Fan
Quoted 13 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 9 lines · Ye Li
Quoted 8 lines · Marek Vasut

Caution: EXT Email

Quoted 5 lines · Peng Fan

Hi Marek, Lukasz,

Quoted 3 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Hi Marek,

Quoted 5 lines · Marek Vasut

Caution: EXT Email

On 5/22/19 9:34 AM, Lukasz Majewski wrote:
[...]

Quoted 1 line

By using above approach we do have the NXP's

"container"

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

format only seen in the SPL (which is OK, as for
example Samsung does similar thing with FBL/BL1).

When

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

SPL is

"trused"

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

we may use available facilities.

The issue to me is that sc_seco_authenticate could not
take a FIT image as input.

Is the sc_seco_authenticate an API accessible from SPL,
U-Boot proper or Linux crypro engine driver?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Yes, it is an API accessible in SPL/U-Boot stage. I do
not know about Linux crypto driver.

Maybe it would be worth to check how Linux handle this?
Maybe it would shed some more light on it?

I am not familiar with that, so might be stupid question

below.

Quoted 45 lines
Quoted 45 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Does it really matter?

I would check it just out of curiosity.

Yes, it matters, because there should be such API. How would Linux authenticate e.g. userspace binaries if there wasn't one, surely not by wrapping every single object into the custom vendor-specific

container ?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

And if there is one, you can use it to authenticate raw binaries from U-Boot SPL too, e.g. fitImage blobs with an associated

Quoted 7 lines
Quoted 7 lines

signature.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

iMX8 AHAB uses RSA key pair for authentication, the on-chip thing we called SRK is a array of public key hash which is dedicated for AHAB. It is not a real key. The real public key is in

container.

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

AHAB will check the public key with the on-chip SRK before using it to authenticate the image.
Seco which contains the crypto engine on imx8 does not allow to use the SRK by user. No such API exported.
And the fuse of SRK is locked, can't be read directly.

Actually on imx6/imx7/imx8m, the SPL and u-boot are already using ROM HAB to implement the trust chain, like SPL authenticates u-boot, u-boot authenticatse kernel. We just follow this same way on imx8, the difference is imx8 needs container format for signed image. We prefer directly loading container image than fit image. If we pack fit image into container, obviously this will cause one more

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

copy.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

As a boot loader, isn't it better to have more image format

supported?

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

If the functionality of the new image format is a subset of already present image format, then no, that's called a duplication.

Quoted 3 lines
Quoted 3 lines

We
don't force to use container, just set it as default. Users still can choose fit or raw image.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

They can. however they cannot authenticate the fitImage because the firmware doesn't provide the necessary API for that ?

Quoted 2 lines

Do you have more comment?

How could Linux use this iMX8 chain of trust stuff to authenticate

e.g.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 7 lines
Quoted 3 lines

userspace binaries ? It's the same thing as authenticating blob in a fitImage.

Userspace binaries don't use the same key pair. They are signed by software vendors' key. The private key for chip secure boot is only hold by

device manufacturer.

Quoted 2 lines

For example, android needs to authenticate a signed APK. Its public key (Key

A) is in system FS.

Quoted 2 lines

iMX trust chain only reaches to kernel + ramdisk. Then the chain hands over

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

to android.

Quoted 4 lines

In ramdisk, android puts another public Key (Key B) used by dm-verify for system FS. So once system FS is verified ok, then the public key A becomes trusted. Finally we can use public key A for APK

authentication.

Quoted 2 lines
Quoted 2 lines

So can we put a public key into the SPL and use it to verify a

fitImage ?

Quoted 50 lines
Quoted 50 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Technically doable. But compared with the current approach that reuse ROM public API, Using crypto driver in SPL will be complicated and code size larger without calling ROM API.

I do not understand the problem the SPL loading NXP i.MX8 container

format.

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

SPL should only support raw and fit format? vendor format is not allowed and not accepted?

The problem I have is with the duplication of functionality -- the iMX8 custom format does exactly the same as fitImage, except differently and with smaller user base, thus with less users and reviewers and thus with less potential bugfixes, which I think in crypto

code is important.

common/spl/spl_mmc.c int mmc_load_image_raw_sector(struct

Quoted 7 lines

The change to spl mmc common code is as below:

common/spl/spl_mmc.c index renamed from common/spl/spl_mmc.c +0 -0

bf53a1dadf..6320af055b 100644

common/spl/spl_mmc.c +0 -0
@@ -79,6 +79,16 @@ int mmc_load_image_raw_sector(struct

spl_image_info *spl_image,

Quoted 17 lines
common/spl/spl_mmc.c +11 -0
                load.bl_len = mmc->read_bl_len;
                load.read = h_spl_load_read;
                ret = spl_load_simple_fit(spl_image, &load, sector,
 header);
+       } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) {
+               struct spl_load_info load;
+
+               load.dev = mmc;
+               load.priv = NULL;
+               load.filename = NULL;
+               load.bl_len = mmc->read_bl_len;
+               load.read = h_spl_load_read;
+
+               ret = spl_load_imx_container(spl_image, &load,
+ sector);
        } else {
Quoted 1 line

If IMX_CONTAINER is not preferred

I never implied that.

Quoted 3 lines

, I'll change it to CONFIG_SPL_LOAD_VENDOR_FORMAT.
In this way, only i.MX users need to take care container format, non i.MX users no need to care about that.

Quoted 8 lines
Quoted 3 lines

That would make it even worse, since if we follow this course of development, I suspect iMX9 will have another different container format and the list will grow on.

Let me summary the previous SoC that NXP is actively maintaining i.MX6/7/7ULP/8M use IVT i.MX8/8X use container

I could not disclose information about future i.MX SoC.

My assumption is that the future iMX SoC will use yet another different container format.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.

Quoted 1 line

nxp.com%2Fdocs%2Fen%2Freference-manual%2FIMX8DQXPRM.pdf&amp;da ta=02%7C

Quoted 1 line

01%7Cpeng.fan%40nxp.com%7C72216052f4234a93ad1f08d6e95ed782%7C6 86ea1d3b

Quoted 1 line
Quoted 8 lines

c2b4c6fa92cd99c5c301635%7C0%7C1%7C636952990895125305&amp;sdat a=KO%2B0e

Quoted 1 line

E3v%2FkHuJ%2BhR7mBgc4NWXxbMUupfubXXu%2BueIWo%3D&amp;reserv ed=0

Quoted 1 line

Chapter 5 has information about container set and container.

Thanks, any specific part of those 80 pages ?

Figure 5-24. Container Format has a picture about a single container. i.MX8 container also support container sets, support encrypt blob, certificates, SRK management. Support signature to the whole container, no need single image inside container.

Quoted 17 lines
Quoted 6 lines
Quoted 3 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic fitImage?

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Great

Quoted 7 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other images. ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Quoted 3 lines

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Yes. Use what ROM provides will make things easier for U-Boot.

Thanks,
Peng.

Quoted 4 lines

--
Best regards,
Marek Vasut

#37 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 6/5/19 5:03 AM, Peng Fan wrote:
[...]

Quoted 19 lines
Quoted 19 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.

Quoted 1 line

nxp.com%2Fdocs%2Fen%2Freference-manual%2FIMX8DQXPRM.pdf&amp;da ta=02%7C

Quoted 1 line

01%7Cpeng.fan%40nxp.com%7C72216052f4234a93ad1f08d6e95ed782%7C6 86ea1d3b

Quoted 1 line

c2b4c6fa92cd99c5c301635%7C0%7C1%7C636952990895125305&amp;sdat a=KO%2B0e

Quoted 1 line

E3v%2FkHuJ%2BhR7mBgc4NWXxbMUupfubXXu%2BueIWo%3D&amp;reserv ed=0

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Chapter 5 has information about container set and container.

Thanks, any specific part of those 80 pages ?

Figure 5-24. Container Format has a picture about a single container. i.MX8 container also support container sets, support encrypt blob, certificates, SRK management. Support signature to the whole container, no need single image inside container.

Isn't that all supported in fitImage too ?

Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
Quoted 3 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic fitImage?

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Great

Quoted 7 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other images. ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Quoted 5 lines
Quoted 3 lines

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Yes. Use what ROM provides will make things easier for U-Boot.

Is it possible to perform a security audit on the ROM as easily as on U-Boot ? I mean, U-Boot is free software, the source is available, so security researchers can easily scrutinize it. Is the ROM ?

Signature · 2 lines
Best regards,
Marek Vasut
#38 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 23 lines · Marek Vasut

On 6/5/19 5:03 AM, Peng Fan wrote:
[...]

Quoted 21 lines
Quoted 21 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.

Quoted 1 line

nxp.com%2Fdocs%2Fen%2Freference-manual%2FIMX8DQXPRM.pdf&amp;da ta=02%7C

Quoted 1 line

01%7Cpeng.fan%40nxp.com%7C72216052f4234a93ad1f08d6e95ed782%7C6 86ea1d3b

Quoted 1 line

c2b4c6fa92cd99c5c301635%7C0%7C1%7C636952990895125305&amp;sdat a=KO%2B0e

Quoted 1 line

E3v%2FkHuJ%2BhR7mBgc4NWXxbMUupfubXXu%2BueIWo%3D&amp;reserv ed=0

Quoted 1 line

Chapter 5 has information about container set and container.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Thanks, any specific part of those 80 pages ?

Figure 5-24. Container Format has a picture about a single container. i.MX8 container also support container sets, support encrypt blob, certificates, SRK management. Support signature to the whole container, no need single image inside container.

Isn't that all supported in fitImage too ?

This is neither the first nor last time functionality has been essentially duplicated, sadly, for reasons.

Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 5 lines
Quoted 2 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic fitImage?

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Great

Quoted 7 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other images. ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Quoted 5 lines
Quoted 1 line

Yes. Use what ROM provides will make things easier for U-Boot.

Is it possible to perform a security audit on the ROM as easily as on U-Boot ? I mean, U-Boot is free software, the source is available, so security researchers can easily scrutinize it. Is the ROM ?

So, here's my two cents (and it may or may not seem contradictory with my opinions in the secure boot thread going on currently on the Linaro Boot Architecture list). Yes, it would and IMHO is better when we use free and open software to solve our problems (and an aside to the RISC-V folks as this is yet another area they can make the world a better place in). But I am a believe in dealing with the world as it stands at times too. The question isn't "can we get NXP to re-spin i.MX8 to use the FIT image format?" as that's obviously going to be "No.". The question is, "can we support this format in a clean manner?" and the answer is obviously "Yes.". So please lets keep that in mind with reviewing the code as at the end of the day it is more beneficial for this to be supported in mainline U-Boot than only supported in the vendor tree. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190605/8c85ad54/attachment.sig>
#39 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 62 lines · Tom Rini
Quoted 23 lines · Marek Vasut

On 6/5/19 5:03 AM, Peng Fan wrote:
[...]

Quoted 21 lines
Quoted 21 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.

Quoted 1 line

nxp.com%2Fdocs%2Fen%2Freference-manual%2FIMX8DQXPRM.pdf&amp;da ta=02%7C

Quoted 1 line

01%7Cpeng.fan%40nxp.com%7C72216052f4234a93ad1f08d6e95ed782%7C6 86ea1d3b

Quoted 1 line

c2b4c6fa92cd99c5c301635%7C0%7C1%7C636952990895125305&amp;sdat a=KO%2B0e

Quoted 1 line

E3v%2FkHuJ%2BhR7mBgc4NWXxbMUupfubXXu%2BueIWo%3D&amp;reserv ed=0

Quoted 1 line

Chapter 5 has information about container set and container.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Thanks, any specific part of those 80 pages ?

Figure 5-24. Container Format has a picture about a single container. i.MX8 container also support container sets, support encrypt blob, certificates, SRK management. Support signature to the whole container, no need single image inside container.

Isn't that all supported in fitImage too ?

This is neither the first nor last time functionality has been essentially duplicated, sadly, for reasons.

Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 5 lines
Quoted 2 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic fitImage?

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Great

Quoted 7 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other images. ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Quoted 5 lines
Quoted 1 line

Yes. Use what ROM provides will make things easier for U-Boot.

Is it possible to perform a security audit on the ROM as easily as on U-Boot ? I mean, U-Boot is free software, the source is available, so security researchers can easily scrutinize it. Is the ROM ?

Quoted 12 lines

So, here's my two cents (and it may or may not seem contradictory with my opinions in the secure boot thread going on currently on the Linaro Boot Architecture list). Yes, it would and IMHO is better when we use free and open software to solve our problems (and an aside to the RISC-V folks as this is yet another area they can make the world a better place in). But I am a believe in dealing with the world as it stands at times too. The question isn't "can we get NXP to re-spin i.MX8 to use the FIT image format?" as that's obviously going to be "No.". The question is, "can we support this format in a clean manner?" and the answer is obviously "Yes.". So please lets keep that in mind with reviewing the code as at the end of the day it is more beneficial for this to be supported in mainline U-Boot than only supported in the vendor tree.

I agree with this. I would still like to have an open alternative available though.

Signature · 2 lines
Best regards,
Marek Vasut
author
#40 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

In reply to Tom Rini
Quoted 39 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 9 lines · Marek Vasut

On 6/5/19 5:03 AM, Peng Fan wrote:
[...]

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

nxp.com%2Fdocs%2Fen%2Freference-manual%2FIMX8DQXPRM.pdf&amp;da

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ta=02%7C

Quoted 1 line

01%7Cpeng.fan%40nxp.com%7C72216052f4234a93ad1f08d6e95ed782%7C6

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

86ea1d3b

Quoted 1 line

c2b4c6fa92cd99c5c301635%7C0%7C1%7C636952990895125305&amp;sdat

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

a=KO%2B0e

Quoted 1 line

E3v%2FkHuJ%2BhR7mBgc4NWXxbMUupfubXXu%2BueIWo%3D&amp;reserv

Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

ed=0

Quoted 1 line

Chapter 5 has information about container set and container.

Thanks, any specific part of those 80 pages ?

Figure 5-24. Container Format has a picture about a single container. i.MX8 container also support container sets, support encrypt blob, certificates, SRK management. Support signature to the whole container, no need single image inside container.

Quoted 4 lines
Quoted 1 line

Isn't that all supported in fitImage too ?

This is neither the first nor last time functionality has been essentially duplicated, sadly, for reasons.

I'll share the fit things to our ROM stakeholders, but they take decision on new SoC design.

Quoted 29 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic

fitImage?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Great

Quoted 4 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other

images.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Quoted 5 lines
Quoted 1 line

Yes. Use what ROM provides will make things easier for U-Boot.

Is it possible to perform a security audit on the ROM as easily as on U-Boot ? I mean, U-Boot is free software, the source is available, so security researchers can easily scrutinize it. Is the ROM ?

Quoted 12 lines

So, here's my two cents (and it may or may not seem contradictory with my opinions in the secure boot thread going on currently on the Linaro Boot Architecture list). Yes, it would and IMHO is better when we use free and open software to solve our problems (and an aside to the RISC-V folks as this is yet another area they can make the world a better place in). But I am a believe in dealing with the world as it stands at times too. The question isn't "can we get NXP to re-spin i.MX8 to use the FIT image format?" as that's obviously going to be "No.". The question is, "can we support this format in a clean manner?" and the answer is obviously "Yes.". So please lets keep that in mind with reviewing the code as at the end of the day it is more beneficial for this to be supported in mainline U-Boot than only supported in the vendor tree.

Thanks. So I think you agree the current approach. Could I get any A-b or R-b tags from the list?

Thanks,
Peng.

Quoted 4 lines

Thanks!

--
Tom

#41 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 96 lines · On Thu, 6 Jun 2019 02:33:14 +0000 Peng Fan <[email protected]> wrote:
Quoted 39 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 9 lines · Marek Vasut

On 6/5/19 5:03 AM, Peng Fan wrote:
[...]

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

nxp.com%2Fdocs%2Fen%2Freference-manual%2FIMX8DQXPRM.pdf&amp;da

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ta=02%7C

Quoted 1 line

01%7Cpeng.fan%40nxp.com%7C72216052f4234a93ad1f08d6e95ed782%7C6

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

86ea1d3b

Quoted 1 line

c2b4c6fa92cd99c5c301635%7C0%7C1%7C636952990895125305&amp;sdat

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

a=KO%2B0e

Quoted 1 line

E3v%2FkHuJ%2BhR7mBgc4NWXxbMUupfubXXu%2BueIWo%3D&amp;reserv

Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

ed=0

Quoted 1 line

Chapter 5 has information about container set and container.

Thanks, any specific part of those 80 pages ?

Figure 5-24. Container Format has a picture about a single container. i.MX8 container also support container sets, support encrypt blob, certificates, SRK management. Support signature to the whole container, no need single image inside container.

Quoted 4 lines
Quoted 1 line

Isn't that all supported in fitImage too ?

This is neither the first nor last time functionality has been essentially duplicated, sadly, for reasons.

I'll share the fit things to our ROM stakeholders, but they take decision on new SoC design.

Quoted 34 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic

fitImage?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Great

Quoted 5 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other

images.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Quoted 6 lines
Quoted 1 line

Yes. Use what ROM provides will make things easier for U-Boot.

Is it possible to perform a security audit on the ROM as easily as on U-Boot ? I mean, U-Boot is free software, the source is available, so security researchers can easily scrutinize it. Is the ROM ?

Quoted 14 lines

So, here's my two cents (and it may or may not seem contradictory with my opinions in the secure boot thread going on currently on the Linaro Boot Architecture list). Yes, it would and IMHO is better when we use free and open software to solve our problems (and an aside to the RISC-V folks as this is yet another area they can make the world a better place in). But I am a believe in dealing with the world as it stands at times too. The question isn't "can we get NXP to re-spin i.MX8 to use the FIT image format?" as that's obviously going to be "No.". The question is, "can we support this format in a clean manner?" and the answer is obviously "Yes.". So please lets keep that in mind with reviewing the code as at the end of the day it is more beneficial for this to be supported in mainline U-Boot than only supported in the vendor tree.

Quoted 2 lines

Thanks. So I think you agree the current approach. Could I get any A-b or R-b tags from the list?

Just to add my 2 cents...

Please if possible provide a good (and as much verbose as possible) entry to ./doc/README.imx_image (or something) regarding the i.MX8 format.

Thanks in advance,

Quoted 8 lines

Thanks,
Peng.

Quoted 4 lines

Thanks!

--
Tom

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190606/f1e73b6d/attachment.sig>

author
#42 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 106 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 6 lines · On Thu, 6 Jun 2019 02:33:14 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 2 lines · Marek Vasut

On 6/5/19 5:03 AM, Peng Fan wrote:
[...]

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

nxp.com%2Fdocs%2Fen%2Freference-manual%2FIMX8DQXPRM.pdf&amp;da

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ta=02%7C

Quoted 1 line

01%7Cpeng.fan%40nxp.com%7C72216052f4234a93ad1f08d6e95ed782%7C6

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

86ea1d3b

Quoted 1 line

c2b4c6fa92cd99c5c301635%7C0%7C1%7C636952990895125305&amp;sdat

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

a=KO%2B0e

Quoted 1 line

E3v%2FkHuJ%2BhR7mBgc4NWXxbMUupfubXXu%2BueIWo%3D&amp;reserv

Quoted 66 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

ed=0

Quoted 1 line

Chapter 5 has information about container set and container.

Thanks, any specific part of those 80 pages ?

Figure 5-24. Container Format has a picture about a single container. i.MX8 container also support container sets, support encrypt blob, certificates, SRK management. Support signature to the whole container, no need single image inside container.

Quoted 4 lines
Quoted 1 line

Isn't that all supported in fitImage too ?

This is neither the first nor last time functionality has been essentially duplicated, sadly, for reasons.

I'll share the fit things to our ROM stakeholders, but they take decision on new SoC design.

Quoted 47 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic

fitImage?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Great

Quoted 5 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other

images.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines

ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Quoted 6 lines
Quoted 1 line

Yes. Use what ROM provides will make things easier for U-Boot.

Is it possible to perform a security audit on the ROM as easily as on U-Boot ? I mean, U-Boot is free software, the source is available, so security researchers can easily scrutinize it. Is the ROM ?

So, here's my two cents (and it may or may not seem contradictory with my opinions in the secure boot thread going on currently on the Linaro Boot Architecture list). Yes, it would and IMHO is better when we use free and open software to solve our problems (and an aside to the RISC-V folks as this is yet another area they can make the world a better place in). But I am a believe in dealing with the world as it stands at times too. The question isn't "can we get NXP to re-spin i.MX8 to use the FIT image format?" as that's obviously going to be "No.". The question is, "can we support this format in a clean manner?" and the answer is obviously "Yes.". So please lets keep that in mind with reviewing the code as at the end of the day it is more beneficial for this to be supported in mainline U-Boot than only supported in the vendor tree.

Quoted 7 lines
Quoted 2 lines

Thanks. So I think you agree the current approach. Could I get any A-b or R-b tags from the list?

Just to add my 2 cents...

Please if possible provide a good (and as much verbose as possible) entry to ./doc/README.imx_image (or something) regarding the i.MX8 format.

ok. I'll post out a separate patch for that.

Regards,
Peng.

Quoted 25 lines

Thanks in advance,

Quoted 8 lines

Thanks,
Peng.

Quoted 4 lines

Thanks!

--
Tom

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#43 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

In reply to Peng Fan
Quoted 89 lines · Peng Fan
Quoted 39 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 9 lines · Marek Vasut

On 6/5/19 5:03 AM, Peng Fan wrote:
[...]

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

nxp.com%2Fdocs%2Fen%2Freference-manual%2FIMX8DQXPRM.pdf&amp;da

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ta=02%7C

Quoted 1 line

01%7Cpeng.fan%40nxp.com%7C72216052f4234a93ad1f08d6e95ed782%7C6

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

86ea1d3b

Quoted 1 line

c2b4c6fa92cd99c5c301635%7C0%7C1%7C636952990895125305&amp;sdat

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

a=KO%2B0e

Quoted 1 line

E3v%2FkHuJ%2BhR7mBgc4NWXxbMUupfubXXu%2BueIWo%3D&amp;reserv

Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

ed=0

Quoted 1 line

Chapter 5 has information about container set and container.

Thanks, any specific part of those 80 pages ?

Figure 5-24. Container Format has a picture about a single container. i.MX8 container also support container sets, support encrypt blob, certificates, SRK management. Support signature to the whole container, no need single image inside container.

Quoted 4 lines
Quoted 1 line

Isn't that all supported in fitImage too ?

This is neither the first nor last time functionality has been essentially duplicated, sadly, for reasons.

I'll share the fit things to our ROM stakeholders, but they take decision on new SoC design.

Quoted 29 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic

fitImage?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Great

Quoted 4 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other

images.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Quoted 5 lines
Quoted 1 line

Yes. Use what ROM provides will make things easier for U-Boot.

Is it possible to perform a security audit on the ROM as easily as on U-Boot ? I mean, U-Boot is free software, the source is available, so security researchers can easily scrutinize it. Is the ROM ?

Quoted 12 lines

So, here's my two cents (and it may or may not seem contradictory with my opinions in the secure boot thread going on currently on the Linaro Boot Architecture list). Yes, it would and IMHO is better when we use free and open software to solve our problems (and an aside to the RISC-V folks as this is yet another area they can make the world a better place in). But I am a believe in dealing with the world as it stands at times too. The question isn't "can we get NXP to re-spin i.MX8 to use the FIT image format?" as that's obviously going to be "No.". The question is, "can we support this format in a clean manner?" and the answer is obviously "Yes.". So please lets keep that in mind with reviewing the code as at the end of the day it is more beneficial for this to be supported in mainline U-Boot than only supported in the vendor tree.

Quoted 2 lines

Thanks. So I think you agree the current approach. Could I get any A-b or R-b tags from the list?

I would still like an answer to my question about the security auditing above.

Signature · 2 lines
Best regards,
Marek Vasut
author
#44 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 98 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 6 lines · Peng Fan
Quoted 6 lines

Subject: Re: [EXT] Re: [U-Boot] [PATCH 4/6] spl: mmc: support loading i.MX container format file

Quoted 2 lines · Marek Vasut

On 6/5/19 5:03 AM, Peng Fan wrote:
[...]

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

It is not duplication of FIT. Container support the similar function of FIT image, but it is not only that.

So what is it ?

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

nxp.com%2Fdocs%2Fen%2Freference-manual%2FIMX8DQXPRM.pdf&amp;da

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

ta=02%7C

Quoted 1 line

01%7Cpeng.fan%40nxp.com%7C72216052f4234a93ad1f08d6e95ed782%7C6

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

86ea1d3b

Quoted 1 line

c2b4c6fa92cd99c5c301635%7C0%7C1%7C636952990895125305&amp;sdat

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

a=KO%2B0e

Quoted 1 line

E3v%2FkHuJ%2BhR7mBgc4NWXxbMUupfubXXu%2BueIWo%3D&amp;reserv

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines

ed=0

Quoted 1 line

Chapter 5 has information about container set and container.

Thanks, any specific part of those 80 pages ?

Figure 5-24. Container Format has a picture about a single container. i.MX8 container also support container sets, support encrypt blob, certificates, SRK management. Support signature to the whole container, no need single image inside container.

Quoted 49 lines
Quoted 4 lines
Quoted 1 line

Isn't that all supported in fitImage too ?

This is neither the first nor last time functionality has been essentially duplicated, sadly, for reasons.

I'll share the fit things to our ROM stakeholders, but they take decision on new SoC design.

Quoted 41 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I don't think I get it. Why would I, as an iMX8 user, want to pick custom new vendor-specific format over years-proven generic

fitImage?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines

We not against FIT, we already use FIT on i.MX8M, to let spl to authenticate FIT image using ROM HAB, not using crypto driver.

Great

Quoted 4 lines
Quoted 1 line

What is the selling point here ?

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other

images.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Quoted 5 lines
Quoted 1 line

Yes. Use what ROM provides will make things easier for U-Boot.

Is it possible to perform a security audit on the ROM as easily as on U-Boot ? I mean, U-Boot is free software, the source is available, so security researchers can easily scrutinize it. Is the ROM ?

So, here's my two cents (and it may or may not seem contradictory with my opinions in the secure boot thread going on currently on the Linaro Boot Architecture list). Yes, it would and IMHO is better when we use free and open software to solve our problems (and an aside to the RISC-V folks as this is yet another area they can make the world a better place in). But I am a believe in dealing with the world as it stands at times too. The question isn't "can we get NXP to re-spin i.MX8 to use the FIT image format?" as that's obviously going to be "No.". The question is, "can we support this format in a clean manner?" and the answer is obviously "Yes.". So please lets keep that in mind with reviewing the code as at the end of the day it is more beneficial for this to be supported in mainline U-Boot than only

Quoted 6 lines

supported in the vendor tree.

Quoted 3 lines

Thanks. So I think you agree the current approach. Could I get any A-b or R-b tags from the list?

I would still like an answer to my question about the security auditing above.

Sorry. Missed your thread. I not work on ROM stuff, but I think answer is no to public.

Thanks,
Peng.

Quoted 4 lines

--
Best regards,
Marek Vasut

#45 lore raw

[U-Boot] [EXT] Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

On 6/6/19 9:54 AM, Peng Fan wrote:

[...]

Quoted 31 lines
Quoted 31 lines
Quoted 17 lines
Quoted 17 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

We would not introduce cypto driver in SPL stage, that means HAB FIT and AHAB container needs to be dropped when SPL loading other

images.

Quoted 13 lines
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

ROM already provides API for bootloader to authenticate images, introducing complex crypto driver in SPL could enlarge code size and make things complicated.

Ah I see, so it's all making the whole crypto simpler by offloading the hard parts into the firmware, which just magically handles everything , without having much extra code in the SPL ?

Yes. Use what ROM provides will make things easier for U-Boot.

Is it possible to perform a security audit on the ROM as easily as on U-Boot ? I mean, U-Boot is free software, the source is available, so security researchers can easily scrutinize it. Is the ROM ?

Quoted 12 lines
Quoted 4 lines

So, here's my two cents (and it may or may not seem contradictory with my opinions in the secure boot thread going on currently on the Linaro Boot Architecture list). Yes, it would and IMHO is better when we use free and open software to solve our problems (and an

Quoted 8 lines

aside to the RISC-V folks as this is yet another area they can make the world a better place in). But I am a believe in dealing with the world as it stands at times too. The question isn't "can we get NXP to re-spin i.MX8 to use the FIT image format?" as that's obviously going to be "No.". The question is, "can we support this format in a clean manner?" and the answer is obviously "Yes.". So please lets keep that in mind with reviewing the code as at the end of the day it is more beneficial for this to be supported in mainline U-Boot than only

supported in the vendor tree.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Thanks. So I think you agree the current approach. Could I get any A-b or R-b tags from the list?

I would still like an answer to my question about the security auditing above.

Sorry. Missed your thread. I not work on ROM stuff, but I think answer is no to public.

I see.

Signature · 2 lines
Best regards,
Marek Vasut
author
#46 lore raw

PATCH 4/6 spl: mmc: support loading i.MX container format file

In reply to Peng Fan

Simon,

Quoted 22 lines

Subject: RE: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Simon,

Quoted 11 lines

Subject: Re: [PATCH 4/6] spl: mmc: support loading i.MX container format file

Hi Peng,

Quoted 3 lines · Peng Fan

i.MX8 only support AHAB secure boot with Container format image, we could not use FIT to support secure boot, so introduce container

Why not FIT?

Actually before we implement secure boot, we use FIT image, however i.MX8 only support i.MX container format image for secure boot, The chip will verify the container image when secure boot. It could not recognize FIT image. So we have to drop FIT image.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

support to let SPL could load container images.

What is a container image? Can you please point to documentation?

Sadly, there is no public reference manual. There is a doc that has a bit of information. https://community.nxp.com/docs/DOC-343178

https://www.nxp.com/docs/en/reference-manual/IMX8DQXPRM.pdf
Chapter 5.9.4 High Level Container Format

Thanks,
Peng.

Quoted 23 lines

Thanks,
Peng.

Quoted 19 lines
Quoted 12 lines
Cc Simon Goldschmidt <[email protected]>
Cc Tien Fong Chee <[email protected]>
Cc York Sun <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Alex Kiernan <[email protected]>
Cc Simon Glass <[email protected]>
Cc Philipp Tomsich <[email protected]>
Cc Kever Yang <[email protected]>
Cc Heiko Schocher <[email protected]>
Quoted 4 lines
---
 common/spl/spl_mmc.c | 10 ++++++++++
 include/spl.h        | 12 ++++++++++++
 2 files changed, 22 insertions(+)

Regards,
Simon

author
#47 lore raw

PATCH 5/6 imx: add container target

In reply to Peng Fan

To support SPL loading container file, add a new Makefile target, and introduce a new Kconfig file to source the cfg file which will be parsed by mkimage.

---
 Makefile                       |  8 ++++++++
 arch/arm/mach-imx/Makefile     | 14 ++++++++++++++
 arch/arm/mach-imx/imx8/Kconfig |  7 +++++++
 3 files changed, 29 insertions(+)
Makefile +8 -0
index d6a6ef19ab..2912cebaf6 100644
@@ -1300,9 +1300,17 @@ SPL: spl/u-boot-spl.bin FORCE
 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
 
 ifeq ($(CONFIG_ARCH_IMX8M)$(CONFIG_ARCH_IMX8), y)
+ifeq ($(CONFIG_SPL_LOAD_IMX_CONTAINER), y)
+u-boot.cnt: u-boot.bin FORCE
+	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
+
+flash.bin: spl/u-boot-spl.bin u-boot.cnt FORCE
+	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
+else
 flash.bin: spl/u-boot-spl.bin u-boot.itb FORCE
 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
 endif
+endif
 
 u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE
 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
arch/arm/mach-imx/Makefile +14 -0
index 0562640599..494eee8e5a 100644
@@ -104,6 +104,11 @@ IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%)
 	$(Q)mkdir -p $(dir $@)
 	$(call if_changed_dep,cpp_cfg)
 
+IMX_CONTAINER_CFG = $(CONFIG_IMX_CONTAINER_CFG:"%"=%)
+container.cfg: $(IMX_CONTAINER_CFG) FORCE
+	$(Q)mkdir -p $(dir $@)
+	$(call if_changed_dep,cpp_cfg)
+
 DEPFILE_EXISTS := 0
 ifeq ($(CONFIG_ARCH_IMX8), y)
 CNTR_DEPFILES := $(srctree)/tools/imx_cntr_image.sh
@@ -161,7 +166,16 @@ SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
 MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e 0x100000
 flash.bin: MKIMAGEOUTPUT = flash.log
 
+MKIMAGEFLAGS_u-boot.cnt = -n container.cfg -T $(IMAGE_TYPE) -e 0x100000
+u-boot.cnt: MKIMAGEOUTPUT = u-boot.cnt.log
+
+ifeq ($(CONFIG_SPL_LOAD_IMX_CONTAINER), y)
+u-boot.cnt: u-boot.bin container.cfg FORCE
+	$(call if_changed,mkimage)
+flash.bin: spl/u-boot-spl.bin u-boot.cnt FORCE
+else
 flash.bin: spl/u-boot-spl.bin u-boot.itb FORCE
+endif
 	$(eval SPL_DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout $(srctree)/$(IMX_CONFIG); if [ -f spl/u-boot-spl.cfgout ]; then $(CNTR_DEPFILES) spl/u-boot-spl.cfgout; echo $$?; fi))
 ifeq ($(SPL_DEPFILE_EXISTS),0)
 	$(call if_changed,mkimage)
arch/arm/mach-imx/imx8/Kconfig +7 -0
index 8e6b79eb77..8128ec16b4 100644
@@ -29,6 +29,13 @@ config SPL_LOAD_IMX_CONTAINER
 	help
 	  This is to let SPL could load i.MX8 Container image
 
+config IMX_CONTAINER_CFG
+	string "i.MX Container config file"
+	depends on SPL
+	help
+	  This is to specific the cfg file for generating container
+	  image which will be loaded by SPL.
+
 choice
 	prompt "i.MX8 board select"
 	optional
Signature · 1 line
2.16.4
author
#48 lore raw

PATCH 6/6 imx8qxp_mek: switch to use container image

In reply to Peng Fan

Because FIT could not be used for AHAB secure boot on i.MX8, so switch to use container image that could let SPL verify ATF and U-Boot with AHAB.

Note: The AHAB related code has not been added.

---
 board/freescale/imx8qxp_mek/README              |  4 +---
 board/freescale/imx8qxp_mek/uboot-container.cfg | 13 +++++++++++++
 configs/imx8qxp_mek_defconfig                   |  5 ++---
 3 files changed, 16 insertions(+), 6 deletions(-)
 create mode 100644 board/freescale/imx8qxp_mek/uboot-container.cfg
board/freescale/imx8qxp_mek/README +1 -3
index f32290e3a2..6dc151b166 100644
@@ -39,11 +39,9 @@ $ cp imx-sc-firmware-0.7/mx8qx-mek-scfw-tcm.bin	.
 
 Build U-Boot
 ============
-$ export ATF_LOAD_ADDR=0x80000000
-$ export BL33_LOAD_ADDR=0x80020000
 $ make imx8qxp_mek_defconfig
 $ make flash.bin
-$ dd if=u-boot.itb of=flash.bin bs=512 seek=528
+$ dd if=u-boot.cnt of=flash.bin bs=512 seek=528
 
 Flash the binary into the SD card
 =================================
board/freescale/imx8qxp_mek/uboot-container.cfg new file +13 -0
new file mode 100644
index 0000000000..8165811818
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#define __ASSEMBLY__
+
+/* This file is to create a container image could be loaded by SPL */
+BOOT_FROM SD 0x400
+SOC_TYPE IMX8QX
+CONTAINER
+IMAGE A35 bl31.bin	0x80000000
+IMAGE A35 u-boot.bin	CONFIG_SYS_TEXT_BASE
configs/imx8qxp_mek_defconfig +2 -3
index 6101f62087..8fafb3cf1a 100644
@@ -5,15 +5,14 @@ CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SPL_LOAD_IMX_CONTAINER=y
+CONFIG_IMX_CONTAINER_CFG="board/freescale/imx8qxp_mek/uboot-container.cfg"
 CONFIG_TARGET_IMX8QXP_MEK=y
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
 CONFIG_NR_DRAM_BANKS=3
 CONFIG_SPL=y
-CONFIG_FIT=y
-CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/imx8qxp_mek/imximage.cfg"
 CONFIG_BOOTDELAY=3
 CONFIG_LOG=y
Signature · 1 line
2.16.4