From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7403DC433EF for ; Thu, 7 Oct 2021 06:25:38 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D1CC661260 for ; Thu, 7 Oct 2021 06:25:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D1CC661260 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de 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) 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-Google-Smtp-Source: ABdhPJwBctKWwCXn23WZkIoomi3+lkTVTIt+jAH82j10ltWuzsvXihc/7f3NF4XEU5RgcxvcrJL9PQ== 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 Content-Transfer-Encoding: 8bit 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 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 -- 2.33.0