From patchwork Tue Nov 2 00:55:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 516609 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp3917544iml; Mon, 1 Nov 2021 17:58:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGpYQpiXXMYD6l2btZNihhAo/X3Yf4nsF7/CUjlSG1AoHhmKd6YIb3s1SgWfTE22LO0418 X-Received: by 2002:a05:6402:1c95:: with SMTP id cy21mr24353073edb.320.1635814696431; Mon, 01 Nov 2021 17:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635814696; cv=none; d=google.com; s=arc-20160816; b=k9T5PR7qzu9D+ZwTqi3EJRDNqMBMAlJHmTnO+BbRP77nFcciYq5y+/NyRHk+lkAlP4 bVox5UFAIZsdF7VTWaTg6FxNql9M9Gm8GpAqf38OZKh/11+BdYSEbcG8Itf075y3S5Px TstiXjWOJF6Cvn9qgLSWlIUlfv7on/W9Olc1xt3bqmfyJhE5y3P2x4+84PJzmyCz7jSu WwNAKvnde8ma38dJC3UFoUvMmdYdrHD+2IV2Zk8qFvvrqnRReeYDmYCEECI7dWNoY7Gf WF5GGroxw8Lj667YVgX2aCDt+wfDMKtSHBtcfjPpsMPOoorUrRnPtia0/bOfTfFXiKCP SwjQ== 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=NgUeZKXL6rdTYp6VVK+mWUWIs3hmFY5B99O27bNfw13SVbzTUYFblwXQgrrcYObhTf TwMHX6W10qmswlNfIF67gQ6GcCsS5rVNqNN7ycOrJnmTyZsV9JXVY2kagt09ad/EzkZp ElSf5SQjwwhKcAYwLEHShd7Zm/tBPawYvtNJlP9XCXRoTZaGDg64IAGTYlASS/H+KyoD byTAJocCFwdnS8hJqQ/aueSlJW+2hWKJkVzJbX5hKoKLEJ+FYQf2dgMgbiA7kDpzuycq lhyvjAerk1nwLQKn2RIPngtBiyhwd8929mu3j6JBb8I8nLHBNuF7kE8JZOF5uqC1jtuu F1UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FqJfOdAv; 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 hs5si28495760ejc.359.2021.11.01.17.58.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 17:58:16 -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=FqJfOdAv; 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 E771083632; Tue, 2 Nov 2021 01:57:45 +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="FqJfOdAv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8B94783613; Tue, 2 Nov 2021 01:56:50 +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-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (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 114308352D for ; Tue, 2 Nov 2021 01:56:23 +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-x62a.google.com with SMTP id u17so4226347plg.9 for ; Mon, 01 Nov 2021 17:56:22 -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=FqJfOdAvf6YDnla4NPe3bLqGo4YlkgHl1nTsqPtYRT/IrMpK7MG6o7X5CWnCjdoK+S 8+4lnl9MkFPTRTUEYs/F3eOAFIXbx+bR09mcL1AqAOVK31nrN6dw/1aTqN900Wqlc4hD GT/Hmc57LBX2HO1YaYWXIBAb0nlyp55/5ktp5Ewhg7xplwZY02E+lhfHXaUE8mOhbG7t 8RN8YvC4hE8ZlVbqpm9l73bcwaGyuPO4Be3fpmntGfW/c/RfUNVflA46LrqDf8LrFXCf GkIobVuELzlSB/SpmWjecy/OTN0mSGyJUxQ23hJ1c9cd7H3HDTu7C5cXHDXIN1rml1lB TBTA== 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=GBf+qA/mYLWlBQYv9VQuij7Dc61E3AzjnXC0Agk17bIb2H4qJBRkySa504hEbNqJgs 8FD1gmJGuMY14ap/c6yyGBgfmun4SMOz8FuQnSNxv+kZxGUY4Vnv/1+UtEKvI9jTMnbI z+hc2tZK8s8JHBURLypy3cGceOKmBvBMwiftW0eiAH34jrI8b1JGT9+AL2+wT0d3rLQK a2kEXfDq9djXsm+Jw87SfHoOKMN4cK4vuWJCQl4HZaO8rWJhW9hTxnhLJjtjSIVRXrOz VqTxDKbkbslis6SurQH2RyNgamJDPFPfVfglX9FB7ZmAVv5SYP7AWL28MBbz5EFj5Wzy R9/A== X-Gm-Message-State: AOAM530/lwPeNXXFyreFNu+VzrYltWvzXM+/RJVUqSmRkpdFv+QjvB7Q udglXX/6oJO/MWIJPdQPBf/lmA== X-Received: by 2002:a17:90b:4f88:: with SMTP id qe8mr2605473pjb.223.1635814581398; Mon, 01 Nov 2021 17:56:21 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:a475:65cc:d4b7:aaf5]) by smtp.gmail.com with ESMTPSA id n29sm12305596pfv.29.2021.11.01.17.56.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 17:56:21 -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 v6 12/12] (RFC) efi_loader, dts: add public keys for capsules to device tree Date: Tue, 2 Nov 2021 09:55:12 +0900 Message-Id: <20211102005512.96019-13-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211102005512.96019-1-takahiro.akashi@linaro.org> References: <20211102005512.96019-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