[PoC 038/241] global: Migrate CONFIG_FSL_ISBC_KEY_EXT to CFG

Tom Rini
2022-11-20T13:41:05Z

arch/arm/include/asm/fsl_secure_boot.h | 2 +-
arch/powerpc/include/asm/fsl_secure_boot.h | 2 +-
board/freescale/common/fsl_validate.c | 18 +++++++++---------
include/fsl_validate.h | 8 ++++----
scripts/config_whitelist.txt | 2 +-
5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/arch/arm/include/asm/fsl_secure_boot.h b/arch/arm/include/asm/fsl_secure_boot.h
index a4f4961fc877..39265f3e7be4 100644
--- a/arch/arm/include/asm/fsl_secure_boot.h
+++ b/arch/arm/include/asm/fsl_secure_boot.h
@@ -20,7 +20,7 @@
* is copied to XIP memory
* Also, for LS, ISBC doesn't verify this table.
*/
-#define CONFIG_FSL_ISBC_KEY_EXT
+#define CFG_FSL_ISBC_KEY_EXT

#endif

diff --git a/arch/powerpc/include/asm/fsl_secure_boot.h b/arch/powerpc/include/asm/fsl_secure_boot.h
index e8b26802062b..033308a4ab39 100644
--- a/arch/powerpc/include/asm/fsl_secure_boot.h
+++ b/arch/powerpc/include/asm/fsl_secure_boot.h
@@ -51,7 +51,7 @@
* The feature is only applicable in case of NOR boot and is
* not applicable in case of RAMBOOT (NAND, SD, SPI).
*/
-#define CONFIG_FSL_ISBC_KEY_EXT
+#define CFG_FSL_ISBC_KEY_EXT
#endif
#endif /* #ifdef CONFIG_NXP_ESBC */

diff --git a/board/freescale/common/fsl_validate.c b/board/freescale/common/fsl_validate.c
index 285ed9afcc9a..947c8b74c02b 100644
--- a/board/freescale/common/fsl_validate.c
+++ b/board/freescale/common/fsl_validate.c
@@ -29,7 +29,7 @@
#define CHECK_KEY_LEN(key_len) (((key_len) == 2 * KEY_SIZE_BYTES / 4) || \
((key_len) == 2 * KEY_SIZE_BYTES / 2) || \
((key_len) == 2 * KEY_SIZE_BYTES))
-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
/* Global data structure */
static struct fsl_secboot_glb glb;
#endif
@@ -63,7 +63,7 @@ self:
goto self;
}

-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
static u32 check_ie(struct fsl_secboot_img_priv *img)
{
if (img->hdr.ie_flag & IE_FLAG_MASK)
@@ -188,7 +188,7 @@ static u32 check_srk(struct fsl_secboot_img_priv *img)
{
#ifdef CONFIG_ESBC_HDR_LS
/* In LS, No SRK Flag as SRK is always present if IE not present*/
-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
return !check_ie(img);
#endif
return 1;
@@ -278,7 +278,7 @@ static u32 read_validate_single_key(struct fsl_secboot_img_priv *img)
}
#endif /* CONFIG_ESBC_HDR_LS */

-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)

static void install_ie_tbl(uintptr_t ie_tbl_addr,
struct fsl_secboot_img_priv *img)
@@ -434,7 +434,7 @@ void fsl_secboot_handle_error(int error)
case ERROR_ESBC_CLIENT_HEADER_INVALID_KEY_NUM:
case ERROR_ESBC_CLIENT_HEADER_INV_SRK_ENTRY_KEYLEN:
#endif
-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
/*@fallthrough@*/
case ERROR_ESBC_CLIENT_HEADER_IE_KEY_REVOKED:
case ERROR_ESBC_CLIENT_HEADER_INVALID_IE_NUM_ENTRY:
@@ -571,7 +571,7 @@ static int calc_esbchdr_esbc_hash(struct fsl_secboot_img_priv *img)
key_hash = 1;
}
#endif
-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
if (!key_hash && check_ie(img))
key_hash = 1;
#endif
@@ -705,7 +705,7 @@ static int read_validate_esbc_client_header(struct fsl_secboot_img_priv *img)
}
#endif

-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
if (!key_found && check_ie(img)) {
ret = read_validate_ie_tbl(img);
if (ret != 0)
@@ -851,7 +851,7 @@ static int secboot_init(struct fsl_secboot_img_priv **img_ptr)
return -ENOMEM;
memset(img, 0, sizeof(struct fsl_secboot_img_priv));

-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
if (glb.ie_addr)
img->ie_addr = glb.ie_addr;
#endif
@@ -952,7 +952,7 @@ int fsl_secboot_validate(uintptr_t haddr, char *arg_hash_str,
else
ret = memcmp(srk_hash, img->img_key_hash, SHA256_BYTES);

-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
if (!hash_cmd && check_ie(img))
ret = 0;
#endif
diff --git a/include/fsl_validate.h b/include/fsl_validate.h
index 252d499e7b1a..7798a6e657bc 100644
--- a/include/fsl_validate.h
+++ b/include/fsl_validate.h
@@ -69,7 +69,7 @@ struct fsl_secboot_img_hdr {
#define MAX_KEY_ENTRIES 8
#endif

-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
#define IE_FLAG_MASK 0x1
#define SCRATCH_IE_LOW_ADR 13
#define SCRATCH_IE_HIGH_ADR 14
@@ -155,14 +155,14 @@ struct fsl_secboot_img_hdr {
#define MAX_KEY_ENTRIES 4
#endif

-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
#define IE_FLAG_MASK 0xFFFFFFFF
#endif

#endif /* CONFIG_ESBC_HDR_LS */

-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
struct ie_key_table {
u32 key_len;
u8 pkey[2 * KEY_SIZE_BYTES];
@@ -217,7 +217,7 @@ struct fsl_secboot_sg_table {
* IE Table
*/
struct fsl_secboot_glb {
-#if defined(CONFIG_FSL_ISBC_KEY_EXT)
+#if defined(CFG_FSL_ISBC_KEY_EXT)
uintptr_t ie_addr;
struct ie_key_info ie_tbl;
#endif
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 14823f42e61e..0a0be8f05f00 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -38,7 +38,7 @@ CFG_FM_PLAT_CLK_DIV
CFG_FSL_CPLD
CFG_FSL_ESDHC_PIN_MUX
CFG_FSL_FM_10GEC_REGULAR_NOTATION
-CONFIG_FSL_ISBC_KEY_EXT
+CFG_FSL_ISBC_KEY_EXT
CONFIG_FSL_PMIC_BITLEN
CONFIG_FSL_PMIC_BUS
CONFIG_FSL_PMIC_CLK
--
2.25.1