From patchwork Tue Nov 16 04:32:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 519173 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp6619936imj; Mon, 15 Nov 2021 20:35:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEVhaC6BcNxO7T5NCXQuUiolg5pBqVaTK9kHrXpNMgaQxUAOjMEVEGtbgHLTFe0irkPMfp X-Received: by 2002:a17:907:7d89:: with SMTP id oz9mr5732859ejc.450.1637037334457; Mon, 15 Nov 2021 20:35:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637037334; cv=none; d=google.com; s=arc-20160816; b=ggJ/ixTnrqDxTyJPei3g/aBnj1MmndQ6NL8NXKxv2eZimTXAd5bggZ+wJPDhOgc9NB /TakgRaLLrpm/uVynIq+mMVboi1MnoX8bi3TArkT8ttfhnlAzgkzzY0OUNEM1gDId5tM XAKBodF737r7LHfFAzMDbpEiUvqANzKalZDO4CJE0lKO0OUq5eKulHuhV94dZPjfCj/T X6+MtDQYWtI6UM4WUD5JbAmkkNK8D370GIyr20zAAEEao4YacRyToYeb29QFgAVySoM8 6sF622+f8nXRjVj4puLhEXEgLz0lOo5dieHbnvz1F2BfgbDUPXSj6ZsowSVB9aBJsIs3 M5CQ== 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=rYuYsY1CHK5N10vJQnPljYwrrzsxsuZoNwthGvpXAYo=; b=rQmW//fDHpZIStTn0pp0m6N3jh03Gg4PAjvlx4xkCBbPJiG7QZn/LH6fSF/+qNT05C 6dmn3w1RxYPcYznTFeWyaD8gCppjoq8FBrqv0tRJMVWKPm245EkQyGWGRdtIMlyLrtdu 26B/dyrJhnsqcNAwFnnYywwcjhq+mFMrv57K3ZSBvSqo8/s+R3lOJbvZ7CyUm0jVDEzb yxjav6WosQnjWnOHSLbJwlutSYN+tbNMSj3uMZaJ7jW8DJ2Zq/xXyg4gTOAhRemzKuRx vlYlc19vkLuPRHLa8fmelplORtiv05bDGYniGbBHFDugR3LVQu8qhqOt5or3d2kU7G8p Y/ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x19raZ+I; 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 dt5si43090445ejc.402.2021.11.15.20.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 20:35:34 -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=x19raZ+I; 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 898B4837E9; Tue, 16 Nov 2021 05:35:22 +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="x19raZ+I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 09FA183618; Tue, 16 Nov 2021 05:34:03 +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-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (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 8B31083800 for ; Tue, 16 Nov 2021 05:33:51 +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-x102a.google.com with SMTP id v23so14681454pjr.5 for ; Mon, 15 Nov 2021 20:33:51 -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=rYuYsY1CHK5N10vJQnPljYwrrzsxsuZoNwthGvpXAYo=; b=x19raZ+IWNCcLKhoEwgOnysKWNrc+laTS6XIFy1Yl3HpiBx3EGhQ9uXb1hfPL1Zjs0 h6qf8VAmmIpVDCIOHIUh/fVE96iz+aUnrYUWnGg+TNQiG4xcSeZ03FJ4EiCZZzNdbGte Unki8Tc8aBkPAOLaRk/7oimbXHS9gSjbwZB9zdricfMqJaAgQe7XrB+iKvd73xo97XAW s777dPduuwETCfC/BZPvR+oicxzIzDwZepXM6kDQ6GbS3xYg7Q73z4aCTNgJrkuHsmCZ jRU9m3tDD5PWz2INPemwEjfGFaD7SfcVjhHJb8rts/N55OukXgM8pUnk66sKmnaXt9zz LGcA== 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=rYuYsY1CHK5N10vJQnPljYwrrzsxsuZoNwthGvpXAYo=; b=F8mY396BxdwRp8g9eWrp6WKoRVCUgymAeWJFJneQOCtXV7fd8lKyM2rmc9PUqcnktG fKV/AVaPJ7QHMlv0gvf+MpyNQi5m+T6sidi4aY06lYiVfSBlIfbk8WxzB7cluM8vwnEV dXsvfTzniGO/u0pQ4aEVx1yRRuFBXJRSU7hbwfjCFB+GEop9N+rtm4dRtgcaGxcJ9D47 ge+RiMEDZku7bIMbYfEFZPtBkgwZEihgbaMgb4CpsmhYkaCXsfeClOVXESy7FN4DEK6b Sz+nUmqY1TmXPYPPxf+oIDAk1lOCT7jGWp0fHhz0uxhf35RTInAgjydq7iHzXHsT45zR XNjw== X-Gm-Message-State: AOAM530wSop2W07iy3km48hQJTvtudzjZoO8elW1JwrQRogs6csIi7q9 NnWMXJisOZxpq4Ztaye/EBDpVg== X-Received: by 2002:a17:90b:3a89:: with SMTP id om9mr71773960pjb.29.1637037229673; Mon, 15 Nov 2021 20:33:49 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 20:33:49 -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 11/12] (RFC) tools: add fdtsig.sh Date: Tue, 16 Nov 2021 13:32:37 +0900 Message-Id: <20211116043238.67226-12-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 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 813674eb2898..8233a53c29dc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -742,6 +742,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