From patchwork Thu Oct 28 06:23:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 516365 Delivered-To: patch@linaro.org Received: by 2002:ac0:c404:0:0:0:0:0 with SMTP id t4csp1371707imj; Wed, 27 Oct 2021 23:26:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSHHlTQrcKVA3E/N4Y98UEcoZ5fy08HukKTX2eC84aKq7zmo4sokXefdlLvfRLmnQbIdwG X-Received: by 2002:a05:6402:350a:: with SMTP id b10mr3522923edd.345.1635402418435; Wed, 27 Oct 2021 23:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635402418; cv=none; d=google.com; s=arc-20160816; b=XX0L8WnKonmKGEK0Xdz3dT++xrVlJ4G1NMOT3ExOlaU85HK0MhH72ywzOpgFIVsbBx pVjjPdohQlxejEl/VgPuZHeu+6TSD5KLjV3XsIrMByXo0rZOrQ5l++hxrYglf11HAQPX pLstmVOfhcna1O2IWAT22COEoawmknmeF4PZKUiR2jMu++C442ro4jOe2HD7sA3X+yyQ mBEhF4a62Jm13cRFsqYaFMti4+IqnQqD0DuJixTZU8n9QRQrUYg5TAJ/o28X2219tmOz sFxwWudkS8LZY2EQ/XFvc6OCO/6jT5un6w/UECZEJ/qA5mVXd2vR6EWNm7L4EvggN39n eB4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6iiymLorAL8Tnpa1lqZvk6MLjBUdYK7Mr5qkX19bD18=; b=DCWBbQxjuMfXJccXxtOZlZamsY/Piwk4xmPjZIukQdvs0HxcgMUYdRlxZAZc2sBFwk Yco05Il0c7YVZrxHptk4rivIfNJzl2JYZTrNfEylgbpzGwYHdYGpmYW81g91AOOcjKyn +fzMQwCuQSHhP9r/4JalAt3Y08jSMIsvOM3h5Qye5dr6nBwn/UPS8qZYRsgrVRNeCdLZ 3Dbq42D+9subPyFIwUNL9Dd4XctDezNtAdtSSYneGA6B6NuOe3NTGkJUmVwhkPI4IDKr FpmlQe4DBZLM8YnLI/knGvxja2sdW2G6/X7im/JwZpsMAqDGcsia17GZBKoJlqcbI/Hd fH3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QyQKHuVZ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id g3si2914969edu.245.2021.10.27.23.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 23:26:58 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QyQKHuVZ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DC5F48358B; Thu, 28 Oct 2021 08:26:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="QyQKHuVZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9F0CD82F33; Thu, 28 Oct 2021 08:25:38 +0200 (CEST) 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-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) (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 5DF6C8347C for ; Thu, 28 Oct 2021 08:25:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x52c.google.com with SMTP id l186so5395913pge.7 for ; Wed, 27 Oct 2021 23:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6iiymLorAL8Tnpa1lqZvk6MLjBUdYK7Mr5qkX19bD18=; b=QyQKHuVZtbwkTroabVizOKwkxwYyIE55N5YgnKFeo6WMyYK4iVtR1p7Ipzv2Zslrjv nvpTpAQprl7QpcU+N77zCmscdW9ss3YJ1VLT0pUc/MZJutrsdF/gNiQJZI3N5SbkLFkr w6BQcR16HZLZQnaTr+RDVopUkLOeU20ak89WMR6zI/sINGvqswROd4WAS7Inb/AaPIP9 oreqN2qlSAWlDfh7qTSCK41W/6ShqvFI3sAFz9V4ASGb17aWnol0nkBJqkia7ibwkHUB 5p4uwT9DLuYEsqzT11WTd9tHpYelicss3NBCqZTb86bzbhmKZ/trlfZPO7of6/XRnZ7+ /d4Q== 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=6iiymLorAL8Tnpa1lqZvk6MLjBUdYK7Mr5qkX19bD18=; b=J/oUGhYwZFvw4n1NYJWQFgQRhiiZkHNPuKdSTFAMIKfiDLpUS9OVAVjlQ7W33A5JLZ yhglVtdTF9s9L2E2TsumugZr1FYiTWrTLPAiRh+xAQAyI5837Iwo9hSKzAMPJjSsLjtN 1505nDP9PITWsMMRr8C5u68vbrv+iu8uTnPvl6oQaxM5F1xikmo1VPxmu2iedTS2j63d Mr4xaj3Ay1HN4+jpRmw8bGhMAtG/PFFm2Ur4ul3sJtAItYP0FG86oT2lxMzSga9pTSH8 RwQEZIizol3aDfKiEB9GSi4JmD7TM7iZvQyVSFQdiQFb1yQZ4/rNt2JCBnLwqRjwrsuT Ql6g== X-Gm-Message-State: AOAM530kGuNUlxBkjcMGqRjALYj/1Enm3R3x+Q/QT9QmA1Nq1ArlIrt7 HHDSnlUpDoOxQsIsrsYxHPiu5g== X-Received: by 2002:a05:6a00:24c4:b0:47c:354e:b19 with SMTP id d4-20020a056a0024c400b0047c354e0b19mr2359555pfv.33.1635402326749; Wed, 27 Oct 2021 23:25:26 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:394a:97ee:bbbb:462e]) by smtp.gmail.com with ESMTPSA id p16sm1582018pgd.78.2021.10.27.23.25.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 23:25:26 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v5 11/11] (RFC) efi_loader, dts: add public keys for capsules to device tree Date: Thu, 28 Oct 2021 15:23:56 +0900 Message-Id: <20211028062356.98224-12-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211028062356.98224-1-takahiro.akashi@linaro.org> References: <20211028062356.98224-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean By specifying CONFIG_EFI_CAPSULE_KEY_PATH, the build process will automatically insert the given key into the device tree. Otherwise, users are required to do so manually, possibly, with the utility script, fdtsig.sh. Signed-off-by: AKASHI Takahiro --- doc/develop/uefi/uefi.rst | 4 ++++ dts/Makefile | 23 +++++++++++++++++++++-- lib/efi_loader/Kconfig | 7 +++++++ 3 files changed, 32 insertions(+), 2 deletions(-) -- 2.33.0 diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index 54fefd76f0f5..7f85b9e5a4a6 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -347,6 +347,7 @@ following config, in addition to the configs listed above for capsule update:: CONFIG_EFI_CAPSULE_AUTHENTICATE=y + CONFIG_EFI_CAPSULE_KEY_PATH= The public and private keys used for the signing process are generated and used by the steps highlighted below. @@ -392,6 +393,9 @@ and used by the steps highlighted below. }; }; + If CONFIG_EFI_CAPSULE_KEY_PATH is specified, the build process will + take care of it for you. + Executing the boot manager ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/dts/Makefile b/dts/Makefile index cb3111382959..6c5486719ecd 100644 --- a/dts/Makefile +++ b/dts/Makefile @@ -20,11 +20,30 @@ $(obj)/dt-$(SPL_NAME).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE mkdir -p $(dir $@) $(call if_changed,fdtgrep) +quiet_cmd_fdtsig = FDTSIG $@ + cmd_fdtsig = \ + cat $< > $@; \ + $(srctree)/tools/fdtsig.sh \ + $(patsubst "%",%,$(CONFIG_EFI_CAPSULE_KEY_PATH)) $@ + +ifeq ($(CONFIG_EFI_CAPSULE_AUTHENTICATE),y) +ifneq ($(patsubst "%",%,$(CONFIG_EFI_CAPSULE_KEY_PATH)),) +DTB_ov := $(obj)/dt.dtb_ov + +$(obj)/dt.dtb_ov: $(DTB) FORCE + $(call if_changed,fdtsig) +else +DTB_ov := $(DTB) +endif +else +DTB_ov := $(DTB) +endif + ifeq ($(CONFIG_OF_DTB_PROPS_REMOVE),y) -$(obj)/dt.dtb: $(DTB) $(objtree)/tools/fdtgrep FORCE +$(obj)/dt.dtb: $(DTB_ov) $(objtree)/tools/fdtgrep FORCE $(call if_changed,fdt_rm_props) else -$(obj)/dt.dtb: $(DTB) FORCE +$(obj)/dt.dtb: $(DTB_ov) FORCE $(call if_changed,shipped) endif diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 52f71c07c991..d12b1e56ae80 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -208,6 +208,13 @@ config EFI_CAPSULE_AUTHENTICATE Select this option if you want to enable capsule authentication +config EFI_CAPSULE_KEY_PATH + string "Path to .esl cert for capsule authentication" + depends on EFI_CAPSULE_AUTHENTICATE + help + Provide the EFI signature list (esl) certificate used for capsule + authentication + config EFI_DEVICE_PATH_TO_TEXT bool "Device path to text protocol" default y