From patchwork Mon Dec 20 05:02:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 526050 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp3768871imb; Sun, 19 Dec 2021 21:05:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzgVPy4NEhOUoHM3u9BrRUnNhBzor2nMQPlhiH2ZaMcifx9+qM5uHdPPIyE+7cIPI+NSMj X-Received: by 2002:aa7:d619:: with SMTP id c25mr10045419edr.405.1639976748198; Sun, 19 Dec 2021 21:05:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639976748; cv=none; d=google.com; s=arc-20160816; b=fPyz39XvA9W+bykgTN4NIRShre1jkbt/pVjGyW+stV4QWe+597BXTXc21ZdHzjdyPE ZDuzeoyjj/H7LqtV/V/taGZ8RXqoqUfSXF/EnJ6jQmqVdt2qyU+m3h8GHXKIPt3Vc/ct PU6652xsuLp148kSmVXDmi6eEd0i0hPzM+LTxwMwIvwGs24hmK54l5412JFVWR9vN7Qy tkADzA7fccOU5sNomMzMYljWVoDuhYcNeIv3hBi5+Hvs17ROvVkQKjmOKOOVP9o1oyVS wi/4QBJRvM86fYlVjN5S/Yx1O08BOAARNCeS9CT9q1HBIOmQVZBDQ8rMlrpDx9nbBQg8 FGIA== 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=SM+IRbafxx8Qr/8kK8fKjePcwTpG3b764rPu/B5MUy4=; b=mOJllVqr2bd/l7N+QtHAfmF0WuoLijbrjdmwobabWMCHZHPdVjKXBACxOQcP1IbOAk bB9iZkE5zaTF9nA+CZNwaso9eoIeDSjwaGc8YfyqYUBPJZ0wNMlD5slaRnFlc/URSQ4Q /e4Ehg6pUBOIfc782JDuR2p9BTAucdyJR4Dir475pNGcQ6xyiCoX5iIXaQUpVYj150Tm EP3Z9neg79+tqEXNqlzV7yIFa8VNsEZBeSw2F2fPJV8AJ5I0ppXUxVGV+q2/xtZiFiVj 660wfCcfjl1IGiDkg1zJS2NoTPGkTer59Ai1ZTghPdl6URfgVD3EHw5Se6VxCD7a2EZ+ Q1Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LzzC9j1U; 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 nb10si9397410ejc.336.2021.12.19.21.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Dec 2021 21:05:48 -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=LzzC9j1U; 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 CA6D683494; Mon, 20 Dec 2021 06:04:41 +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="LzzC9j1U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E50A28309A; Mon, 20 Dec 2021 06:04:19 +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-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (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 9862A832DE for ; Mon, 20 Dec 2021 06:04:15 +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-x632.google.com with SMTP id q17so7127124plr.11 for ; Sun, 19 Dec 2021 21:04:15 -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=SM+IRbafxx8Qr/8kK8fKjePcwTpG3b764rPu/B5MUy4=; b=LzzC9j1UwBds7ADEFGCbgRs8mLZiocuWkI75F0c2+0wd3Blj4pxyS+3BZHb59w4ORU /X7CkHm84eSolapMCbZh0+rB0avJ6buZ2dVDLI2iLFXI8DQ++jzEYvuCsIm41u3fn3KT bIVTJwCTYe5VXK4qBqchpNwxJEOzcqKr9DJVLAapQKq4ZUAq3QzONp0A2HV26BAsT821 2kOYlZz1gJi71yHNUa2ZVdLpWCMRzhdabuKjrxZyOcMzDG8W/3Vf+7NCTR6PokkTdfH3 w1BoSrQVWLSgp+XilCYC+HiWj+V5skDdkZgYvVqrcYSkSi3GvKbFD3xZ/Zx2aINv27ME nbtQ== 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=SM+IRbafxx8Qr/8kK8fKjePcwTpG3b764rPu/B5MUy4=; b=nqWj7WpSLrxhMSPCIBv69fkDQ4FfmwYqpjiyRK05Haq+YCi+qrA2GwSm65jy3kMnCm BBXFTIAA+/sCSCfjjMF5Xe4vl8qyCfUZtdwfSohu00QdvHs2UDvwWwYZ4opERO4OIPn1 eIXop4FKQFQUWv6XP4AFhMQCDZ5vWapVY1hCZeS+fHERcPrtyjw/zOsCsfRqVWFAvEs2 UrhVnnX0Gu/7RGo146r2BvPiAdEZ5WMot1QyVR3kF9JER1DP7jeNMM3W2/39eyoLY7d3 owQ9BhOWDNssY6IoC6cXQEfuYLMi9COC+KcOmwtiCXb1WVhvwShLy2ZS92r0C3DMWLgT QZCw== X-Gm-Message-State: AOAM531iBEGMZFySv0dnMOg1cYcaetpsnufnKt+FkiS5i05UVeUnDRfQ K/osodazizMHYYERgfvUpUCwHw== X-Received: by 2002:a17:90b:4c44:: with SMTP id np4mr17848969pjb.195.1639976654027; Sun, 19 Dec 2021 21:04:14 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Dec 2021 21:04:13 -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 11/12] (RFC) tools: add fdtsig.sh Date: Mon, 20 Dec 2021 14:02:52 +0900 Message-Id: <20211220050253.31163-12-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 With this script, a public key is added to a device tree blob as the default efi_get_public_key_data() expects. Signed-off-by: AKASHI Takahiro --- MAINTAINERS | 1 + tools/fdtsig.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 tools/fdtsig.sh diff --git a/MAINTAINERS b/MAINTAINERS index 93ef5e297acc..e7cca02eac9b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -743,6 +743,7 @@ F: cmd/bootefi.c F: cmd/efidebug.c F: cmd/nvedit_efi.c F: tools/efivar.py +F: tools/fdtsig.sh F: tools/file2include.c F: tools/mkeficapsule.c diff --git a/tools/fdtsig.sh b/tools/fdtsig.sh new file mode 100755 index 000000000000..c2b2a6dc5ec8 --- /dev/null +++ b/tools/fdtsig.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ +# +# script to add a certificate (efi-signature-list) to dtb blob + +usage() { + if [ -n "$*" ]; then + echo "ERROR: $*" + fi + echo "Usage: "$(basename $0) " " +} + +if [ "$#" -ne 2 ]; then + usage "Arguments missing" + exit 1 +fi + +ESL=$1 +DTB=$2 +NEW_DTB=$(basename $DTB)_tmp +SIG=signature + +cat << 'EOF' > $SIG.dts +/dts-v1/; +/plugin/; + +&{/} { + signature { +EOF +echo "capsule-key = /incbin/(\"$ESL\");" >> $SIG.dts +cat << 'EOF' >> $SIG.dts + }; +}; +EOF + +dtc -@ -I dts -O dtb -o $SIG.dtbo $SIG.dts +fdtoverlay -i $DTB -o $NEW_DTB $SIG.dtbo +mv $NEW_DTB $DTB + +rm $SIG.dts $SIG.dtsn $SIG.dtbo