From patchwork Tue Nov 16 04:32:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 519174 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp6620094imj; Mon, 15 Nov 2021 20:35:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwP+NKn4D+tWQzJC1eKAaH9B0hpq79NvNL12Npp2h3zmBxwWOHgyv7o6I66VmBFFLRqLDDW X-Received: by 2002:a17:906:8256:: with SMTP id f22mr5830997ejx.207.1637037345589; Mon, 15 Nov 2021 20:35:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637037345; cv=none; d=google.com; s=arc-20160816; b=ibE1p6MHFd/Ek91Xht8DoM1TiI7t3hmoJNMV9HmZ8etR8EtFe1uxWEhXoXJbbjU6qP fvD4N2xsdD1slaGD0n1/3NmqOqWFOOwY0a6gZvaFZHK1+XvZ7ZEPx/MwWzJuMT0PwmD/ h1O253YyWGhNjcTO4aQrqwUyuv+U7W1IpHZOUe8yo2Oo3VKlWkGVkWgwlcJkp2qgIQ/C 6hv/Y5zU55Ny315hNeMPQv/gE7nlau+AxdpPPVJcz9oNqcvl3iPCppi49nPAgl9CcPr0 JAdOjGcGD/362KLtcjMk44UfjPd8Pq3qbwflMJkq6wJZUooW1OJTPw98unDO7qoGKpq8 a4qQ== 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=lzGqxKtdPvEjH0+bZbJL5t2huljRp2Rq5t0lD87cc1q/2oKmo7gqz8c3bX+gUjXWqU XB8YQbik0dmqRjUX4RpmU8GM80Vzu0YaWGRTP9Tx0t/QBUu0nkTj8sQwrXxiYIyO0wX6 XkFiYCJGhusBaGjs1DswIgCzVbBaDQg0NtQdqSp+kSCZ3VDARorUS135TakingfG0Bfo Pz8gWjeF3GVtdl8yVhENPGUujsRfj6Se8RHxAHbpAys7T7RZsAOwr73Yi9WFtKdo4wDm Ihm7L8oRhahj+TfW0JXD3NDfXQxH4Rd97uBSkVoXlEvhffQVcigveF3XLhXIqleKC5yX 9v5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t1vLXCkH; 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 jz8si32708272ejb.160.2021.11.15.20.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 20:35:45 -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=t1vLXCkH; 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 8371783824; Tue, 16 Nov 2021 05:35:29 +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="t1vLXCkH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 314DB837EC; Tue, 16 Nov 2021 05:34:04 +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-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (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 57AFC83809 for ; Tue, 16 Nov 2021 05:33:54 +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-pj1-x1034.google.com with SMTP id np6-20020a17090b4c4600b001a90b011e06so1706262pjb.5 for ; Mon, 15 Nov 2021 20:33:54 -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=t1vLXCkHB0mFkqjb9hFw1Y9C4OMXzJd9DmxVhobFbn6mDztZMtzS2FyZ7z8eLjsXQ5 XSj9+mMKIFAXb7CdGtuDe7BWT5ocFSfOiWB+StlK9ZSG2mgKwve2bGASBjnKoqtJYOQ2 QnXLedTv3yG0p26D3ZeJwOmifF9XJwZ6jOkpkHyT9Czom6VlGftWb8IsDX9dq5t70hPO tOw0MO25qqyO+OW3uZxZRy8OAZlXeH+6SKGXdV9L8RUHVq1ks9r5Cvgrp5O7KBtRZPok Zm88/R0HCFaHFZic6kHeh2PpJ6ZsMJXV91CG+G0jhSY3hxnz5/7t7MmTM+x+Iqal+E8F azMg== 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=sySi7L2LGVD3QhbHXYu4LmcEpTmCd3PybtIEUTImgzg8uAXB7CS/+0PBZU+Mhi4LMp 0W1mZleCHECsKxw6KbSCobS4POR+fG3ohXokTyTNSLkHdYJjASxpNifS/uU0LQwcKSqh 8bDeBWX/JnEQDycNcBMNATRXtodT1IJOmxc3U0pa/A5iP9lrOz8JWEJdU+E/CN/MCSaR OloI5zP4gI+3ZGOEVro7GA2D+czkI4SsSSfPmoYdXZjjJf74ZqP09MFoJoFJFpNoJTxi 5/dC3fJdXbDlBCQa+XtSdXMR5odW2aZLMKOHwU+/sPykNvd6ag4QJwoP4wo2sEOXdWbG E0xw== X-Gm-Message-State: AOAM533Q2vD0Xp8r+5bPRcwDvWGXorkTiK1D3tQs7YGbZnAa/hRR7pwC +iaxzXaoxHNte19UKxzLrhwbpg== X-Received: by 2002:a17:90a:a513:: with SMTP id a19mr72795097pjq.26.1637037232650; Mon, 15 Nov 2021 20:33:52 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:d07c:c772:1ab9:a9e0]) by smtp.gmail.com with ESMTPSA id lt5sm782914pjb.43.2021.11.15.20.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 20:33:52 -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 v7 12/12] (RFC) efi_loader, dts: add public keys for capsules to device tree Date: Tue, 16 Nov 2021 13:32:38 +0900 Message-Id: <20211116043238.67226-13-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211116043238.67226-1-takahiro.akashi@linaro.org> References: <20211116043238.67226-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.35 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