From patchwork Mon Dec 20 05:02:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 526051 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp3768985imb; Sun, 19 Dec 2021 21:05:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhvFAXU3IsFbTbhHapTJkLLIBWKmyw2m868N6O7aIp8iFvF8emXqa1m+/maf3xa3Njg1sB X-Received: by 2002:a17:907:76a1:: with SMTP id jw1mr11697461ejc.688.1639976758969; Sun, 19 Dec 2021 21:05:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639976758; cv=none; d=google.com; s=arc-20160816; b=NbZpZYX42R8qoXcDQk8lPE6bmEpN0+L2YHRMxmRr+/NnP0H8wcdcNGjr7+M3XJepR4 nEPU0aVffIcV+a3xZoD7ee75zbKiapIX5XbacwULYy//NMvbFuj5uq484DQ2XSh57U2Z ueIR5dSX1HJU/xrHMjDl4j1g2DOGFP3FHzYnenzqqX2+DJ0uiY1ZdWlyGkfC6Dw0carC ee73Os6Nda5HfovGwTxLdMHDKsDRrJ0g+NKq/sLax2qXhRwdUbNK5jbKXn9Vy/QcRvDr ffh3khduQ9+2CGmetZVLqznu2cUUkab4db7mmtjr3cB1eTtxtYyaEJ3g8BkPGLZvbLkg a8+w== 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=6Y6an3FgR2IWazNWCp6oy4xutrkKfynM74K7uqDogxY=; b=J8zHjTG4vDyh4HyaipPGUBhiZ+ooNGdNJCJcl9IZtloK6fLETqX3mn2nhc4zBn7n6a 7yax38n1ZsI33h6ojcd2T4Ge++JcDxUyyMG/3L17uPOrDwcgkk2M9XCYsJvxR2J9CyiK DBG3lnPgdGxPobGF9Vn0l/Z9OwcQj9uExG69VvscRnrYHK8nZO+PcCtHPLHbCLalgtTr GQf58A9DXQZ1rW92kR6rusxGnKfp4SfR7JVO/T9NzRn0i9eb0e1pO/OG0pzha4RD3xos Lthhg507lqZwvYIjuSsYgwcyibPIVLBDwGwuggDgLjNL/bproAQMl0VGqqgk/YZG6Kc3 Qwrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LdfDoHf5; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id r4si9435308edw.55.2021.12.19.21.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Dec 2021 21:05:58 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LdfDoHf5; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 9825A8350D; Mon, 20 Dec 2021 06:04:46 +0100 (CET) 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="LdfDoHf5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D5A583457; Mon, 20 Dec 2021 06:04:23 +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-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (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 BCBFE8307B for ; Mon, 20 Dec 2021 06:04:18 +0100 (CET) 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-pl1-x62e.google.com with SMTP id p14so687583plf.3 for ; Sun, 19 Dec 2021 21:04:18 -0800 (PST) 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=6Y6an3FgR2IWazNWCp6oy4xutrkKfynM74K7uqDogxY=; b=LdfDoHf5p/dKABUugOc1YmCtf6mM3YBvRJjSzPBIY83d9GXEYYo3PA2/qe5jtCJK4E dw9C+c2T/BbHo2BO2ygdeTHWVN+QnMOb3fn5txylP4FX2H7xqCOWlqbyNVHYuocfyA3F soyC7a+SuPWFfnbTi7adAwNAAY95KfvGuzCGa836E4Ew/bi4vXg+TGzICzLhx/JgTL8p XrBUCtMe1B2Ar4VXe3+LkUEAN38sRYrp/94eyPtvQtFQH1/XOD/pO0CjPkixevXWFn2o /ifg8aXSsM/5GXketPjRPFKsxGHw7+mccPXao/ZIujivGhMkDeLywVBtyoTAhP5D8cSD wAhQ== 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=6Y6an3FgR2IWazNWCp6oy4xutrkKfynM74K7uqDogxY=; b=fkefVUoRRZ8hMO8uVPDjzU5uYrkzuNNo0VR4ZPEA6nwS0O19KJ1+nzJuYMwC+9ghcE Paef00bLAMYjCQ7pPmzY0tHdHkN/LlVZCxZzr/DILRobafCos0+9GzC03C8Ye8y9HBmL OSj95ndi5QGjEjXig8KaJkV6ULsFGf8k8U5/afH6+3WHYGSIOYzZ0ojQGeCe3rvpXrj1 1hVf/m11iy85si38PzdC0nW0nZTuU6tppVm4mar0hKZtGQ7SeczTH6ZYtYNsyfHlp2Fk JV9FkzxoJpnXHN/o6jDsnsgIgB2XJ8Aqq6OS/0zKvCwlf1rlFNsXpdllW6OnlCCNNKhI Z2dg== X-Gm-Message-State: AOAM531TrjgWebxOmG5NoGdP27Hb2gOf8uvefWE7TknPAZUQgG3RypBw yEExEsHke0dZteZQZ3ZNHP7ICA== X-Received: by 2002:a17:90a:34cf:: with SMTP id m15mr19128461pjf.189.1639976657216; Sun, 19 Dec 2021 21:04:17 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:89bf:be4:468d:12c2]) by smtp.gmail.com with ESMTPSA id mu2sm4581163pjb.43.2021.12.19.21.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Dec 2021 21:04:16 -0800 (PST) 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, mark.kettenis@xs4all.nl, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v8 12/12] (RFC) efi_loader, dts: add public keys for capsules to device tree Date: Mon, 20 Dec 2021 14:02:53 +0900 Message-Id: <20211220050253.31163-13-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211220050253.31163-1-takahiro.akashi@linaro.org> References: <20211220050253.31163-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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(-) 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 700dc838ddb9..8c8d14d46433 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -209,6 +209,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