Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46BDBC433EF for ; Fri, 17 Jun 2022 20:24:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E2B2E843D2; Fri, 17 Jun 2022 22:24:45 +0200 (CEST) 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="nZGQkK0r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7831084386; Fri, 17 Jun 2022 22:24:41 +0200 (CEST) Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (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 2461A843FD for ; Fri, 17 Jun 2022 22:24:39 +0200 (CEST) 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-qk1-x732.google.com with SMTP id o73so3943199qke.7 for ; Fri, 17 Jun 2022 13:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qhFEL8HNFwZHkvbr2I0GrU/cye+laDmO/ktZRJh8M9k=; b=nZGQkK0rG23OImItd5OJhp7rfh9lpLv25qupzwYehpcBUuk6Ew9l8K45zf4dGzutie GuBGkweWADZHCzQ7LAnwCwZkxvi/o5/weiJHBXPIMaMhSiRhjyWz6szLj7RGGddXiymr rTzOmL5VsBZQHA2/j8KKCFHobdJpukeyF3yTA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qhFEL8HNFwZHkvbr2I0GrU/cye+laDmO/ktZRJh8M9k=; b=SAq9GwkluNlShn0/D+VwPYnHj/NnlkfmsUTICDZhwoqdmpSdqANt7bDyPfdBwJMKjJ LC6SVbAMIFF6RnqkDu5uZkevu/46zhft3TupwoHYO1vBZt1YelJzKaVB4aLBgh1OYal9 SyEV4TCHiIARtQwqP28N3v9Tgg7tcw7GRjfeDc8EvNQ48FLu66YOvS6W4qzBDmT9/rCa yCqAAahFPtwutlfm3VRS6yKHQ+TsucRXXILQjlNC7WZoHUB3aN78gcA1HlQ3XFZVBi0D Xu16X4D/MDXUN5bbE424oVbuumuW736tSvvyKpzC/Mt07ox+5UBXGMQVtzP+tZY/O7RT UiEA== X-Gm-Message-State: AJIora/gR+BowO1uxBKAzBUejieqWmwXNkY53VRBa5qgEeMtWfDlA1zq zkjR9bx1XQw8qf/4Ky2uFHZFi9WHATZnyg== X-Google-Smtp-Source: AGRyM1tGkY/8amWz1wKosHLZ01KRd8zDO8PEa709qT0RTkyzQBUqd+bHyXR17BAkFe5h7Qe4v8AZvg== X-Received: by 2002:a05:620a:1b9a:b0:6a7:4d71:bb28 with SMTP id dv26-20020a05620a1b9a00b006a74d71bb28mr8501143qkb.236.1655497477565; Fri, 17 Jun 2022 13:24:37 -0700 (PDT) Received: from bill-the-cat.lan (cpe-65-184-195-139.ec.res.rr.com. [65.184.195.139]) by smtp.gmail.com with ESMTPSA id i21-20020a05620a405500b0069fe1dfbeffsm5431850qko.92.2022.06.17.13.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 13:24:37 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Cc: Peng Fan , Priyanka Jain , Kshitiz Varshney Subject: [PATCH 2/4] fsl_validate: Migrate SPL_UBOOT_KEY_HASH to Kconfig Date: Fri, 17 Jun 2022 16:24:32 -0400 Message-Id: <20220617202434.1182740-2-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220617202434.1182740-1-trini@konsulko.com> References: <20220617202434.1182740-1-trini@konsulko.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.5 at phobos.denx.de X-Virus-Status: Clean Move setting of SPL_UBOOT_KEY_HASH to a non-NULL value to Kconfig. As part of this, change fsl_secboot_validate(...) to check that it is passed a non-empty string, rather than non-NULL. Cc: Peng Fan Cc: Priyanka Jain Cc: Kshitiz Varshney Signed-off-by: Tom Rini --- arch/Kconfig.nxp | 11 +++++++++++ arch/arm/include/asm/fsl_secure_boot.h | 13 ------------- arch/powerpc/include/asm/fsl_secure_boot.h | 10 ---------- board/freescale/common/fsl_validate.c | 2 +- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/arch/Kconfig.nxp b/arch/Kconfig.nxp index f72c513aa6a8..5ec0ee076eb1 100644 --- a/arch/Kconfig.nxp +++ b/arch/Kconfig.nxp @@ -63,6 +63,17 @@ config SYS_FSL_SFP_VER_3_4 endchoice +config SPL_UBOOT_KEY_HASH + string "Non-SRK key hash for U-Boot public/private key pair" + depends on SPL + default "" + help + Set the key hash for U-Boot here if public/private key pair used to + sign U-boot are different from the SRK hash put in the fuse. Example + of a key hash is + 41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b. + Otherwise leave this empty. + config SYS_FSL_SRK_LE def_bool y depends on ARM diff --git a/arch/arm/include/asm/fsl_secure_boot.h b/arch/arm/include/asm/fsl_secure_boot.h index 09c88841e0c0..9c9e1dab9a41 100644 --- a/arch/arm/include/asm/fsl_secure_boot.h +++ b/arch/arm/include/asm/fsl_secure_boot.h @@ -8,19 +8,6 @@ #define __FSL_SECURE_BOOT_H #ifdef CONFIG_CHAIN_OF_TRUST -#ifdef CONFIG_SPL_BUILD -/* - * Define the key hash for U-Boot here if public/private key pair used to - * sign U-boot are different from the SRK hash put in the fuse - * Example of defining KEY_HASH is - * #define CONFIG_SPL_UBOOT_KEY_HASH \ - * "41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b" - * else leave it defined as NULL - */ - -#define CONFIG_SPL_UBOOT_KEY_HASH NULL -#endif /* ifdef CONFIG_SPL_BUILD */ - #ifndef CONFIG_SPL_BUILD #ifndef CONFIG_SYS_RAMBOOT /* The key used for verification of next level images diff --git a/arch/powerpc/include/asm/fsl_secure_boot.h b/arch/powerpc/include/asm/fsl_secure_boot.h index 9ae4c590f1d5..c062fa5c191c 100644 --- a/arch/powerpc/include/asm/fsl_secure_boot.h +++ b/arch/powerpc/include/asm/fsl_secure_boot.h @@ -75,16 +75,6 @@ #define CONFIG_SPL_SPAACT_ADDR 0x2f000000 #define CONFIG_SPL_JR0_LIODN_S 454 #define CONFIG_SPL_JR0_LIODN_NS 458 -/* - * Define the key hash for U-Boot here if public/private key pair used to - * sign U-boot are different from the SRK hash put in the fuse - * Example of defining KEY_HASH is - * #define CONFIG_SPL_UBOOT_KEY_HASH \ - * "41066b564c6ffcef40ccbc1e0a5d0d519604000c785d97bbefd25e4d288d1c8b" - * else leave it defined as NULL - */ - -#define CONFIG_SPL_UBOOT_KEY_HASH NULL #endif /* ifdef CONFIG_SPL_BUILD */ #ifndef CONFIG_SPL_BUILD diff --git a/board/freescale/common/fsl_validate.c b/board/freescale/common/fsl_validate.c index 34875d0b8f25..f1a0b0cfc34c 100644 --- a/board/freescale/common/fsl_validate.c +++ b/board/freescale/common/fsl_validate.c @@ -871,7 +871,7 @@ int fsl_secboot_validate(uintptr_t haddr, char *arg_hash_str, int ret, i, hash_cmd = 0; u32 srk_hash[8]; - if (arg_hash_str != NULL) { + if (strlen(arg_hash_str) != 0) { const char *cp = arg_hash_str; int i = 0; -- 2.25.1