From patchwork Thu Oct 7 06:23:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515430 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp1004163ime; Wed, 6 Oct 2021 23:25:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHPcUg2LIH0MNS7cHSQnDbZstO/jfNXiNC0PpVOo5AsgQsSGefVVDw145BkOpcBV+hZpxn X-Received: by 2002:a17:906:a01:: with SMTP id w1mr3490402ejf.117.1633587938334; Wed, 06 Oct 2021 23:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633587938; cv=none; d=google.com; s=arc-20160816; b=wJ/9bH3wxrxFZu2LoAWYUhRjtDndM+pzJVuCK8vF0Gf2kRs7XRfP43sHdTkb5RuLfP HpHmwg2EJRz64Ih2wKteBafickECu/5KdEhzdYqE0iZ1IWPWmXeVXsFTaGEx+OZ1iLqq SYQSs3FAR/YiDz1UvEat+uTbq/xXBVLuCG+eV5v8BiA2MceYbJnqRelxN8i4cqfhIFJc kyzqvBfzTcf6wDDLGvP39yVeUNJ/YgO4b+II4zk3OrD5TZt3aCqEw41I3pGOahkYJjSE CQ7xSXQSgK/aVy7velXovh3g8WioLC6rLYE/GpbgCDKam1vlV7s3lifuRUXVQAn7+WIj 3Z+A== 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=2fR+FH/JMkjIYaH2O1UrXUs6WSCJ6VHMd8CGn+xH3Eg=; b=IN5QQ3j7y9u6eLENe1G1U2/7CUIvLXiTGcquq3GKkOtTOBgAkOVx8Djs4WHKWigazA edm66WQA5phbnzEtbgHIqa0VnzyGA612XhITM//KGjr3vTRLf2d8hB3ANg8m1bwixGet ROgSflYQmRp+z+4dwxoz2P4Gewugay0k+/XTkEQxpFpj4jDUAnZSZUnuZoLtsqKdKbzb Q/n1iJXFeogSWHgdT/NTuRII7XhFjarXb9PEmHoT5NRPGGs6uVzUBmmJgCwhRRksVyAC kglSimrbUjHe9CkyAKdtbDoD/fJxdks4rLxhAvrdqzNydCPdHKA0gYoyPHsRjKgRo8XU dPbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kya0vqqa; 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 c10si18670124edm.262.2021.10.06.23.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 23:25:38 -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=Kya0vqqa; 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 F36FF834BD; Thu, 7 Oct 2021 08:25:25 +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="Kya0vqqa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 89E048348D; Thu, 7 Oct 2021 08:25:22 +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-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) (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 0A6EF8348D for ; Thu, 7 Oct 2021 08:25:18 +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-pj1-x1029.google.com with SMTP id k23-20020a17090a591700b001976d2db364so4299569pji.2 for ; Wed, 06 Oct 2021 23:25:17 -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=2fR+FH/JMkjIYaH2O1UrXUs6WSCJ6VHMd8CGn+xH3Eg=; b=Kya0vqqaArTybjVVLTkpGFCrT0N/NdQUptzt82cgYlPKsYQrHX3MyW/0j06gnANBa9 gXMkhdFmYHOugJdDmGVGmKm8BdQe7lS/r9Q9sJafKa2svcQSsDN5tLgT7D/nJf8UG+Ut FpJUywZ59x3p1YgVt0BBsCffdk2Z2QFcybo7LnyGj1R+9ny/zghHnxN/uDJPkKrqZTN6 0mrzCJ0HBenVgorTOpMaiFfzrMyt8iO+PXh0lg4FnGVxFSpnBdSVLEF5W/6/ntd4PbIg cBcxxBzU+xsKEVlSt0GU5avxqyCV7fGm52hABAbacONzk607EUrsKh7iPkDoeAzV1poK 7Ubw== 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=2fR+FH/JMkjIYaH2O1UrXUs6WSCJ6VHMd8CGn+xH3Eg=; b=tcLIjxc6Mqh2DUwPP4Aiau4q5eXhh+xmOTQ4frPBUXVvCmkxWe+5VBl34mn2YBmeED GVJtjBiYrnSyOfPdmPjUKtTHVUfTgDI8wiZeUNortl7oc3b2rzNOmlPUBWzTA6swUoVY vaJCHLEmcxeMQA9IRsiFRXpGwbVPhxUJb4P5ipMEWOOGuvHSfwY8ROfv5dBtQnzJO/xz MapcIvKYN6j0DWUQudZwVPD+F9QUmKfX8cV1lHTbQ17TNC2vUsiZXi/W8B1RYZWuqliW Yg6MYCv/El1Z8E5nCXul2QOxE5ls9foY5amDewkFuvmrHk9Q55UNUEl7uPGcgH0Fq6/v EUOQ== X-Gm-Message-State: AOAM531HQLCrt8ubpYu+Cj9XXujiBBruRnYw1dGzl3nNEWpXonJwDyvD Zi52CbdlHAgqajZScNLSdqI8Kw== X-Received: by 2002:a17:90a:8b82:: with SMTP id z2mr3405877pjn.216.1633587916191; Wed, 06 Oct 2021 23:25:16 -0700 (PDT) Received: from localhost.localdomain (122-100-26-39m5.mineo.jp. [122.100.26.39]) by smtp.gmail.com with ESMTPSA id b17sm22131859pgl.61.2021.10.06.23.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 23:25:15 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v4 04/11] tools: add fdtsig.sh Date: Thu, 7 Oct 2021 15:23:33 +0900 Message-Id: <20211007062340.72207-5-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211007062340.72207-1-takahiro.akashi@linaro.org> References: <20211007062340.72207-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 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 -- 2.33.0 diff --git a/MAINTAINERS b/MAINTAINERS index 5370b550648e..650e428b6cb4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -713,6 +713,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..5ce7357614d7 --- /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 { + capsule-key = /incbin/("ESL"); + }; +}; +EOF + +sed -in "s/ESL/$ESL/" $SIG.dts + +dtc -@ -I dts -O dtb -o $SIG.dtbo $SIG.dts +fdtoverlay -i $DTB -o $NEW_DTB -v $SIG.dtbo +mv $NEW_DTB $DTB + +#rm $SIG.dts $SIG.dtbo $NEW_DTB