Determine Boot mode at run time
Subsystems (2)
v3 cover Determine Boot mode at run time
There are two phases in Secure Boot
1. ISBC: In BootROM, validate the BootLoader (U-Boot).
2. ESBC: In U-Boot, continuing the Chain of Trust by validating and booting LINUX.
For ESBC phase, there is no difference in SoC's based on ARM or PowerPC cores.
But the exit conditions after ISBC phase i.e. entry conditions for U-Boot are different for ARM and PowerPC.
PowerPC:
========
If Secure Boot is executed, a separate U-Boot target is required which must be compiled with a diffrent Text Base as compared to Non-Secure Boot. There are some LAW and TLB settings which are required specifically for Secure Boot scenario.
ARM:
====
ARM based SoC's have a fixed memory map and exit conditions from BootROM are same irrespective of boot mode (Secure or Non-Secure).
This patchset is aimed at removing the requirement for a separate Secure Boot target for ARM based SoC's.
Another Security Requirement for running CHAIN_OF_TRUST is that U-Boot environemnt must not be picked from flash/external memory. This cannot be done based on bootmode at run time in current U-Boot architecture. Once this dependency is resolved, no separate SECURE_BOOT target will be required for ARM based SoC's.
Currently, the only code under CONFIG_SECURE_BOOT for ARM SoC's is defining CONFIG_ENV_IS_NOWHERE
The patches have been tested on LS1043, LS1021, P3041 and T1024.
The patch set is dependent on following:
http://patchwork.ozlabs.org/patch/553826/
Aneesh Bansal (7):
include/configs: make secure boot header file include uniform include/configs: move definition of CONFIG_CMD_BLOB
SECURE_BOOT: split the secure boot functionality in two parts create function to determine boot mode
enable chain of trust for ARM platforms
enable chain of trust for PowerPC platforms
SECURE_BOOT: change error handler for esbc_validate
arch/arm/cpu/armv8/fsl-layerscape/soc.c | 6 ++ .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 + arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h | 2 + arch/arm/include/asm/fsl_secure_boot.h | 20 +++- arch/powerpc/cpu/mpc85xx/cpu_init.c | 14 +++ arch/powerpc/include/asm/fsl_secure_boot.h | 47 ++++++--- arch/powerpc/include/asm/immap_85xx.h | 3 + board/freescale/common/Makefile | 1 + board/freescale/common/cmd_esbc_validate.c | 7 +- board/freescale/common/fsl_chain_of_trust.c | 70 +++++++++++++ board/freescale/common/fsl_validate.c | 7 ++ board/freescale/ls1021aqds/ls1021aqds.c | 4 + board/freescale/ls1021atwr/ls1021atwr.c | 4 + include/config_fsl_chain_trust.h | 101 ++++++++++++++++++ include/config_fsl_secboot.h | 116 --------------------- include/configs/B4860QDS.h | 4 - include/configs/BSC9132QDS.h | 4 - include/configs/P1010RDB.h | 4 - include/configs/P2041RDB.h | 4 - include/configs/T102xQDS.h | 10 +- include/configs/T102xRDB.h | 10 +- include/configs/T1040QDS.h | 3 - include/configs/T104xRDB.h | 3 - include/configs/T208xQDS.h | 4 - include/configs/T208xRDB.h | 4 - include/configs/T4240QDS.h | 4 - include/configs/T4240RDB.h | 9 -- include/configs/corenet_ds.h | 4 - include/configs/ls1021aqds.h | 5 +- include/configs/ls1021atwr.h | 5 +- include/configs/ls1043a_common.h | 8 ++ include/configs/ls1043aqds.h | 2 + include/configs/ls1043ardb.h | 8 -- include/fsl_validate.h | 2 + 34 files changed, 299 insertions(+), 203 deletions(-) create mode 100644 board/freescale/common/fsl_chain_of_trust.c create mode 100644 include/config_fsl_chain_trust.h delete mode 100644 include/config_fsl_secboot.h
Signature · 1 line
1.8.1.4
PATCH v3 1/7 include/configs: make secure boot header file include uniform
The file fsl_secure_boot.h must be included in config file for Secure Boot. This is not required to be protected by any macro.CONFIG_FSL_CAAM must be defined and CONFIG_CMD_HASH should be turned on.
The above was missing in some config files and all files have been made uniform in this respect.
---
Changes in v3:
None
Changes in v2:
None (Changed the Sign-Off with New E-Mail ID)
arch/arm/include/asm/fsl_secure_boot.h | 5 +++++ include/configs/C29XPCIE.h | 4 ++++ include/configs/T102xQDS.h | 12 +++++++++++- include/configs/T102xRDB.h | 12 +++++++++++- include/configs/T1040QDS.h | 3 ++- include/configs/T104xRDB.h | 3 ++- include/configs/T208xQDS.h | 3 ++- include/configs/T208xRDB.h | 3 ++- include/configs/ls1021aqds.h | 5 ++++- include/configs/ls1021atwr.h | 5 ++++- include/configs/ls1043a_common.h | 8 ++++++++ include/configs/ls1043aqds.h | 2 ++ include/configs/ls1043ardb.h | 8 -------- 13 files changed, 57 insertions(+), 16 deletions(-)
arch/arm/include/asm/fsl_secure_boot.h +5 -0
@@ -34,6 +34,11 @@#define CONFIG_FSL_ISBC_KEY_EXT #endif +#ifdef CONFIG_LS1043A +/* For LS1043 (ARMv8), ESBC image Address in Header is 64 bit */ +#define CONFIG_ESBC_ADDR_64BIT +#endif +#ifndef CONFIG_FIT_SIGNATURE #define CONFIG_EXTRA_ENV \
include/configs/C29XPCIE.h +4 -0
@@ -567,4 +567,8 @@#include <asm/fsl_secure_boot.h> +#ifdef CONFIG_SECURE_BOOT +#define CONFIG_CMD_BLOB +#endif +#endif /* __CONFIG_H */
include/configs/T102xQDS.h +11 -1
@@ -39,6 +39,8 @@#define CONFIG_BOARD_EARLY_INIT_F #endif +#define CONFIG_FSL_CAAM /* Enable SEC/CAAM */ +#ifdef CONFIG_RAMBOOT_PBL #define CONFIG_SYS_FSL_PBL_PBI board/freescale/t102xqds/t1024_pbi.cfg#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t102xqds/t1024_rcw.cfg
@@ -936,8 +938,16 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT +/* Hash command with SHA acceleration supported in hardware */ +#ifdef CONFIG_FSL_CAAM +#define CONFIG_CMD_HASH +#define CONFIG_SHA_HW_ACCEL +#endif +#include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT +#define CONFIG_CMD_BLOB #endif #endif /* __T1024QDS_H */
include/configs/T102xRDB.h +11 -1
@@ -33,6 +33,8 @@#define CONFIG_FSL_LAW /* Use common FSL init code */ #define CONFIG_ENV_OVERWRITE +#define CONFIG_FSL_CAAM /* Enable SEC/CAAM */ +/* support deep sleep */ #ifdef CONFIG_PPC_T1024 #define CONFIG_DEEP_SLEEP
@@ -948,8 +950,16 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT +/* Hash command with SHA acceleration supported in hardware */ +#ifdef CONFIG_FSL_CAAM +#define CONFIG_CMD_HASH +#define CONFIG_SHA_HW_ACCEL +#endif +#include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT +#define CONFIG_CMD_BLOB #endif #endif /* __T1024RDB_H */
include/configs/T1040QDS.h +2 -1
@@ -835,8 +835,9 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT #include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB #endif
include/configs/T104xRDB.h +2 -1
@@ -938,8 +938,9 @@ $(SRCTREE)/board/freescale/t104xrdb/t1042d4_rcw.cfg#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT #include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB #endif
include/configs/T208xQDS.h +2 -1
@@ -933,8 +933,9 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT #include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB #undef CONFIG_CMD_USB#endif
include/configs/T208xRDB.h +2 -1
@@ -889,8 +889,9 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT #include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB #undef CONFIG_CMD_USB#endif
include/configs/ls1021aqds.h +4 -1
@@ -660,12 +660,15 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_MISC_INIT_R /* Hash command with SHA acceleration supported in hardware */ +#ifdef CONFIG_FSL_CAAM #define CONFIG_CMD_HASH #define CONFIG_SHA_HW_ACCEL +#endif + +#include <asm/fsl_secure_boot.h> #ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB -#include <asm/fsl_secure_boot.h> #endif #endif
include/configs/ls1021atwr.h +4 -1
@@ -516,12 +516,15 @@#define CONFIG_MISC_INIT_R /* Hash command with SHA acceleration supported in hardware */ +#ifdef CONFIG_FSL_CAAM #define CONFIG_CMD_HASH #define CONFIG_SHA_HW_ACCEL +#endif + +#include <asm/fsl_secure_boot.h> #ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB -#include <asm/fsl_secure_boot.h> #endif #endif
include/configs/ls1043a_common.h +8 -0
@@ -197,6 +197,8 @@#define CONFIG_DOS_PARTITION #endif +#define CONFIG_FSL_CAAM /* Enable SEC/CAAM */ +/* FMan ucode */ #define CONFIG_SYS_DPAA_FMAN #ifdef CONFIG_SYS_DPAA_FMAN
@@ -252,4 +254,10 @@#define CONFIG_SYS_BOOTM_LEN (64 << 20)/* Increase max gunzip size */ +/* Hash command with SHA acceleration supported in hardware */ +#ifdef CONFIG_FSL_CAAM +#define CONFIG_CMD_HASH +#define CONFIG_SHA_HW_ACCEL +#endif +#endif /* __LS1043A_COMMON_H */
include/configs/ls1043aqds.h +2 -0
@@ -401,4 +401,6 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_CMD_MII #define CONFIG_CMDLINE_TAG +#include <asm/fsl_secure_boot.h> +#endif /* __LS1043AQDS_H__ */
include/configs/ls1043ardb.h +0 -8
@@ -291,14 +291,6 @@#define CONFIG_CMD_EXT2 #endif -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_HASH -#define CONFIG_SHA_HW_ACCEL -#define CONFIG_CMD_BLOB -/* For LS1043 (ARMv8), ESBC image Address in Header is 64 bit */ -#define CONFIG_ESBC_ADDR_64BIT -#endif -#include <asm/fsl_secure_boot.h> #endif /* __LS1043ARDB_H__ */
Signature · 1 line
1.8.1.4
PATCH v3 1/7 include/configs: make secure boot header file include uniform
Quoted 287 lines
-----Original Message-----
From: Aneesh Bansal [mailto:aneesh.bansal at nxp.com]
Sent: Friday, January 22, 2016 4:37 PM
To: u-boot at lists.denx.de
Cc: york sun <[email protected]>; Ruchika Gupta <[email protected]>; Prabhakar Kushwaha <[email protected]>; Aneesh Bansal <[email protected]>
Subject: [PATCH v3 1/7]include/configs: make secure boot header file include uniformThe file
fsl_secure_boot.hmust be included in config file for Secure Boot. This is not required to be protected by any macro.CONFIG_FSL_CAAMmust be defined andCONFIG_CMD_HASHshould be turned on.
The above was missing in some config files and all files have been made uniform in this respect.Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
NoneChanges in v2:
None (Changed the Sign-Off with New E-Mail ID)arch/arm/include/asm/fsl_secure_boot.h | 5 +++++ include/configs/C29XPCIE.h | 4 ++++ include/configs/T102xQDS.h | 12 +++++++++++- include/configs/T102xRDB.h | 12 +++++++++++- include/configs/T1040QDS.h | 3 ++- include/configs/T104xRDB.h | 3 ++- include/configs/T208xQDS.h | 3 ++- include/configs/T208xRDB.h | 3 ++- include/configs/ls1021aqds.h | 5 ++++- include/configs/ls1021atwr.h | 5 ++++- include/configs/ls1043a_common.h | 8 ++++++++ include/configs/ls1043aqds.h | 2 ++ include/configs/ls1043ardb.h | 8 -------- 13 files changed, 57 insertions(+), 16 deletions(-)arch/arm/include/asm/fsl_secure_boot.h +4
-0@@ -34,6 +34,11 @@#define CONFIG_FSL_ISBC_KEY_EXT #endif +#ifdef CONFIG_LS1043A +/* For LS1043 (ARMv8), ESBC image Address in Header is 64 bit */ +#define CONFIG_ESBC_ADDR_64BIT #endif +#ifndef CONFIG_FIT_SIGNATURE #define CONFIG_EXTRA_ENV \include/configs/C29XPCIE.h index renamed from include/configs/C29XPCIE.h +0
-016920c6..890dcbb 100644
include/configs/C29XPCIE.h +4
-0@@ -567,4 +567,8 @@#include <asm/fsl_secure_boot.h> +#ifdef CONFIG_SECURE_BOOT +#define CONFIG_CMD_BLOB +#endif +#endif /* __CONFIG_H */ include/configs/T102xQDS.h index renamed from include/configs/T102xQDS.h +0
-0951cbc4..fb41a7d 100644
include/configs/T102xQDS.h +2
-0@@ -39,6 +39,8 @@#define CONFIG_BOARD_EARLY_INIT_F #endif +#define CONFIG_FSL_CAAM /* Enable SEC/CAAM */ +#ifdef CONFIG_RAMBOOT_PBL #define CONFIG_SYS_FSL_PBL_PBI board/freescale/t102xqds/t1024_pbi.cfg#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t102xqds/t1024_rcw.cfg
include/configs/T102xQDS.h +2
-1@@ -936,8 +938,16 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT +/* Hash command with SHA acceleration supported in hardware */ #ifdef +CONFIG_FSL_CAAM #define CONFIG_CMD_HASH #define
CONFIG_SHA_HW_ACCELinclude/configs/T102xQDS.h +5
-0+#endif +#include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT +#define CONFIG_CMD_BLOB #endif #endif /* __T1024QDS_H */ include/configs/T102xRDB.h index renamed from include/configs/T102xRDB.h +0
-04a0f5b2..113df37 100644
include/configs/T102xRDB.h +2
-0@@ -33,6 +33,8 @@#define CONFIG_FSL_LAW /* Use common FSL init code */ #define CONFIG_ENV_OVERWRITE +#define CONFIG_FSL_CAAM /* Enable SEC/CAAM */ +/* support deep sleep */ #ifdef CONFIG_PPC_T1024 #define
CONFIG_DEEP_SLEEPinclude/configs/T102xRDB.h +2
-1@@ -948,8 +950,16 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT +/* Hash command with SHA acceleration supported in hardware */ #ifdef +CONFIG_FSL_CAAM #define CONFIG_CMD_HASH #define
CONFIG_SHA_HW_ACCELinclude/configs/T102xRDB.h +5
-0+#endif +#include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT +#define CONFIG_CMD_BLOB #endif #endif /* __T1024RDB_H */ include/configs/T1040QDS.h index renamed from include/configs/T1040QDS.h +0
-09e151da..5fd93a1 100644
include/configs/T1040QDS.h +2
-1@@ -835,8 +835,9 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT #include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB #endif include/configs/T104xRDB.h index renamed from include/configs/T104xRDB.h +0
-0da65f56..eec2971 100644
include/configs/T104xRDB.h +0
-0@@ -938,8 +938,9 @@$(SRCTREE)/board/freescale/t104xrdb/t1042d4_rcw.cfg
#define
CONFIG_BOOTCOMMANDCONFIG_LINUXinclude/configs/T104xRDB.h +2
-1-#ifdef CONFIG_SECURE_BOOT #include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB #endif include/configs/T208xQDS.h index renamed from include/configs/T208xQDS.h +0
-0a0cecc6..019878a 100644
include/configs/T208xQDS.h +2
-1@@ -933,8 +933,9 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT #include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB #undef CONFIG_CMD_USB#endif include/configs/T208xRDB.h index renamed from include/configs/T208xRDB.h +0
-0312b0eb..3665b7d 100644
include/configs/T208xRDB.h +2
-1@@ -889,8 +889,9 @@ unsigned long get_board_ddr_clk(void);#define CONFIG_BOOTCOMMAND CONFIG_LINUX -#ifdef CONFIG_SECURE_BOOT #include <asm/fsl_secure_boot.h> + +#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB #undef CONFIG_CMD_USB#endif include/configs/ls1021aqds.h +0
-0@@ -660,12 +660,15 @@ unsigned long get_board_ddr_clk(void); #define
CONFIG_MISC_INIT_R/* Hash command with SHA acceleration supported in hardware */
include/configs/ls1021aqds.h +4
-1+#ifdef CONFIG_FSL_CAAM #define CONFIG_CMD_HASH #define CONFIG_SHA_HW_ACCEL +#endif + +#include <asm/fsl_secure_boot.h> #ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB -#include <asm/fsl_secure_boot.h> #endif #endif include/configs/ls1021atwr.h +4
-1@@ -516,12 +516,15 @@#define CONFIG_MISC_INIT_R /* Hash command with SHA acceleration supported in hardware */ +#ifdef CONFIG_FSL_CAAM #define CONFIG_CMD_HASH #define CONFIG_SHA_HW_ACCEL +#endif + +#include <asm/fsl_secure_boot.h> #ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_BLOB -#include <asm/fsl_secure_boot.h> #endif #endif include/configs/ls1043a_common.h +4
-0@@ -197,6 +197,8 @@#define CONFIG_DOS_PARTITION #endif +#define CONFIG_FSL_CAAM /* Enable SEC/CAAM */ +/* FMan ucode */ #define CONFIG_SYS_DPAA_FMAN #ifdef CONFIG_SYS_DPAA_FMAN @@ -252,4 +254,10 @@#define CONFIG_SYS_BOOTM_LEN (64 << 20)/* Increase max gunzip size */ +/* Hash command with SHA acceleration supported in hardware */ #ifdef +CONFIG_FSL_CAAM #define CONFIG_CMD_HASH #define
CONFIG_SHA_HW_ACCELinclude/configs/ls1043a_common.h +2
-0+#endif +#endif /* __LS1043A_COMMON_H */ include/configs/ls1043aqds.h +0
-0@@ -401,4 +401,6 @@ unsigned long get_board_ddr_clk(void); #define
CONFIG_CMD_MII#defineCONFIG_CMDLINE_TAGinclude/configs/ls1043aqds.h +2
-0+#include <asm/fsl_secure_boot.h> +#endif /* __LS1043AQDS_H__ */ include/configs/ls1043ardb.h +0
-5@@ -291,14 +291,6 @@#define CONFIG_CMD_EXT2 #endif -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_HASH -#define CONFIG_SHA_HW_ACCEL -#define CONFIG_CMD_BLOB -/* For LS1043 (ARMv8), ESBC image Address in Header is 64 bit */ -#define
CONFIG_ESBC_ADDR_64BIT-#endif
-
#include <asm/fsl_secure_boot.h>
Quoted 3 lines
#endif /*
__LS1043ARDB_H__*/
--
1.8.1.4
PATCH v3 1/7 include/configs: make secure boot header file include uniform
In reply to Aneesh BansalQuoted 16 lines · Aneesh Bansal
The file
fsl_secure_boot.hmust be included in config file for Secure Boot. This is not required to be protected by any macro.CONFIG_FSL_CAAMmust be defined andCONFIG_CMD_HASHshould be turned on.
The above was missing in some config files and all files have been made uniform in this respect.Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
NoneChanges in v2:
None (Changed the Sign-Off with New E-Mail ID)
Quoted 15 lines
arch/arm/include/asm/fsl_secure_boot.h | 5 +++++ include/configs/C29XPCIE.h | 4 ++++ include/configs/T102xQDS.h | 12 +++++++++++- include/configs/T102xRDB.h | 12 +++++++++++- include/configs/T1040QDS.h | 3 ++- include/configs/T104xRDB.h | 3 ++- include/configs/T208xQDS.h | 3 ++- include/configs/T208xRDB.h | 3 ++- include/configs/ls1021aqds.h | 5 ++++- include/configs/ls1021atwr.h | 5 ++++- include/configs/ls1043a_common.h | 8 ++++++++ include/configs/ls1043aqds.h | 2 ++ include/configs/ls1043ardb.h | 8 -------- 13 files changed, 57 insertions(+), 16 deletions(-)
Prefix subject with "secure_boot:". Slightly reformat commit message. Applied to u-boot-fsl-qoriq master. Awaiting upstream.
Thanks.
York
PATCH v3 2/7 include/configs: move definition of CONFIG_CMD_BLOB
In reply to Aneesh BansalCONFIG_CMD_BLOB must be defined in case of Secure Boot. It was earlier defined in all config files. The definition has been moved to a common file which is included by all configs.
---
Changes in v3:
None
Changes in v2:
None (Changed the Sign-Off with New E-Mail ID)
arch/arm/include/asm/fsl_secure_boot.h | 1 + arch/powerpc/include/asm/fsl_secure_boot.h | 1 + include/configs/B4860QDS.h | 4 ---- include/configs/BSC9132QDS.h | 4 ---- include/configs/C29XPCIE.h | 4 ---- include/configs/P1010RDB.h | 4 ---- include/configs/P2041RDB.h | 4 ---- include/configs/T102xQDS.h | 4 ---- include/configs/T102xRDB.h | 4 ---- include/configs/T1040QDS.h | 4 ---- include/configs/T104xRDB.h | 4 ---- include/configs/T208xQDS.h | 5 ----- include/configs/T208xRDB.h | 5 ----- include/configs/T4240QDS.h | 4 ---- include/configs/T4240RDB.h | 9 --------- include/configs/corenet_ds.h | 4 ---- include/configs/ls1021aqds.h | 4 ---- include/configs/ls1021atwr.h | 4 ---- 18 files changed, 2 insertions(+), 71 deletions(-)
arch/arm/include/asm/fsl_secure_boot.h +1 -0
@@ -9,6 +9,7 @@#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_ESBC_VALIDATE +#define CONFIG_CMD_BLOB #define CONFIG_FSL_SEC_MON #define CONFIG_SHA_PROG_HW_ACCEL #define CONFIG_RSA
arch/powerpc/include/asm/fsl_secure_boot.h +1 -0
@@ -10,6 +10,7 @@#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_ESBC_VALIDATE +#define CONFIG_CMD_BLOB #define CONFIG_FSL_SEC_MON #define CONFIG_SHA_PROG_HW_ACCEL #define CONFIG_DM
include/configs/B4860QDS.h +0 -4
@@ -924,8 +924,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/BSC9132QDS.h +0 -4
@@ -722,8 +722,4 @@ combinations. this should be removed later#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/C29XPCIE.h +0 -4
@@ -567,8 +567,4 @@#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/P1010RDB.h +0 -4
@@ -952,8 +952,4 @@ extern unsigned long get_sdram_size(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/P2041RDB.h +0 -4
@@ -756,8 +756,4 @@ unsigned long get_board_sys_clk(unsigned long dummy);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/T102xQDS.h +0 -4
@@ -946,8 +946,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __T1024QDS_H */
include/configs/T102xRDB.h +0 -4
@@ -958,8 +958,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __T1024RDB_H */
include/configs/T1040QDS.h +0 -4
@@ -837,8 +837,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/T104xRDB.h +0 -4
@@ -940,8 +940,4 @@ $(SRCTREE)/board/freescale/t104xrdb/t1042d4_rcw.cfg#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/T208xQDS.h +0 -5
@@ -935,9 +935,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#undef CONFIG_CMD_USB -#endif -#endif /* __T208xQDS_H */
include/configs/T208xRDB.h +0 -5
@@ -891,9 +891,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#undef CONFIG_CMD_USB -#endif -#endif /* __T2080RDB_H */
include/configs/T4240QDS.h +0 -4
@@ -644,8 +644,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/T4240RDB.h +0 -9
@@ -837,13 +837,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -/* Secure Boot target was not getting build for T4240 because of -* increased binary size. So the size is being reduced by removing USB -* which is anyways not used in Secure Environment. -*/ -#undef CONFIG_CMD_USB -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/corenet_ds.h +0 -4
@@ -765,8 +765,4 @@#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */
include/configs/ls1021aqds.h +0 -4
@@ -667,8 +667,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif
include/configs/ls1021atwr.h +0 -4
@@ -523,8 +523,4 @@#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif
Signature · 1 line
1.8.1.4
PATCH v3 2/7 include/configs: move definition of CONFIG_CMD_BLOB
Quoted 289 lines
-----Original Message-----
From: Aneesh Bansal [mailto:aneesh.bansal at nxp.com]
Sent: Friday, January 22, 2016 4:37 PM
To: u-boot at lists.denx.de
Cc: york sun <[email protected]>; Ruchika Gupta <[email protected]>; Prabhakar Kushwaha <[email protected]>; Aneesh Bansal <[email protected]>
Subject: [PATCH v3 2/7]include/configs: move definition ofCONFIG_CMD_BLOB
CONFIG_CMD_BLOBmust be defined in case of Secure Boot.
It was earlier defined in all config files. The definition has been moved to a common file which is included by all configs.Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
NoneChanges in v2:
None (Changed the Sign-Off with New E-Mail ID)arch/arm/include/asm/fsl_secure_boot.h | 1 + arch/powerpc/include/asm/fsl_secure_boot.h | 1 + include/configs/B4860QDS.h | 4 ---- include/configs/BSC9132QDS.h | 4 ---- include/configs/C29XPCIE.h | 4 ---- include/configs/P1010RDB.h | 4 ---- include/configs/P2041RDB.h | 4 ---- include/configs/T102xQDS.h | 4 ---- include/configs/T102xRDB.h | 4 ---- include/configs/T1040QDS.h | 4 ---- include/configs/T104xRDB.h | 4 ---- include/configs/T208xQDS.h | 5 ----- include/configs/T208xRDB.h | 5 ----- include/configs/T4240QDS.h | 4 ---- include/configs/T4240RDB.h | 9 --------- include/configs/corenet_ds.h | 4 ---- include/configs/ls1021aqds.h | 4 ---- include/configs/ls1021atwr.h | 4 ---- 18 files changed, 2 insertions(+), 71 deletions(-)arch/arm/include/asm/fsl_secure_boot.h +1
-0@@ -9,6 +9,7 @@#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_ESBC_VALIDATE +#define CONFIG_CMD_BLOB #define CONFIG_FSL_SEC_MON #define CONFIG_SHA_PROG_HW_ACCEL #define CONFIG_RSA arch/powerpc/include/asm/fsl_secure_boot.h +1
-0@@ -10,6 +10,7 @@#ifdef CONFIG_SECURE_BOOT #define CONFIG_CMD_ESBC_VALIDATE +#define CONFIG_CMD_BLOB #define CONFIG_FSL_SEC_MON #define CONFIG_SHA_PROG_HW_ACCEL #define CONFIG_DM include/configs/B4860QDS.h index renamed from include/configs/B4860QDS.h +0
-09fb5cee..bcbae50 100644
include/configs/B4860QDS.h +0
-4@@ -924,8 +924,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */ include/configs/BSC9132QDS.h +0
-4@@ -722,8 +722,4 @@ combinations. this should be removed later#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */ include/configs/C29XPCIE.h index renamed from include/configs/C29XPCIE.h +0
-0890dcbb..16920c6 100644
include/configs/C29XPCIE.h +0
-4@@ -567,8 +567,4 @@#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */ include/configs/P1010RDB.h index renamed from include/configs/P1010RDB.h +0
-0f9776c0..3c0faca 100644
include/configs/P1010RDB.h +0
-4@@ -952,8 +952,4 @@ extern unsigned long get_sdram_size(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */ include/configs/P2041RDB.h index renamed from include/configs/P2041RDB.h +0
-0b2e51b5..f250e7f 100644
include/configs/P2041RDB.h +0
-4@@ -756,8 +756,4 @@ unsigned long get_board_sys_clk(unsigned long dummy);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /*
__CONFIG_H*/include/configs/T102xQDS.h index renamed from include/configs/T102xQDS.h +0
-0fb41a7d..e5df784 100644
include/configs/T102xQDS.h +0
-4@@ -946,8 +946,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __T1024QDS_H */ include/configs/T102xRDB.h index renamed from include/configs/T102xRDB.h +0
-0113df37..3cda3b1 100644
include/configs/T102xRDB.h +0
-4@@ -958,8 +958,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __T1024RDB_H */ include/configs/T1040QDS.h index renamed from include/configs/T1040QDS.h +0
-05fd93a1..2e7892f 100644
include/configs/T1040QDS.h +0
-4@@ -837,8 +837,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */ include/configs/T104xRDB.h index renamed from include/configs/T104xRDB.h +0
-0eec2971..5fc3497 100644
include/configs/T104xRDB.h +0
-0@@ -940,8 +940,4 @@$(SRCTREE)/board/freescale/t104xrdb/t1042d4_rcw.cfg
#include <
asm/fsl_secure_boot.h>include/configs/T104xRDB.h +0
-4-#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */ include/configs/T208xQDS.h index renamed from include/configs/T208xQDS.h +0
-0019878a..a56208c 100644
include/configs/T208xQDS.h +0
-5@@ -935,9 +935,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#undef CONFIG_CMD_USB -#endif -#endif /* __T208xQDS_H */ include/configs/T208xRDB.h index renamed from include/configs/T208xRDB.h +0
-03665b7d..b5290a1 100644
include/configs/T208xRDB.h +0
-5@@ -891,9 +891,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#undef CONFIG_CMD_USB -#endif -#endif /* __T2080RDB_H */ include/configs/T4240QDS.h index renamed from include/configs/T4240QDS.h +0
-01b94f64..91857d6 100644
include/configs/T4240QDS.h +0
-4@@ -644,8 +644,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */ include/configs/T4240RDB.h index renamed from include/configs/T4240RDB.h +0
-073279c8..eb4d52c 100644
include/configs/T4240RDB.h +0
-9@@ -837,13 +837,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -/* Secure Boot target was not getting build for T4240 because of -* increased binary size. So the size is being reduced by removing USB -* which is anyways not used in Secure Environment. -*/ -#undef CONFIG_CMD_USB -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */ include/configs/corenet_ds.h +0
-4@@ -765,8 +765,4 @@#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif /* __CONFIG_H */ include/configs/ls1021aqds.h +0
-4@@ -667,8 +667,4 @@ unsigned long get_board_ddr_clk(void);#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif include/configs/ls1021atwr.h +0
-5@@ -523,8 +523,4 @@#include <asm/fsl_secure_boot.h> -#ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_BLOB -#endif -#endif --
Quoted 1 line
1.8.1.4
PATCH v3 2/7 include/configs: move definition of CONFIG_CMD_BLOB
In reply to Aneesh BansalQuoted 23 lines · Aneesh Bansal
CONFIG_CMD_BLOBmust be defined in case of Secure Boot. It was earlier defined in all config files. The definition has been moved to a common file which is included by all configs.Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
NoneChanges in v2:
None (Changed the Sign-Off with New E-Mail ID)arch/arm/include/asm/fsl_secure_boot.h | 1 + arch/powerpc/include/asm/fsl_secure_boot.h | 1 + include/configs/B4860QDS.h | 4 ---- include/configs/BSC9132QDS.h | 4 ---- include/configs/C29XPCIE.h | 4 ---- include/configs/P1010RDB.h | 4 ---- include/configs/P2041RDB.h | 4 ---- include/configs/T102xQDS.h | 4 ---- include/configs/T102xRDB.h | 4 ---- include/configs/T1040QDS.h | 4 ---- include/configs/T104xRDB.h | 4 ----
Quoted 8 lines
include/configs/T208xQDS.h | 5 ----- include/configs/T208xRDB.h | 5 ----- include/configs/T4240QDS.h | 4 ---- include/configs/T4240RDB.h | 9 --------- include/configs/corenet_ds.h | 4 ---- include/configs/ls1021aqds.h | 4 ---- include/configs/ls1021atwr.h | 4 ---- 18 files changed, 2 insertions(+), 71 deletions(-)
Prefix subject with "secure_boot:". Slightly reformat commit message. Applied to u-boot-fsl-qoriq master. Awaiting upstream.
Thanks.
York
PATCH v3 3/7 SECURE_BOOT: split the secure boot functionality in two parts
In reply to Aneesh BansalThere are two phases in Secure Boot
1. ISBC: In BootROM, validate the BootLoader (U-Boot).
2. ESBC: In U-Boot, continuing the Chain of Trust by validating and booting LINUX.
For ESBC phase, there is no difference in SoC's based on ARM or PowerPC cores.
But the exit conditions after ISBC phase i.e. entry conditions for U-Boot are different for ARM and PowerPC.
PowerPC:
========
If Secure Boot is executed, a separate U-Boot target is required which must be compiled with a diffrent Text Base as compared to Non-Secure Boot. There are some LAW and TLB settings which are required specifically for Secure Boot scenario.
ARM:
====
ARM based SoC's have a fixed memory map and exit conditions from BootROM are same irrespective of boot mode (Secure or Non-Secure).
Thus the current Secure Boot functionlity has been split into two parts:
CONFIG_CHAIN_OF_TRUST
========================
This will have the following functionality as part of U-Boot:
1. Enable commands like esbc_validate, esbc_halt
2. Change the environment settings based on bootmode (determined at run time):
- If bootmode is non-secure, no change
- If bootmode is secure, set the following:
- bootdelay = 0 (Don't give boot prompt)
- bootcmd = Validate and execute the bootscript.
CONFIG_SECURE_BOOT
=====================
This is defined only for creating a different compile time target for secure boot.
Traditionally, both these functionalities were defined under CONFIG_SECURE_BOOT This patch is aimed at removing the requirement for a separate Secure Boot target for ARM based SoC's. CONFIG_CHAIN_OF_TRUST will be defined and boot mode will be determine at run time.
Another Security Requirement for running CHAIN_OF_TRUST is that U-Boot environemnt must not be picked from flash/external memory. This cannot be done based on bootmode at run time in current U-Boot architecture. Once this dependency is resolved, no separate SECURE_BOOT target will be required for ARM based SoC's.
Currently, the only code under CONFIG_SECURE_BOOT for ARM SoC's is defining CONFIG_ENV_IS_NOWHERE
---
Changes in v3:
None
Changes in v2:CONFIG_ENV_IS_NOWHERE is defined for Secure Boot
arch/arm/include/asm/fsl_secure_boot.h | 16 ++-- arch/powerpc/include/asm/fsl_secure_boot.h | 41 +++++----- include/config_fsl_chain_trust.h | 101 +++++++++++++++++++++++++ include/config_fsl_secboot.h | 116 ----------------------------- 4 files changed, 135 insertions(+), 139 deletions(-) create mode 100644 include/config_fsl_chain_trust.h delete mode 100644 include/config_fsl_secboot.h
arch/arm/include/asm/fsl_secure_boot.h +10 -6
@@ -8,6 +8,14 @@#define __FSL_SECURE_BOOT_H#ifdef CONFIG_SECURE_BOOT + +#ifndef CONFIG_FIT_SIGNATURE +#define CONFIG_CHAIN_OF_TRUST +#endif + +#endif + +#ifdef CONFIG_CHAIN_OF_TRUST #define CONFIG_CMD_ESBC_VALIDATE #define CONFIG_CMD_BLOB #define CONFIG_FSL_SEC_MON
@@ -40,8 +48,6 @@#define CONFIG_ESBC_ADDR_64BIT #endif -#ifndef CONFIG_FIT_SIGNATURE -#define CONFIG_EXTRA_ENV \ "setenv fdt_high 0xcfffffff;" \ "setenv initrd_high 0xcfffffff;" \
@@ -50,8 +56,6 @@/* The address needs to be modified according to NOR memory map */ #define CONFIG_BOOTSCRIPT_HDR_ADDR 0x600a0000 -#include <config_fsl_secboot.h> -#endif -#endif - +#include <config_fsl_chain_trust.h> +#endif /* #ifdef CONFIG_CHAIN_OF_TRUST */ #endif
arch/powerpc/include/asm/fsl_secure_boot.h +24 -17
61 lines not on this page · raw message
include/config_fsl_chain_trust.h new file +101 -0
101 lines not on this page · raw message
include/config_fsl_secboot.h deleted +0 -116
116 lines not on this page · raw message
Signature · 1 line
1.8.1.4
PATCH v3 3/7 SECURE_BOOT: split the secure boot functionality in two parts
Quoted 430 lines
-----Original Message-----
From: Aneesh Bansal [mailto:aneesh.bansal at nxp.com]
Sent: Friday, January 22, 2016 4:37 PM
To: u-boot at lists.denx.de
Cc: york sun <[email protected]>; Ruchika Gupta <[email protected]>; Prabhakar Kushwaha <[email protected]>; Aneesh Bansal <[email protected]>
Subject: [PATCH v3 3/7]SECURE_BOOT: split the secure boot functionality in two partsThere are two phases in Secure Boot
1. ISBC: In BootROM, validate the BootLoader (U-Boot).
2. ESBC: In U-Boot, continuing the Chain of Trust by validating and booting LINUX.For ESBC phase, there is no difference in SoC's based on ARM or PowerPC cores.
But the exit conditions after ISBC phase i.e. entry conditions for U-Boot are different for ARM and PowerPC.
PowerPC:
========
If Secure Boot is executed, a separate U-Boot target is required which must be compiled with a diffrent Text Base as compared to Non-Secure Boot. There are some LAW and TLB settings which are required specifically for Secure Boot scenario.ARM:
====
ARM based SoC's have a fixed memory map and exit conditions from BootROM are same irrespective of boot mode (Secure or Non-Secure).Thus the current Secure Boot functionlity has been split into two parts:
CONFIG_CHAIN_OF_TRUST
========================
This will have the following functionality as part of U-Boot:
1. Enable commands likeesbc_validate,esbc_halt2. Change the environment settings based on bootmode (determined at run time):
- If bootmode is non-secure, no change
- If bootmode is secure, set the following:
- bootdelay = 0 (Don't give boot prompt)
- bootcmd = Validate and execute the bootscript.
CONFIG_SECURE_BOOT
=====================
This is defined only for creating a different compile time target for secure boot.Traditionally, both these functionalities were defined under
CONFIG_SECURE_BOOTThis patch is aimed at removing the requirement for a separate Secure Boot target for ARM based SoC's.CONFIG_CHAIN_OF_TRUSTwill be defined and boot mode will be determine at run time.Another Security Requirement for running
CHAIN_OF_TRUSTis that U-Boot environemnt must not be picked from flash/external memory. This cannot be done based on bootmode at run time in current U-Boot architecture. Once this dependency is resolved, no separateSECURE_BOOTtarget will be required for ARM based SoC's.Currently, the only code under
CONFIG_SECURE_BOOTfor ARM SoC's is definingCONFIG_ENV_IS_NOWHERESigned-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
NoneChanges in v2:
CONFIG_ENV_IS_NOWHEREis defined for Secure Bootarch/arm/include/asm/fsl_secure_boot.h | 16 ++-- arch/powerpc/include/asm/fsl_secure_boot.h | 41 +++++----- include/config_fsl_chain_trust.h | 101 +++++++++++++++++++++++++ include/config_fsl_secboot.h | 116 ----------------------------- 4 files changed, 135 insertions(+), 139 deletions(-) create mode 100644
include/config_fsl_chain_trust.hdelete mode 100644include/config_fsl_secboot.harch/arm/include/asm/fsl_secure_boot.h +10
-6@@ -8,6 +8,14 @@#define __FSL_SECURE_BOOT_H#ifdef CONFIG_SECURE_BOOT + +#ifndef CONFIG_FIT_SIGNATURE +#define CONFIG_CHAIN_OF_TRUST +#endif + +#endif + +#ifdef CONFIG_CHAIN_OF_TRUST #define CONFIG_CMD_ESBC_VALIDATE #define CONFIG_CMD_BLOB #define CONFIG_FSL_SEC_MON @@ -40,8 +48,6 @@#define CONFIG_ESBC_ADDR_64BIT #endif -#ifndef CONFIG_FIT_SIGNATURE -#define CONFIG_EXTRA_ENV \ "setenv fdt_high 0xcfffffff;" \ "setenv initrd_high 0xcfffffff;" \@@ -50,8 +56,6 @@/* The address needs to be modified according to NOR memory map */ #define CONFIG_BOOTSCRIPT_HDR_ADDR 0x600a0000 -#include <config_fsl_secboot.h> -#endif -#endif - +#include <config_fsl_chain_trust.h> +#endif /* #ifdef CONFIG_CHAIN_OF_TRUST */ #endif arch/powerpc/include/asm/fsl_secure_boot.h +21
-12@@ -9,19 +9,11 @@#include <asm/config_mpc85xx.h> #ifdef CONFIG_SECURE_BOOT -#define CONFIG_CMD_ESBC_VALIDATE -#define CONFIG_CMD_BLOB -#define CONFIG_FSL_SEC_MON -#define CONFIG_SHA_PROG_HW_ACCEL -#define CONFIG_DM -#define CONFIG_RSA -#define CONFIG_RSA_FREESCALE_EXP -#ifndef CONFIG_FSL_CAAM -#define CONFIG_FSL_CAAM -#endif + +#ifndef CONFIG_FIT_SIGNATURE +#define CONFIG_CHAIN_OF_TRUST #endif -#ifdef CONFIG_SECURE_BOOT #if defined(CONFIG_FSL_CORENET )#define CONFIG_SYS_PBI_FLASH_BASE 0xc0000000#elif defined(CONFIG_BSC9132QDS )@@ -76,8 +68,25 @@*/ #define CONFIG_FSL_ISBC_KEY_EXT #endif +#endif /* #ifdef CONFIG_SECURE_BOOT */ + +#ifdef CONFIG_CHAIN_OF_TRUST + +#define CONFIG_CMD_ESBC_VALIDATE +#define CONFIG_CMD_BLOB +#define CONFIG_FSL_SEC_MON +#define CONFIG_SHA_PROG_HW_ACCEL +#define CONFIG_RSA +#define CONFIG_RSA_FREESCALE_EXP + +#ifndef CONFIG_DM +#define CONFIG_DM +#endif + +#ifndef CONFIG_FSL_CAAM +#define CONFIG_FSL_CAAM +#endif -#ifndef CONFIG_FIT_SIGNATURE /* If Boot Script is not on NOR and is required to be copied on RAM */ #ifdef
CONFIG_BOOTSCRIPT_COPY_RAM
#defineCONFIG_BS_HDR_ADDR_RAM0x00010000arch/powerpc/include/asm/fsl_secure_boot.h +3
-5@@ -105,10 +114,8 @@#define CONFIG_BOOTSCRIPT_HDR_ADDR 0xee020000#endif -#endif - -#include <config_fsl_secboot.h> -#endif +#endif /* #ifdef CONFIG_BOOTSCRIPT_COPY_RAM */ -#endif +#include <config_fsl_chain_trust.h> +#endif /* #ifdef CONFIG_CHAIN_OF_TRUST */ #endif include/config_fsl_chain_trust.h new file +45
-0@@ -0,0 +1,101 @@ +/* +* Copyright 2015 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_FSL_CHAIN_TRUST_H +#define __CONFIG_FSL_CHAIN_TRUST_H + +/* For secure boot, since ENVIRONMENT in flash/external memories is +* not verified, undef CONFIG_ENV_xxx and set default env +* (CONFIG_ENV_IS_NOWHERE) +*/ +#ifdef CONFIG_SECURE_BOOT + +#undef CONFIG_ENV_IS_IN_EEPROM +#undef CONFIG_ENV_IS_IN_NAND +#undef CONFIG_ENV_IS_IN_MMC +#undef CONFIG_ENV_IS_IN_SPI_FLASH +#undef CONFIG_ENV_IS_IN_FLASH + +#define CONFIG_ENV_IS_NOWHERE + +#endif + +#ifdef CONFIG_CHAIN_OF_TRUST + +#ifndef CONFIG_EXTRA_ENV +#define CONFIG_EXTRA_ENV "" +#endif + +/* +* Control should not reach back to uboot after validation of images +* for secure boot flow and therefore bootscript should have +* the bootm command. If control reaches back to uboot anyhow +* after validating images, core should just spin. +*/ + +/* +* Define the key hash for boot script here if public/private key pair +used to +* sign bootscript are different from the SRK hash put in the fuse +* Example of defining KEY_HASH is +* #define CONFIG_BOOTSCRIPT_KEY_HASH \ +* "
41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b"
+ */include/config_fsl_chain_trust.h new file +4
-0+ +#ifdef CONFIG_BOOTSCRIPT_KEY_HASH +#define CONFIG_SECBOOT \ + "setenv bs_hdraddr "
__stringify(CONFIG_BOOTSCRIPT_HDR_ADDR)";" \include/config_fsl_chain_trust.h new file +10
-0+"setenv bootargs \'root=/dev/ram rw console=ttyS0,115200 " \ +"ramdisk_size=600000\';" \ +CONFIG_EXTRA_ENV \ +"esbc_validate $bs_hdraddr " \ + __stringify(CONFIG_BOOTSCRIPT_KEY_HASH)";" \ +"source $img_addr;" \ + "esbc_halt\0" +#else +#define CONFIG_SECBOOT \ + "setenv bs_hdraddr "
__stringify(CONFIG_BOOTSCRIPT_HDR_ADDR)";" \include/config_fsl_chain_trust.h new file +10
-0+"setenv bootargs \'root=/dev/ram rw console=ttyS0,115200 " \ +"ramdisk_size=600000\';" \ +CONFIG_EXTRA_ENV \ +"esbc_validate $bs_hdraddr;" \ +"source $img_addr;" \ + "esbc_halt\0" +#endif + +/* For secure boot flow, default environment used will be used */ #if +defined(CONFIG_SYS_RAMBOOT) #ifdef CONFIG_BOOTSCRIPT_COPY_RAM#define
include/config_fsl_chain_trust.h new file +3
-0+CONFIG_BS_COPY_ENV \ + "setenv bs_hdr_ram " __stringify(CONFIG_BS_HDR_ADDR_RAM)";" \ + "setenv bs_hdr_flash " __stringify(CONFIG_BS_HDR_ADDR_FLASH)";"\
include/config_fsl_chain_trust.h new file +28
-0+ "setenv bs_hdr_size " __stringify(CONFIG_BS_HDR_SIZE)";" \ +" setenv bs_ram" __stringify(CONFIG_BS_ADDR_RAM)" ;" \ +" setenv bs_flash" __stringify(CONFIG_BS_ADDR_FLASH)" ;" \ + "setenv bs_size " __stringify(CONFIG_BS_SIZE)";" + +#if defined(CONFIG_RAMBOOT_NAND ) +#define CONFIG_BS_COPY_CMD \ + "nand read $bs_hdr_ram $bs_hdr_flash $bs_hdr_size ;" \ + "nand read $bs_ram $bs_flash $bs_size ;" +#endif /* CONFIG_RAMBOOT_NAND */ +#endif /* CONFIG_BOOTSCRIPT_COPY_RAM */ + +#endif + +#ifndef CONFIG_BS_COPY_ENV +#define CONFIG_BS_COPY_ENV +#endif + +#ifndef CONFIG_BS_COPY_CMD +#define CONFIG_BS_COPY_CMD +#endif + +#define CONFIG_CHAIN_BOOT_CMD CONFIG_BS_COPY_ENV \ + CONFIG_BS_COPY_CMD \ + CONFIG_SECBOOT + +#endif +#endif include/config_fsl_secboot.h deleted +0
-32@@ -1,116 +0,0 @@ -/* -* Copyright 2015 Freescale Semiconductor, Inc. -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#ifndef __CONFIG_FSL_SECBOOT_H -#define __CONFIG_FSL_SECBOOT_H - -#ifdef CONFIG_SECURE_BOOT - -#ifndef CONFIG_CMD_ESBC_VALIDATE -#define CONFIG_CMD_ESBC_VALIDATE -#endif - -#ifndef CONFIG_EXTRA_ENV -#define CONFIG_EXTRA_ENV "" -#endif - -/* -* Control should not reach back to uboot after validation of images -* for secure boot flow and therefore bootscript should have -* the bootm command. If control reaches back to uboot anyhow -* after validating images, core should just spin. -*/ - -/* -* Define the key hash for boot script here if public/private key pair used to -* sign bootscript are different from the SRK hash put in the fuse -* Example of defining KEY_HASH is -* #define CONFIG_BOOTSCRIPT_KEY_HASH \ -* "
41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b"
- */include/config_fsl_secboot.h deleted +0
-4- -#ifdef CONFIG_BOOTSCRIPT_KEY_HASH -#define CONFIG_SECBOOT \ - "setenv bs_hdraddr "
__stringify(CONFIG_BOOTSCRIPT_HDR_ADDR)";" \include/config_fsl_secboot.h deleted +0
-10-"setenv bootargs \'root=/dev/ram rw console=ttyS0,115200 " \ -"ramdisk_size=600000\';" \ -CONFIG_EXTRA_ENV \ -"esbc_validate $bs_hdraddr " \ - __stringify(CONFIG_BOOTSCRIPT_KEY_HASH)";" \ -"source $img_addr;" \ - "esbc_halt\0" -#else -#define CONFIG_SECBOOT \ - "setenv bs_hdraddr "
__stringify(CONFIG_BOOTSCRIPT_HDR_ADDR)";" \include/config_fsl_secboot.h deleted +0
-9-"setenv bootargs \'root=/dev/ram rw console=ttyS0,115200 " \ -"ramdisk_size=600000\';" \ -CONFIG_EXTRA_ENV \ -"esbc_validate $bs_hdraddr;" \ -"source $img_addr;" \ - "esbc_halt\0" -#endif - -/* For secure boot flow, default environment used will be used */ -#if
defined(CONFIG_SYS_RAMBOOT)-#ifdefCONFIG_BOOTSCRIPT_COPY_RAM- #defineCONFIG_BS_COPY_ENV\include/config_fsl_secboot.h deleted +0
-2- "setenv bs_hdr_ram " __stringify(CONFIG_BS_HDR_ADDR_RAM)";" \ - "setenv bs_hdr_flash " __stringify(CONFIG_BS_HDR_ADDR_FLASH)";"\
include/config_fsl_secboot.h deleted +0
-56- "setenv bs_hdr_size " __stringify(CONFIG_BS_HDR_SIZE)";" \ -" setenv bs_ram" __stringify(CONFIG_BS_ADDR_RAM)" ;" \ -" setenv bs_flash" __stringify(CONFIG_BS_ADDR_FLASH)" ;" \ - "setenv bs_size " __stringify(CONFIG_BS_SIZE)";" - -#if defined(CONFIG_RAMBOOT_NAND ) -#define CONFIG_BS_COPY_CMD \ - "nand read $bs_hdr_ram $bs_hdr_flash $bs_hdr_size ;" \ - "nand read $bs_ram $bs_flash $bs_size ;" -#endif /* CONFIG_RAMBOOT_NAND */ -#endif /* CONFIG_BOOTSCRIPT_COPY_RAM */ - -#if defined(CONFIG_RAMBOOT_SPIFLASH ) -#undef CONFIG_ENV_IS_IN_SPI_FLASH -#elif defined(CONFIG_RAMBOOT_NAND ) -#undef CONFIG_ENV_IS_IN_NAND -#elif defined(CONFIG_RAMBOOT_SDCARD ) -#undef CONFIG_ENV_IS_IN_MMC -#endif -#else /*CONFIG_SYS_RAMBOOT*/ -#undef CONFIG_ENV_IS_IN_FLASH -#endif - -#define CONFIG_ENV_IS_NOWHERE - -#ifndef CONFIG_BS_COPY_ENV -#define CONFIG_BS_COPY_ENV -#endif - -#ifndef CONFIG_BS_COPY_CMD -#define CONFIG_BS_COPY_CMD -#endif - -#define CONFIG_SECBOOT_CMD CONFIG_BS_COPY_ENV \ - CONFIG_BS_COPY_CMD \ - CONFIG_SECBOOT -/* -* We don't want boot delay for secure boot flow -* before autoboot starts -*/ -#undef CONFIG_BOOTDELAY -#define CONFIG_BOOTDELAY 0 -#undef CONFIG_BOOTCOMMAND -#define CONFIG_BOOTCOMMAND CONFIG_SECBOOT_CMD - -/* -* CONFIG_ZERO_BOOTDELAY_CHECK should not be defined for -* secure boot flow as defining this would enable a user to -* reach uboot prompt by pressing some key before start of -* autoboot -*/ -#undef CONFIG_ZERO_BOOTDELAY_CHECK - -#endif -#endif --
Quoted 1 line
1.8.1.4
PATCH v3 3/7 SECURE_BOOT: split the secure boot functionality in two parts
In reply to Aneesh BansalQuoted 59 lines · Aneesh Bansal
There are two phases in Secure Boot
1. ISBC: In BootROM, validate the BootLoader (U-Boot).
2. ESBC: In U-Boot, continuing the Chain of Trust by validating and booting LINUX.For ESBC phase, there is no difference in SoC's based on ARM or PowerPC cores.
But the exit conditions after ISBC phase i.e. entry conditions for U-Boot are different for ARM and PowerPC.
PowerPC:
========
If Secure Boot is executed, a separate U-Boot target is required which must be compiled with a diffrent Text Base as compared to Non-Secure Boot. There are some LAW and TLB settings which are required specifically for Secure Boot scenario.ARM:
====
ARM based SoC's have a fixed memory map and exit conditions from BootROM are same irrespective of boot mode (Secure or Non-Secure).Thus the current Secure Boot functionlity has been split into two parts:
CONFIG_CHAIN_OF_TRUST
========================
This will have the following functionality as part of U-Boot:
1. Enable commands likeesbc_validate,esbc_halt
2. Change the environment settings based on bootmode (determined at run time):
- If bootmode is non-secure, no change
- If bootmode is secure, set the following:
- bootdelay = 0 (Don't give boot prompt)
- bootcmd = Validate and execute the bootscript.
CONFIG_SECURE_BOOT
=====================
This is defined only for creating a different compile time target for secure boot.Traditionally, both these functionalities were defined under
CONFIG_SECURE_BOOTThis patch is aimed at removing the requirement for a separate Secure Boot target for ARM based SoC's.CONFIG_CHAIN_OF_TRUSTwill be defined and boot mode will be determine at run time.Another Security Requirement for running
CHAIN_OF_TRUSTis that U-Boot environemnt must not be picked from flash/external memory. This cannot be done based on bootmode at run time in current U-Boot architecture. Once this dependency is resolved, no separateSECURE_BOOTtarget will be required for ARM based SoC's.Currently, the only code under
CONFIG_SECURE_BOOTfor ARM SoC's is definingCONFIG_ENV_IS_NOWHERESigned-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
NoneChanges in v2:
CONFIG_ENV_IS_NOWHEREis defined for Secure Boot
Quoted 8 lines
arch/arm/include/asm/fsl_secure_boot.h | 16 ++-- arch/powerpc/include/asm/fsl_secure_boot.h | 41 +++++----- include/config_fsl_chain_trust.h | 101 +++++++++++++++++++++++++ include/config_fsl_secboot.h | 116 ----------------------------- 4 files changed, 135 insertions(+), 139 deletions(-) create mode 100644 include/config_fsl_chain_trust.h delete mode 100644 include/config_fsl_secboot.h
Change subject prefix to "secure_boot:". Slightly reformat commit message. Applied to u-boot-fsl-qoriq master. Awaiting upstream.
Thanks.
York
PATCH v3 4/7 create function to determine boot mode
In reply to Aneesh BansalA function is created to detrmine if the boot mode is secure or non-secure for differnt SoC's.
---
Changes in v3:
None
Changes in v2:
Corrected the macro for SB_EN bit in RCW.
.../include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 ++ arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h | 2 + arch/powerpc/include/asm/immap_85xx.h | 3 ++ board/freescale/common/fsl_chain_of_trust.c | 53 ++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 board/freescale/common/fsl_chain_of_trust.c
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +3 -0
@@ -218,6 +218,9 @@ struct ccsr_gur {#define FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_MASK 0x3f#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK 0xffff0000#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT 16 +#define RCW_SB_EN_REG_INDEX 7 +#define RCW_SB_EN_MASK 0x00200000 +u8 res_140[0x200 -0x140 ];u32 scratchrw[4 ];/* Scratch Read/Write */ u8 res_210[0x300 -0x210 ];
arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +2 -0
@@ -120,6 +120,8 @@ struct ccsr_gur {u32 brrl;/* Boot release */ u8 res_0e8[0x100 -0xe8 ];u32 rcwsr[16 ];/* Reset control word status */ +#define RCW_SB_EN_REG_INDEX 7 +#define RCW_SB_EN_MASK 0x00200000u8 res_140[0x200 -0x140 ];u32 scratchrw[4 ];/* Scratch Read/Write */ u8 res_210[0x300 -0x210 ];
arch/powerpc/include/asm/immap_85xx.h +3 -0
@@ -1749,6 +1749,8 @@ typedef struct ccsr_gur {u32 brrl;/* Boot release */ u8 res17[24 ];u32 rcwsr[16 ];/* Reset control word status */ +#define RCW_SB_EN_REG_INDEX 7 +#define RCW_SB_EN_MASK 0x00200000#ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2 #define FSL_CORENET_RCWSR0_MEM_PLL_RAT_SHIFT 16
@@ -2193,6 +2195,7 @@ typedef struct ccsr_gur {#define MPC85xx_PORDEVSR2_DDR_SPD_0 0x00000008#define MPC85xx_PORDEVSR2_DDR_SPD_0_SHIFT 3#endif +#define MPC85xx_PORDEVSR2_SBC_MASK 0x10000000/* The 8544 RM says this is bit 26, but it's really bit 24 */ #define MPC85xx_PORDEVSR2_SEC_CFG 0x00000080u8 res1[8 ];
board/freescale/common/fsl_chain_of_trust.c new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.8.1.4
PATCH v3 4/7 create function to determine boot mode
Quoted 144 lines
-----Original Message-----
From: Aneesh Bansal [mailto:aneesh.bansal at nxp.com]
Sent: Friday, January 22, 2016 4:37 PM
To: u-boot at lists.denx.de
Cc: york sun <[email protected]>; Ruchika Gupta <[email protected]>; Prabhakar Kushwaha <[email protected]>; Aneesh Bansal <[email protected]>
Subject: [PATCH v3 4/7] create function to determine boot modeA function is created to detrmine if the boot mode is secure or non-secure for differnt SoC's.
Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
NoneChanges in v2:
Corrected the macro forSB_ENbit in RCW..../include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 ++ arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h | 2 + arch/powerpc/include/asm/immap_85xx.h | 3 ++ board/freescale/common/fsl_chain_of_trust.c | 53 ++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 board/freescale/common/fsl_chain_of_trust.carch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +3
-0@@ -218,6 +218,9 @@ struct ccsr_gur {#define FSL_CHASSIS2_RCWSR0_MEM_PLL_RAT_MASK 0x3f#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK 0xffff0000#define FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT 16 +#define RCW_SB_EN_REG_INDEX 7 +#define RCW_SB_EN_MASK 0x00200000 +u8 res_140[0x200 -0x140 ];u32 scratchrw[4 ];/* Scratch Read/Write */ u8 res_210[0x300 -0x210 ];arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h +2
-0@@ -120,6 +120,8 @@ struct ccsr_gur {u32 brrl;/* Boot release */ u8 res_0e8[0x100 -0xe8 ];u32 rcwsr[16 ];/* Reset control word status */ +#define RCW_SB_EN_REG_INDEX 7 +#define RCW_SB_EN_MASK 0x00200000u8 res_140[0x200 -0x140 ];u32 scratchrw[4 ];/* Scratch Read/Write */ u8 res_210[0x300 -0x210 ];arch/powerpc/include/asm/immap_85xx.h +3
-0@@ -1749,6 +1749,8 @@ typedef struct ccsr_gur {u32 brrl;/* Boot release */ u8 res17[24 ];u32 rcwsr[16 ];/* Reset control word status */ +#define RCW_SB_EN_REG_INDEX 7 +#define RCW_SB_EN_MASK 0x00200000#ifdef CONFIG_SYS_FSL_QORIQ_CHASSIS2 #define FSL_CORENET_RCWSR0_MEM_PLL_RAT_SHIFT 16@@ -2193,6 +2195,7 @@ typedef struct ccsr_gur {#define MPC85xx_PORDEVSR2_DDR_SPD_0 0x00000008#define MPC85xx_PORDEVSR2_DDR_SPD_0_SHIFT 3#endif +#define MPC85xx_PORDEVSR2_SBC_MASK 0x10000000/* The 8544 RM says this is bit 26, but it's really bit 24 */ #define MPC85xx_PORDEVSR2_SEC_CFG 0x00000080u8 res1[8 ];board/freescale/common/fsl_chain_of_trust.c new file +39
-0@@ -0,0 +1,53 @@ +/* +* Copyright 2015 Freescale Semiconductor, Inc. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <fsl_validate.h> +#include <fsl_sfp.h> + +#ifdef CONFIG_LS102XA +#include <asm/arch/immap_ls102xa.h> +#endif + +#if defined(CONFIG_MPC85xx) +#define CONFIG_DCFG_ADDR CONFIG_SYS_MPC85xx_GUTS_ADDR +#else +#define CONFIG_DCFG_ADDR CONFIG_SYS_FSL_GUTS_ADDR +#endif + +#ifdef CONFIG_SYS_FSL_CCSR_GUR_LE +#define gur_in32 (a) in_le32(a) +#else +#define gur_in32 (a) in_be32(a) +#endif + +/* Check the Boot Mode. If Secure, return 1 else return 0 */ int +fsl_check_boot_mode_secure (void ) { +uint32_t val; +struct ccsr_sfp_regs *sfp_regs = (void *)(CONFIG_SYS_SFP_ADDR ); +struct ccsr_gur __iomem *gur = (void *)(CONFIG_DCFG_ADDR ); + + val =sfp_in32 (&sfp_regs->ospr) &ITS_MASK ; +if (val ==ITS_MASK ) +return 1 ; + +#if defined(CONFIG_FSL_CORENET ) || !defined(CONFIG_MPC85xx) +/* For PBL based platforms check the SB_EN bit in RCWSR */ + val = gur_in32(&gur->rcwsr[RCW_SB_EN_REG_INDEX - 1]) &
RCW_SB_EN_MASK;board/freescale/common/fsl_chain_of_trust.c new file +7
-0+if (val ==RCW_SB_EN_MASK ) +return 1 ; +#endif + +#if defined(CONFIG_MPC85xx) && !defined(CONFIG_FSL_CORENET ) +/* For Non-PBL Platforms, check the Device Status register 2*/ + val = gur_in32(&gur->pordevsr2) &
MPC85xx_PORDEVSR2_SBC_MASK;board/freescale/common/fsl_chain_of_trust.c new file +6
-1+if (val != MPC85xx_PORDEVSR2_SBC_MASK) +return 1 ; + +#endif +return 0 ; +} --
Quoted 1 line
1.8.1.4
PATCH v3 4/7 create function to determine boot mode
In reply to Aneesh BansalQuoted 11 lines · Aneesh Bansal
A function is created to detrmine if the boot mode is secure or non-secure for differnt SoC's.
Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
NoneChanges in v2:
Corrected the macro forSB_ENbit in RCW.
Quoted 6 lines
.../include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 ++ arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h | 2 + arch/powerpc/include/asm/immap_85xx.h | 3 ++ board/freescale/common/fsl_chain_of_trust.c | 53 ++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 board/freescale/common/fsl_chain_of_trust.c
Prefix subject with "secure_boot:".
Applied to u-boot-fsl-qoriq master. Awaiting upstream.
Thanks.
York
PATCH v3 5/7 enable chain of trust for ARM platforms
In reply to Aneesh BansalChain of Trust is enabled for ARM platforms (LS1021 and LS1043). In board_late_init(), fsl_setenv_chain_of_trust() is called which will perform the following:
- If boot mode is non-secure, return (No Change)
- If boot mode is secure, set the following environmet variables:
bootdelay = 0 (To disable Boot Prompt)
bootcmd = CONFIG_CHAIN_BOOT_CMD (Validate and execute Boot script)
---
Changes in v3:
Protect the inclusion of file fsl_validate.h with macro CONFIG_CHAIN_OF_TRUST
Changes in v2:
Defconfigs for Secure Boot Target are not removed.
arch/arm/cpu/armv8/fsl-layerscape/soc.c | 6 ++++++ board/freescale/common/Makefile | 1 + board/freescale/common/fsl_chain_of_trust.c | 17 +++++++++++++++++ board/freescale/ls1021aqds/ls1021aqds.c | 4 ++++ board/freescale/ls1021atwr/ls1021atwr.c | 4 ++++ include/fsl_validate.h | 2 ++ 6 files changed, 34 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/soc.c +6 -0
@@ -12,6 +12,9 @@#include <asm/io.h> #include <asm/global_data.h> #include <asm/arch-fsl-layerscape/config.h> +#ifdef CONFIG_CHAIN_OF_TRUST +#include <fsl_validate.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -241,6 +244,9 @@ int board_late_init(void)#ifdef CONFIG_SCSI_AHCI_PLAT sata_init ();#endif +#ifdef CONFIG_CHAIN_OF_TRUST +fsl_setenv_chain_of_trust (); +#endif return 0 ; }
board/freescale/common/Makefile +1 -0
@@ -76,5 +76,6 @@ obj-$(CONFIG_LAYERSCAPE_NS_ACCESS) += ns_access.o ifdef CONFIG_SECURE_BOOT obj-$(CONFIG_CMD_ESBC_VALIDATE) += fsl_validate.o cmd_esbc_validate.o endif +obj-$(CONFIG_CHAIN_OF_TRUST) += fsl_chain_of_trust.o endif
board/freescale/common/fsl_chain_of_trust.c +17 -0
@@ -51,3 +51,20 @@ int fsl_check_boot_mode_secure(void)#endif return 0 ; } + +int fsl_setenv_chain_of_trust (void ) +{ +/* Check Boot Mode +* If Boot Mode is Non-Secure, no changes are required +*/ +if (fsl_check_boot_mode_secure () ==0 ) +return 0 ; + +/* If Boot mode is Secure, set the environment variables +* bootdelay = 0 (To disable Boot Prompt) +* bootcmd = CONFIG_CHAIN_BOOT_CMD (Validate and execute Boot script) +*/ +setenv ("bootdelay" ,"0" ); +setenv ("bootcmd" ,CONFIG_CHAIN_BOOT_CMD ); +return 0 ; +}
board/freescale/ls1021aqds/ls1021aqds.c +4 -0
@@ -22,6 +22,7 @@#include <fsl_sec.h> #include <spl.h> #include <fsl_devdis.h> +#include <fsl_validate.h> #include "../common/sleep.h" #include "../common/qixis.h"
@@ -369,6 +370,9 @@ int board_late_init(void)#ifdef CONFIG_SCSI_AHCI_PLAT ls1021a_sata_init ();#endif +#ifdef CONFIG_CHAIN_OF_TRUST +fsl_setenv_chain_of_trust (); +#endif return 0 ; }
board/freescale/ls1021atwr/ls1021atwr.c +4 -0
@@ -30,6 +30,7 @@#ifdef CONFIG_U_QE #include "../../../drivers/qe/qe.h" #endif +#include <fsl_validate.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -553,6 +554,9 @@ int board_late_init(void)#ifdef CONFIG_SCSI_AHCI_PLAT ls1021a_sata_init ();#endif +#ifdef CONFIG_CHAIN_OF_TRUST +fsl_setenv_chain_of_trust (); +#endif return 0 ; }
include/fsl_validate.h +2 -0
@@ -205,4 +205,6 @@ int fsl_secboot_blob_encap(cmd_tbl_t *cmdtp, int flag, int argc,int fsl_secboot_blob_decap (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]); +int fsl_check_boot_mode_secure (void ); +int fsl_setenv_chain_of_trust (void );#endif
Signature · 1 line
1.8.1.4
PATCH v3 5/7 enable chain of trust for ARM platforms
Quoted 159 lines
-----Original Message-----
From: Aneesh Bansal [mailto:aneesh.bansal at nxp.com]
Sent: Friday, January 22, 2016 4:37 PM
To: u-boot at lists.denx.de
Cc: york sun <[email protected]>; Ruchika Gupta <[email protected]>; Prabhakar Kushwaha <[email protected]>; Aneesh Bansal <[email protected]>
Subject: [PATCH v3 5/7] enable chain of trust for ARM platformsChain of Trust is enabled for ARM platforms (LS1021 and LS1043). In
board_late_init(),fsl_setenv_chain_of_trust()is called which will perform the following:
- If boot mode is non-secure, return (No Change)
- If boot mode is secure, set the following environmet variables:
bootdelay = 0 (To disable Boot Prompt)
bootcmd =CONFIG_CHAIN_BOOT_CMD(Validate and execute Boot script)Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
Protect the inclusion of filefsl_validate.hwith macroCONFIG_CHAIN_OF_TRUSTChanges in v2:
Defconfigs for Secure Boot Target are not removed.arch/arm/cpu/armv8/fsl-layerscape/soc.c | 6 ++++++ board/freescale/common/Makefile | 1 + board/freescale/common/fsl_chain_of_trust.c | 17 +++++++++++++++++ board/freescale/ls1021aqds/ls1021aqds.c | 4 ++++ board/freescale/ls1021atwr/ls1021atwr.c | 4 ++++ include/fsl_validate.h | 2 ++ 6 files changed, 34 insertions(+)arch/arm/cpu/armv8/fsl-layerscape/soc.c +3
-0@@ -12,6 +12,9 @@#include <asm/io.h> #include <asm/global_data.h> #include <asm/arch-fsl-layerscape/config.h> +#ifdef CONFIG_CHAIN_OF_TRUST +#include <fsl_validate.h> +#endif DECLARE_GLOBAL_DATA_PTR ;@@ -241,6 +244,9 @@ int board_late_init(void) #ifdef
CONFIG_SCSI_AHCI_PLATarch/arm/cpu/armv8/fsl-layerscape/soc.c +3
-0sata_init ();#endif +#ifdef CONFIG_CHAIN_OF_TRUST +fsl_setenv_chain_of_trust (); +#endif return 0 ; }(quoted diff) +0
-0b/board/freescale/common/Makefile index 51d2814..be114ce 100644
board/freescale/common/Makefile +0
-0@@ -76,5 +76,6 @@ obj-$(CONFIG_LAYERSCAPE_NS_ACCESS) +=ns_access.o
ifdefCONFIG_SECURE_BOOT
obj-$(CONFIG_CMD_ESBC_VALIDATE) += fsl_validate.o cmd_esbc_validate.o
endifboard/freescale/common/Makefile +1
-0+obj-$(CONFIG_CHAIN_OF_TRUST) += fsl_chain_of_trust.o endifboard/freescale/common/fsl_chain_of_trust.c +17
-0@@ -51,3 +51,20 @@ int fsl_check_boot_mode_secure(void) #endifreturn 0 ; } + +int fsl_setenv_chain_of_trust (void ) +{ +/* Check Boot Mode +* If Boot Mode is Non-Secure, no changes are required +*/ +if (fsl_check_boot_mode_secure () ==0 ) +return 0 ; + +/* If Boot mode is Secure, set the environment variables +* bootdelay = 0 (To disable Boot Prompt) +* bootcmd = CONFIG_CHAIN_BOOT_CMD (Validate and execute Boot script) +*/ +setenv ("bootdelay" ,"0" ); +setenv ("bootcmd" ,CONFIG_CHAIN_BOOT_CMD ); +return 0 ; +}board/freescale/ls1021aqds/ls1021aqds.c +1
-0@@ -22,6 +22,7 @@#include <fsl_sec.h> #include <spl.h> #include <fsl_devdis.h> +#include <fsl_validate.h> #include "../common/sleep.h" #include "../common/qixis.h" @@ -369,6 +370,9 @@ int board_late_init(void) #ifdef
CONFIG_SCSI_AHCI_PLATboard/freescale/ls1021aqds/ls1021aqds.c +3
-0ls1021a_sata_init ();#endif +#ifdef CONFIG_CHAIN_OF_TRUST +fsl_setenv_chain_of_trust (); +#endif return 0 ; }board/freescale/ls1021atwr/ls1021atwr.c +1
-0@@ -30,6 +30,7 @@#ifdef CONFIG_U_QE #include "../../../drivers/qe/qe.h" #endif +#include <fsl_validate.h> DECLARE_GLOBAL_DATA_PTR ;@@ -553,6 +554,9 @@ int board_late_init(void) #ifdef
CONFIG_SCSI_AHCI_PLATboard/freescale/ls1021atwr/ls1021atwr.c +3
-0ls1021a_sata_init ();#endif +#ifdef CONFIG_CHAIN_OF_TRUST +fsl_setenv_chain_of_trust (); +#endif return 0 ; }include/fsl_validate.h index renamed from include/fsl_validate.h +0
-0ad14867..83efcf4 100644
include/fsl_validate.h +0
-0@@ -205,4 +205,6 @@ int fsl_secboot_blob_encap(cmd_tbl_t *cmdtp, intflag, int argc, int fsl_secboot_blob_decap(cmd_tbl_t *cmdtp, int flag, int argc,
include/fsl_validate.h +2
-1char * const argv[]); +int fsl_check_boot_mode_secure (void ); +int fsl_setenv_chain_of_trust (void );#endif --
Quoted 1 line
1.8.1.4
PATCH v3 5/7 enable chain of trust for ARM platforms
In reply to Aneesh BansalQuoted 16 lines · Aneesh Bansal
Chain of Trust is enabled for ARM platforms (LS1021 and LS1043). In
board_late_init(),fsl_setenv_chain_of_trust()is called which will perform the following:
- If boot mode is non-secure, return (No Change)
- If boot mode is secure, set the following environmet variables:
bootdelay = 0 (To disable Boot Prompt)
bootcmd =CONFIG_CHAIN_BOOT_CMD(Validate and execute Boot script)Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
Protect the inclusion of filefsl_validate.hwith macroCONFIG_CHAIN_OF_TRUSTChanges in v2:
Defconfigs for Secure Boot Target are not removed.
Quoted 7 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c | 6 ++++++ board/freescale/common/Makefile | 1 + board/freescale/common/fsl_chain_of_trust.c | 17 +++++++++++++++++ board/freescale/ls1021aqds/ls1021aqds.c | 4 ++++ board/freescale/ls1021atwr/ls1021atwr.c | 4 ++++ include/fsl_validate.h | 2 ++ 6 files changed, 34 insertions(+)
Prefix subject with "secure_boot:".
Applied to u-boot-fsl-qoriq master. Awaiting upstream.
Thanks.
York
PATCH v3 6/7 enable chain of trust for PowerPC platforms
In reply to Aneesh BansalChain of Trust is enabled for PowerPC platforms for Secure Boot. CONFIG_BOARD_LATE_INIT is defined.
In board_late_init(), fsl_setenv_chain_of_trust() is called which will perform the following:
- If boot mode is non-secure, return (No Change)
- If boot mode is secure, set the following environmet variables:
bootdelay = 0 (To disable Boot Prompt)
bootcmd = CONFIG_CHAIN_BOOT_CMD (Validate and execute Boot script)
---
Changes in v3:
Protect the inclusion of file fsl_validate.h with macro CONFIG_CHAIN_OF_TRUST
Changes in v2:
None (Changed the Sign-Off with New E-Mail ID)
arch/powerpc/cpu/mpc85xx/cpu_init.c | 14 ++++++++++++++ arch/powerpc/include/asm/fsl_secure_boot.h | 7 +++++++ 2 files changed, 21 insertions(+)
arch/powerpc/cpu/mpc85xx/cpu_init.c +14 -0
@@ -27,6 +27,9 @@#include <hwconfig.h> #include <linux/compiler.h> #include "mp.h" +#ifdef CONFIG_CHAIN_OF_TRUST +#include <fsl_validate.h> +#endif #ifdef CONFIG_FSL_CAAM #include <fsl_sec.h> #endif
@@ -1011,3 +1014,14 @@ void cpu_secondary_init_r(void)qe_reset ();#endif } + +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init (void ) +{ +#ifdef CONFIG_CHAIN_OF_TRUST +fsl_setenv_chain_of_trust (); +#endif + +return 0 ; +} +#endif
arch/powerpc/include/asm/fsl_secure_boot.h +7 -0
@@ -87,6 +87,13 @@#define CONFIG_FSL_CAAM #endif +/* fsl_setenv_chain_of_trust() must be called from +* board_late_init() +*/ +#ifndef CONFIG_BOARD_LATE_INIT +#define CONFIG_BOARD_LATE_INIT +#endif +/* If Boot Script is not on NOR and is required to be copied on RAM */ #ifdef CONFIG_BOOTSCRIPT_COPY_RAM #define CONFIG_BS_HDR_ADDR_RAM 0x00010000
Signature · 1 line
1.8.1.4
PATCH v3 6/7 enable chain of trust for PowerPC platforms
Quoted 81 lines
-----Original Message-----
From: Aneesh Bansal [mailto:aneesh.bansal at nxp.com]
Sent: Friday, January 22, 2016 4:37 PM
To: u-boot at lists.denx.de
Cc: york sun <[email protected]>; Ruchika Gupta <[email protected]>; Prabhakar Kushwaha <[email protected]>; Aneesh Bansal <[email protected]>
Subject: [PATCH v3 6/7] enable chain of trust for PowerPC platformsChain of Trust is enabled for PowerPC platforms for Secure Boot.
CONFIG_BOARD_LATE_INITis defined.
Inboard_late_init(),fsl_setenv_chain_of_trust()is called which will perform the following:
- If boot mode is non-secure, return (No Change)
- If boot mode is secure, set the following environmet variables:
bootdelay = 0 (To disable Boot Prompt)
bootcmd =CONFIG_CHAIN_BOOT_CMD(Validate and execute Boot script)Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
Protect the inclusion of filefsl_validate.hwith macroCONFIG_CHAIN_OF_TRUSTChanges in v2:
None (Changed the Sign-Off with New E-Mail ID)arch/powerpc/cpu/mpc85xx/cpu_init.c | 14 ++++++++++++++ arch/powerpc/include/asm/fsl_secure_boot.h | 7 +++++++ 2 files changed, 21 insertions(+)arch/powerpc/cpu/mpc85xx/cpu_init.c +14
-0@@ -27,6 +27,9 @@#include <hwconfig.h> #include <linux/compiler.h> #include "mp.h" +#ifdef CONFIG_CHAIN_OF_TRUST +#include <fsl_validate.h> +#endif #ifdef CONFIG_FSL_CAAM #include <fsl_sec.h> #endif @@ -1011,3 +1014,14 @@ void cpu_secondary_init_r(void)qe_reset ();#endif } + +#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init (void ) +{ +#ifdef CONFIG_CHAIN_OF_TRUST +fsl_setenv_chain_of_trust (); +#endif + +return 0 ; +} +#endif arch/powerpc/include/asm/fsl_secure_boot.h +7
-0@@ -87,6 +87,13 @@#define CONFIG_FSL_CAAM #endif +/* fsl_setenv_chain_of_trust() must be called from +* board_late_init() +*/ +#ifndef CONFIG_BOARD_LATE_INIT +#define CONFIG_BOARD_LATE_INIT +#endif + /* If Boot Script is not on NOR and is required to be copied on RAM */ #ifdef
Quoted 4 lines
CONFIG_BOOTSCRIPT_COPY_RAM
#defineCONFIG_BS_HDR_ADDR_RAM0x00010000
--
1.8.1.4
PATCH v3 6/7 enable chain of trust for PowerPC platforms
In reply to Aneesh BansalQuoted 14 lines · Aneesh Bansal
Chain of Trust is enabled for PowerPC platforms for Secure Boot.
CONFIG_BOARD_LATE_INITis defined.
Inboard_late_init(),fsl_setenv_chain_of_trust()is called which will perform the following:
- If boot mode is non-secure, return (No Change)
- If boot mode is secure, set the following environmet variables:
bootdelay = 0 (To disable Boot Prompt)
bootcmd =CONFIG_CHAIN_BOOT_CMD(Validate and execute Boot script)Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
Protect the inclusion of filefsl_validate.hwith macroCONFIG_CHAIN_OF_TRUST
Quoted 7 lines
Changes in v2:
None (Changed the Sign-Off with New E-Mail ID)arch/powerpc/cpu/mpc85xx/cpu_init.c | 14 ++++++++++++++ arch/powerpc/include/asm/fsl_secure_boot.h | 7 +++++++ 2 files changed, 21 insertions(+)
Prefix subject with "secure_boot:".
Applied to u-boot-fsl-qoriq master. Awaiting upstream.
Thanks.
York
PATCH v3 7/7 SECURE_BOOT: change error handler for esbc_validate
In reply to Aneesh BansalIn case of error while executing esbc_validate command, SNVS transition and issue of reset is required only for secure-boot. If boot mode is non-secure, this is not required.
Similarly, esbc_halt command which puts the core in Spin Loop is applicable only for Secure Boot.
---
Changes in v3:
None
Changes in v2:
None (Changed the Sign-Off with New E-Mail ID)
board/freescale/common/cmd_esbc_validate.c | 7 ++++++- board/freescale/common/fsl_validate.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
board/freescale/common/cmd_esbc_validate.c +6 -1
@@ -11,6 +11,11 @@static int do_esbc_halt (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { +if (fsl_check_boot_mode_secure () ==0 ) { +printf ("Boot Mode is Non-Secure. Not entering spin loop.\n" ); +return 0 ; + } +printf ("Core is entering spin loop.\n" ); loop: goto loop;
@@ -64,6 +69,6 @@ U_BOOT_CMD(U_BOOT_CMD ( esbc_halt,1 ,0 , do_esbc_halt, -"Put the core in spin loop " , +"Put the core in spin loop (Secure Boot Only)" ,"" );
board/freescale/common/fsl_validate.c +7 -0
@@ -370,6 +370,13 @@ void fsl_secboot_handle_error(int error)printf ("ERROR :: %x :: %s\n" , error, e->name); } +/* If Boot Mode is secure, transition the SNVS state and issue +* reset based on type of failure and ITS setting. +* If Boot mode is non-secure, return from this function. +*/ +if (fsl_check_boot_mode_secure () ==0 ) +return ; +switch (error) {case ERROR_ESBC_CLIENT_HEADER_BARKER :case ERROR_ESBC_CLIENT_HEADER_IMG_SIZE :
Signature · 1 line
1.8.1.4
PATCH v3 7/7 SECURE_BOOT: change error handler for esbc_validate
Quoted 78 lines
-----Original Message-----
From: Aneesh Bansal [mailto:aneesh.bansal at nxp.com]
Sent: Friday, January 22, 2016 4:37 PM
To: u-boot at lists.denx.de
Cc: york sun <[email protected]>; Ruchika Gupta <[email protected]>; Prabhakar Kushwaha <[email protected]>; Aneesh Bansal <[email protected]>
Subject: [PATCH v3 7/7]SECURE_BOOT: change error handler foresbc_validateIn case of error while executing
esbc_validatecommand, SNVS transition and issue of reset is required only for secure-boot.
If boot mode is non-secure, this is not required.Similarly,
esbc_haltcommand which puts the core in Spin Loop is applicable only for Secure Boot.Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
NoneChanges in v2:
None (Changed the Sign-Off with New E-Mail ID)board/freescale/common/cmd_esbc_validate.c | 7 ++++++- board/freescale/common/fsl_validate.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-)board/freescale/common/cmd_esbc_validate.c +5
-0@@ -11,6 +11,11 @@static int do_esbc_halt (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { +if (fsl_check_boot_mode_secure () ==0 ) { + printf("Boot Mode is Non-Secure. Not entering spin loop.\n"); +return 0 ; + } +printf ("Core is entering spin loop.\n" ); loop:board/freescale/common/cmd_esbc_validate.c +1
-1goto loop;@@ -64,6 +69,6 @@ U_BOOT_CMD(U_BOOT_CMD ( esbc_halt,1 ,0 , do_esbc_halt, -"Put the core in spin loop " , +"Put the core in spin loop (Secure Boot Only)" ,"" );board/freescale/common/fsl_validate.c +7
-1@@ -370,6 +370,13 @@ void fsl_secboot_handle_error(int error)printf ("ERROR :: %x :: %s\n" , error, e->name); } +/* If Boot Mode is secure, transition the SNVS state and issue +* reset based on type of failure and ITS setting. +* If Boot mode is non-secure, return from this function. +*/ +if (fsl_check_boot_mode_secure () ==0 ) +return ; +switch (error) {case ERROR_ESBC_CLIENT_HEADER_BARKER :case ERROR_ESBC_CLIENT_HEADER_IMG_SIZE : --
Quoted 1 line
1.8.1.4
PATCH v3 7/7 SECURE_BOOT: change error handler for esbc_validate
In reply to Aneesh BansalQuoted 12 lines · Aneesh Bansal
In case of error while executing
esbc_validatecommand, SNVS transition and issue of reset is required only for secure-boot. If boot mode is non-secure, this is not required.Similarly,
esbc_haltcommand which puts the core in Spin Loop is applicable only for Secure Boot.Signed-off-by Aneesh Bansal <[email protected]>---
Changes in v3:
None
Quoted 7 lines
Changes in v2:
None (Changed the Sign-Off with New E-Mail ID)board/freescale/common/cmd_esbc_validate.c | 7 ++++++- board/freescale/common/fsl_validate.c | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
Change subject prefix to "secure_boot:". Applied to u-boot-fsl-qoriq master. Awaiting upstream.
Thanks.
York
v3 cover Determine Boot mode at run time
In reply to Aneesh BansalQuoted 77 lines · Aneesh Bansal
There are two phases in Secure Boot
1. ISBC: In BootROM, validate the BootLoader (U-Boot).
2. ESBC: In U-Boot, continuing the Chain of Trust by validating and booting LINUX.For ESBC phase, there is no difference in SoC's based on ARM or PowerPC cores.
But the exit conditions after ISBC phase i.e. entry conditions for U-Boot are different for ARM and PowerPC.
PowerPC:
========
If Secure Boot is executed, a separate U-Boot target is required which must be compiled with a diffrent Text Base as compared to Non-Secure Boot. There are some LAW and TLB settings which are required specifically for Secure Boot scenario.ARM:
====
ARM based SoC's have a fixed memory map and exit conditions from BootROM are same irrespective of boot mode (Secure or Non-Secure).This patchset is aimed at removing the requirement for a separate Secure Boot target for ARM based SoC's.
Another Security Requirement for running
CHAIN_OF_TRUSTis that U-Boot environemnt must not be picked from flash/external memory. This cannot be done based on bootmode at run time in current U-Boot architecture. Once this dependency is resolved, no separateSECURE_BOOTtarget will be required for ARM based SoC's.Currently, the only code under
CONFIG_SECURE_BOOTfor ARM SoC's is definingCONFIG_ENV_IS_NOWHEREThe patches have been tested on LS1043, LS1021, P3041 and T1024.
The patch set is dependent on following:
http://patchwork.ozlabs.org/patch/553826/Aneesh Bansal (7):
include/configs: make secure boot header file include uniforminclude/configs: move definition ofCONFIG_CMD_BLOB
SECURE_BOOT: split the secure boot functionality in two parts create function to determine boot mode
enable chain of trust for ARM platforms
enable chain of trust for PowerPC platforms
SECURE_BOOT: change error handler foresbc_validatearch/arm/cpu/armv8/fsl-layerscape/soc.c | 6 ++ .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 + arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h | 2 + arch/arm/include/asm/fsl_secure_boot.h | 20 +++- arch/powerpc/cpu/mpc85xx/cpu_init.c | 14 +++ arch/powerpc/include/asm/fsl_secure_boot.h | 47 ++++++--- arch/powerpc/include/asm/immap_85xx.h | 3 + board/freescale/common/Makefile | 1 + board/freescale/common/cmd_esbc_validate.c | 7 +- board/freescale/common/fsl_chain_of_trust.c | 70 +++++++++++++ board/freescale/common/fsl_validate.c | 7 ++ board/freescale/ls1021aqds/ls1021aqds.c | 4 + board/freescale/ls1021atwr/ls1021atwr.c | 4 + include/config_fsl_chain_trust.h | 101 ++++++++++++++++++ include/config_fsl_secboot.h | 116 --------------------- include/configs/B4860QDS.h | 4 - include/configs/BSC9132QDS.h | 4 - include/configs/P1010RDB.h | 4 - include/configs/P2041RDB.h | 4 - include/configs/T102xQDS.h | 10 +- include/configs/T102xRDB.h | 10 +- include/configs/T1040QDS.h | 3 - include/configs/T104xRDB.h | 3 - include/configs/T208xQDS.h | 4 - include/configs/T208xRDB.h | 4 - include/configs/T4240QDS.h | 4 - include/configs/T4240RDB.h | 9 -- include/configs/corenet_ds.h | 4 - include/configs/ls1021aqds.h | 5 +- include/configs/ls1021atwr.h | 5 +-
Quoted 8 lines
include/configs/ls1043a_common.h | 8 ++ include/configs/ls1043aqds.h | 2 + include/configs/ls1043ardb.h | 8 -- include/fsl_validate.h | 2 + 34 files changed, 299 insertions(+), 203 deletions(-) create mode 100644 board/freescale/common/fsl_chain_of_trust.c create mode 100644 include/config_fsl_chain_trust.h delete mode 100644 include/config_fsl_secboot.h
Looking at the config file changes, I think we need to move a bunch of this stuff to Kconfig so that we can get these consistent and correct each time.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160125/a92cc69f/attachment.sig>
v3 cover Determine Boot mode at run time
Quoted 96 lines
-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Monday, January 25, 2016 9:06 PM
To: Aneesh Bansal <[email protected]>
Cc: u-boot at lists.denx.de; Ruchika Gupta <[email protected]>
Subject: Re: [U-Boot] [PATCH v3 0/7] Determine Boot mode at run timeQuoted 22 lines · Aneesh Bansal
There are two phases in Secure Boot
1. ISBC: In BootROM, validate the BootLoader (U-Boot).
2. ESBC: In U-Boot, continuing the Chain of Trust by validating and booting LINUX.For ESBC phase, there is no difference in SoC's based on ARM or PowerPC cores.
But the exit conditions after ISBC phase i.e. entry conditions for U-Boot are different for ARM and PowerPC.
PowerPC:
========
If Secure Boot is executed, a separate U-Boot target is required which must be compiled with a diffrent Text Base as compared to Non-Secure Boot. There are some LAW and TLB settings which are required specifically for Secure Boot scenario.ARM:
====
ARM based SoC's have a fixed memory map and exit conditions from BootROM are same irrespective of boot mode (Secure or Non-Secure).Quoted 7 lines
This patchset is aimed at removing the requirement for a separate Secure Boot target for ARM based SoC's.
Another Security Requirement for running
CHAIN_OF_TRUSTis that U-Boot environemnt must not be picked from flash/external memory. This cannot be done based on bootmode at run time in current U-Boot architecture. Once this dependency is resolved, no separateSECURE_BOOTtarget will berequired for ARM based SoC's.
Quoted 55 lines
Currently, the only code under
CONFIG_SECURE_BOOTfor ARM SoC's is definingCONFIG_ENV_IS_NOWHEREThe patches have been tested on LS1043, LS1021, P3041 and T1024.
The patch set is dependent on following:
http://patchwork.ozlabs.org/patch/553826/Aneesh Bansal (7):
include/configs: make secure boot header file include uniforminclude/configs: move definition ofCONFIG_CMD_BLOB
SECURE_BOOT: split the secure boot functionality in two parts create function to determine boot mode
enable chain of trust for ARM platforms
enable chain of trust for PowerPC platforms
SECURE_BOOT: change error handler foresbc_validatearch/arm/cpu/armv8/fsl-layerscape/soc.c | 6 ++ .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 + arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h | 2 + arch/arm/include/asm/fsl_secure_boot.h | 20 +++- arch/powerpc/cpu/mpc85xx/cpu_init.c | 14 +++ arch/powerpc/include/asm/fsl_secure_boot.h | 47 ++++++--- arch/powerpc/include/asm/immap_85xx.h | 3 + board/freescale/common/Makefile | 1 + board/freescale/common/cmd_esbc_validate.c | 7 +- board/freescale/common/fsl_chain_of_trust.c | 70 +++++++++++++ board/freescale/common/fsl_validate.c | 7 ++ board/freescale/ls1021aqds/ls1021aqds.c | 4 + board/freescale/ls1021atwr/ls1021atwr.c | 4 + include/config_fsl_chain_trust.h | 101 ++++++++++++++++++ include/config_fsl_secboot.h | 116 --------------------- include/configs/B4860QDS.h | 4 - include/configs/BSC9132QDS.h | 4 - include/configs/P1010RDB.h | 4 - include/configs/P2041RDB.h | 4 - include/configs/T102xQDS.h | 10 +- include/configs/T102xRDB.h | 10 +- include/configs/T1040QDS.h | 3 - include/configs/T104xRDB.h | 3 - include/configs/T208xQDS.h | 4 - include/configs/T208xRDB.h | 4 - include/configs/T4240QDS.h | 4 - include/configs/T4240RDB.h | 9 -- include/configs/corenet_ds.h | 4 - include/configs/ls1021aqds.h | 5 +- include/configs/ls1021atwr.h | 5 +- include/configs/ls1043a_common.h | 8 ++ include/configs/ls1043aqds.h | 2 + include/configs/ls1043ardb.h | 8 -- include/fsl_validate.h | 2 + 34 files changed, 299 insertions(+), 203 deletions(-) create mode 100644 board/freescale/common/fsl_chain_of_trust.c create mode 100644 include/config_fsl_chain_trust.h delete modeQuoted 1 line
100644
include/config_fsl_secboot.h
Quoted 5 lines
Looking at the config file changes, I think we need to move a bunch of this stuff to
Kconfigso that we can get these consistent and correct each time.--
Tom
The patches move the common configs/defines from platform specific files to a common file fsl_secure_boot.h. This is also done with the intention of making it consistent and avoiding correction each time for a new platform.
I will later work on restructuring the code to use Kconfig on top of these patches.
Aneesh
v3 cover Determine Boot mode at run time
Quoted 99 lines · Aneesh Bansal
Quoted 99 lines
-----Original Message-----
From: Tom Rini [mailto:trini at konsulko.com]
Sent: Monday, January 25, 2016 9:06 PM
To: Aneesh Bansal <[email protected]>
Cc: u-boot at lists.denx.de; Ruchika Gupta <[email protected]>
Subject: Re: [U-Boot] [PATCH v3 0/7] Determine Boot mode at run timeQuoted 22 lines · Aneesh Bansal
There are two phases in Secure Boot
1. ISBC: In BootROM, validate the BootLoader (U-Boot).
2. ESBC: In U-Boot, continuing the Chain of Trust by validating and booting LINUX.For ESBC phase, there is no difference in SoC's based on ARM or PowerPC cores.
But the exit conditions after ISBC phase i.e. entry conditions for U-Boot are different for ARM and PowerPC.
PowerPC:
========
If Secure Boot is executed, a separate U-Boot target is required which must be compiled with a diffrent Text Base as compared to Non-Secure Boot. There are some LAW and TLB settings which are required specifically for Secure Boot scenario.ARM:
====
ARM based SoC's have a fixed memory map and exit conditions from BootROM are same irrespective of boot mode (Secure or Non-Secure).Quoted 7 lines
This patchset is aimed at removing the requirement for a separate Secure Boot target for ARM based SoC's.
Another Security Requirement for running
CHAIN_OF_TRUSTis that U-Boot environemnt must not be picked from flash/external memory. This cannot be done based on bootmode at run time in current U-Boot architecture. Once this dependency is resolved, no separateSECURE_BOOTtarget will berequired for ARM based SoC's.
Quoted 55 lines
Currently, the only code under
CONFIG_SECURE_BOOTfor ARM SoC's is definingCONFIG_ENV_IS_NOWHEREThe patches have been tested on LS1043, LS1021, P3041 and T1024.
The patch set is dependent on following:
http://patchwork.ozlabs.org/patch/553826/Aneesh Bansal (7):
include/configs: make secure boot header file include uniforminclude/configs: move definition ofCONFIG_CMD_BLOB
SECURE_BOOT: split the secure boot functionality in two parts create function to determine boot mode
enable chain of trust for ARM platforms
enable chain of trust for PowerPC platforms
SECURE_BOOT: change error handler foresbc_validatearch/arm/cpu/armv8/fsl-layerscape/soc.c | 6 ++ .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 3 + arch/arm/include/asm/arch-ls102xa/immap_ls102xa.h | 2 + arch/arm/include/asm/fsl_secure_boot.h | 20 +++- arch/powerpc/cpu/mpc85xx/cpu_init.c | 14 +++ arch/powerpc/include/asm/fsl_secure_boot.h | 47 ++++++--- arch/powerpc/include/asm/immap_85xx.h | 3 + board/freescale/common/Makefile | 1 + board/freescale/common/cmd_esbc_validate.c | 7 +- board/freescale/common/fsl_chain_of_trust.c | 70 +++++++++++++ board/freescale/common/fsl_validate.c | 7 ++ board/freescale/ls1021aqds/ls1021aqds.c | 4 + board/freescale/ls1021atwr/ls1021atwr.c | 4 + include/config_fsl_chain_trust.h | 101 ++++++++++++++++++ include/config_fsl_secboot.h | 116 --------------------- include/configs/B4860QDS.h | 4 - include/configs/BSC9132QDS.h | 4 - include/configs/P1010RDB.h | 4 - include/configs/P2041RDB.h | 4 - include/configs/T102xQDS.h | 10 +- include/configs/T102xRDB.h | 10 +- include/configs/T1040QDS.h | 3 - include/configs/T104xRDB.h | 3 - include/configs/T208xQDS.h | 4 - include/configs/T208xRDB.h | 4 - include/configs/T4240QDS.h | 4 - include/configs/T4240RDB.h | 9 -- include/configs/corenet_ds.h | 4 - include/configs/ls1021aqds.h | 5 +- include/configs/ls1021atwr.h | 5 +- include/configs/ls1043a_common.h | 8 ++ include/configs/ls1043aqds.h | 2 + include/configs/ls1043ardb.h | 8 -- include/fsl_validate.h | 2 + 34 files changed, 299 insertions(+), 203 deletions(-) create mode 100644 board/freescale/common/fsl_chain_of_trust.c create mode 100644 include/config_fsl_chain_trust.h delete modeQuoted 1 line
100644
include/config_fsl_secboot.hLooking at the config file changes, I think we need to move a bunch of this stuff to
Kconfigso that we can get these consistent and correct each time.
Quoted 7 lines
Quoted 2 lines
--
TomThe patches move the common configs/defines from platform specific files to a common file
fsl_secure_boot.h. This is also done with the intention of making it consistent and avoiding correction each time for a new platform.I will later work on restructuring the code to use
Kconfigon top of these patches.
OK, thanks.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160127/bf62a0c7/attachment.sig>