From patchwork Sun Nov 20 13:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 1706744 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.a=rsa-sha256 header.s=google header.b=e+YTq4no; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NFWrM0K7yz23n6 for ; Mon, 21 Nov 2022 00:41:07 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E94128530A; Sun, 20 Nov 2022 14:35:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="e+YTq4no"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 80C9185289; Sun, 20 Nov 2022 14:34:27 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E181785283 for ; Sun, 20 Nov 2022 14:34:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x833.google.com with SMTP id e15so5910958qts.1 for ; Sun, 20 Nov 2022 05:34:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=8wR34Y9IFqIpAQflEaqM0+ZCo9uG2wFCC+YHNs6FC9M=; b=e+YTq4noKrQcQwbh5nwyHAoBxx3fNXqfA8qE1T/mUVaMVtsH+eyZw2D6M8wtoGgMMT +ps6WUb/EsX9pf8ZSfR69ABPr4oIyxZMYwEnFzFsrSQNmlwqclVPAdcL0d+JpdH1TQiL A7Q5CATZYWty7CCc0+cEiFX0KNSkaPYAEyZg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8wR34Y9IFqIpAQflEaqM0+ZCo9uG2wFCC+YHNs6FC9M=; b=lFBzxvj4k0EYN/WjTwvDvnjEhfn0+GRtUhl9mEQw6rXcGNgKpjFabAs21KUi9CNM7i zqgpdp0EM1WVEf6Qy+eBp/+JbbuOTwob0BpHFUaPPcS8qaLB2TIocTsCvb+yIyWJi8mk 3y20w7AhKdoMNMGFtNuH2IakLZN08widr5CIeuJSeSD5hyd10L6Eig4naV4jIDOs7rG5 jT9UuTkmhu8vNMKvL2aJIVfPUE6EVuza5SSNgn2ETVD15rku2e8X9jFrrt3A1ae6zCW5 uUkQuvuQ4U05hnDdosh4yCWAya2oYktn2APuzSV5bEXFo6uYOBML0Lmy/EBFktJkr3g8 aPFw== X-Gm-Message-State: ANoB5plBWKnAPwBWunekOA9EjltycPIGJnbgyELIFLTAp2+4m2skouJV pJJqE9/2lEZpkmBX0l2n7ZNHkfc40E8Yuw== X-Google-Smtp-Source: AA0mqf5ef+N8OJOlL29UP/DBOCXcWyluRN4VbzrgbBU8PGwhnMpgJkUrwSblUV03NlUup1+kD3tnQA== X-Received: by 2002:a05:622a:989:b0:3a5:270c:fbee with SMTP id bw9-20020a05622a098900b003a5270cfbeemr14317785qtb.74.1668951262317; Sun, 20 Nov 2022 05:34:22 -0800 (PST) Received: from bill-the-cat.lan (2603-6081-7b00-6400-29a0-035f-b06a-235e.res6.spectrum.com. [2603:6081:7b00:6400:29a0:35f:b06a:235e]) by smtp.gmail.com with ESMTPSA id m21-20020a05620a24d500b006ce0733caebsm6487740qkn.14.2022.11.20.05.34.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Nov 2022 05:34:21 -0800 (PST) From: Tom Rini To: u-boot@lists.denx.de Subject: [PoC 038/241] global: Migrate CONFIG_FSL_ISBC_KEY_EXT to CFG Date: Sun, 20 Nov 2022 08:30:29 -0500 Message-Id: <20221120133352.3055600-39-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221120133352.3055600-1-trini@konsulko.com> References: <20221119234545.404563-38-trini@konsulko.com> <20221120133352.3055600-1-trini@konsulko.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Signed-off-by: Tom Rini --- 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