From patchwork Tue Jun 6 09:40:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 689692 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp2538154wru; Tue, 6 Jun 2023 02:43:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4FxMGZ1vLPEtqekCIG53RgytFo9UYQPdHB3OnnOHELPRJUPGZJXk9PYcShg0/YnqKA4L9j X-Received: by 2002:a05:6a21:1509:b0:10a:fad7:43bf with SMTP id nq9-20020a056a21150900b0010afad743bfmr1947451pzb.39.1686044626021; Tue, 06 Jun 2023 02:43:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686044626; cv=none; d=google.com; s=arc-20160816; b=gLQr3X/gD1NdweDb7QwogmcGavK6hEm9qQXXzUHI3N/6FE1HDFZET9JL3pMuKLO/sB xv7izjxcwkaVu4SM6mLF/qoYPJEEwkJc3eNbLrhPEqK7WAf/sLboSHz/C5DcK+MgiTNX w/oU5RqewSL5bc9j5OPsv8BCMUJR5P0vBN9G6qZqgjVY8/dJCHt8TmmsXCWQXH8iRTtY hlz5EdMlZXgO63dHye9PtjdGBklXNoWeFOEDN2GSepd0TGLQ+vh4A/N6try6DgNJPCFf gzYiknfALPHK+tN4bUvWwy/XW8li3gL1g0QI4GJfIV+3F9g6OtPqMU7EePnyXNUCP+jT VsdQ== 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=RVyANGbj1qT5Yo4Hx3gumcq/3C2zNijDWqGxalF/0HA=; b=jQiSkNhBhR7dulv+Ez3qL1nVbj2jsGHLsGHSGhqlb58dccITaMWA+T9ccocuCeo6hh mM53tFevU2OYf18CYgb7wTA9nxjQkPQ8K4pc+x/86WKpW+x9o9sYRAGCD6Jsrw69rCOv xlliPqF5eUQcs7fUjloWpzRJr79xq8RLtQ3XaG3FzjRA9DZfzBY6Jp/2TM0U19AkDmJV iVKlZVKOzGqLRrVhqw1YAkOQn+87v6CIFMVdPTnvRuaytSTApHzk4w0F8ERAdMR4CC0k Hcp0UBnvhBuLbGeewAIwT9JAyRAPwgJ20QEfHXTpeksWIfSWXd90zcQW6CsJ6YtYIT8Q n55Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=itzSoxrg; 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 c19-20020aa79533000000b00653b5ab16c3si6527798pfp.265.2023.06.06.02.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 02:43:45 -0700 (PDT) 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=itzSoxrg; 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 0873985FEC; Tue, 6 Jun 2023 11:42:15 +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="itzSoxrg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5906785F3D; Tue, 6 Jun 2023 11:42:03 +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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (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 B4BF785EAD for ; Tue, 6 Jun 2023 11:41:57 +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=masahisa.kojima@linaro.org Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-654f8b56807so3217328b3a.1 for ; Tue, 06 Jun 2023 02:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686044516; x=1688636516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RVyANGbj1qT5Yo4Hx3gumcq/3C2zNijDWqGxalF/0HA=; b=itzSoxrgB4ymbl/AYym8P4o5djLDVtOqgQG3dZ0n3M0sp8ySgm8gsdr3NvdloptvjG RM9/b2zS0Ra+ctcNmBKfYsJmc3QH4ABqfakVHf6NocAn6GJ/KMwaadc0ZysTc75+Tuoc LG4gB7BpC7NAqnUDgF3slCFYpPC9hS8ljBms4WbCKJC1+bHTaneFG3RuF2uWljYdiU1w HGjpgPUYQkW9xi94ggEx7//xRyxFSN4PZ/YUym46SVSkQUnmFZnIn1W5wKLhMpgkq6/R /6XwEl9R21Dvp5Nz2EpjKghSyGCkwushP0OfaKogNuiEUt3pMucP/Rr9o3NP1/NsQvWu 8GNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686044516; x=1688636516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RVyANGbj1qT5Yo4Hx3gumcq/3C2zNijDWqGxalF/0HA=; b=SSyCnNn0YPT+6fG18NB/GVczT8rTroSR7cAHzG1GgrfL/MsFYPfB9aMdIH0aQEVr3o CfLZMBvuhDl2jeBuQBIS8FrICGYoCfuYPfVbSaBjYdg0xa6+K7MbI+iDCSGjsTvO1T6p gnKFpwTU1apZJDd+rc5Ff1ExcP+gXej4+YHcg6uiz17mTg3pAWNlASqbHTImq5l5d+cW GBIFJaKDcoo0ynxUVPVasWYsde95bGfylVs+Pn1AL5ZuOzCUC8Nd86o9RBjm6eBhtrXt PS+s97HRt51aMPwcSt7Q0i0WDyUziFhFT0XywGtCAUvrbS9y1WHWlWWtJM6a8WE7YYK8 /LoQ== X-Gm-Message-State: AC+VfDzq1H3xDO8TOiOEv6Z1dsLkCEZXV14V5knkQ/NiUBryMkA7DTRT 8Qt7WFcFuBNqZ52B2YqtHxAX9ZQFTgOSTVIpZ2M= X-Received: by 2002:a05:6a00:190b:b0:64f:e997:5107 with SMTP id y11-20020a056a00190b00b0064fe9975107mr1822208pfi.1.1686044515813; Tue, 06 Jun 2023 02:41:55 -0700 (PDT) Received: from ubuntu-SVE15129CJS.. ([240d:1a:cf7:5800:d3c2:bf07:d08b:b72d]) by smtp.gmail.com with ESMTPSA id u25-20020aa78399000000b00627ed4e23e0sm6542809pfm.101.2023.06.06.02.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 02:41:55 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , malte.schmidt-oss@weidmueller.com, Masahisa Kojima Subject: [PATCH v8 08/10] doc: uefi: add anti-rollback documentation Date: Tue, 6 Jun 2023 18:40:32 +0900 Message-Id: <20230606094035.28990-9-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230606094035.28990-1-masahisa.kojima@linaro.org> References: <20230606094035.28990-1-masahisa.kojima@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean This commit describe the procedure to configure lowest supported version in the device tree for anti-rollback protection. Signed-off-by: Masahisa Kojima --- No update since v7 Changes in v7: - describe the usage Newly created in v6 doc/develop/uefi/uefi.rst | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index 30b90a09d5..ffd13cebe9 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -537,6 +537,45 @@ where signature.dts looks like:: }; }; +Anti-rollback Protection +************************ + +Anti-rollback prevents unintentional installation of outdated firmware. +To enable anti-rollback, you must add the lowest-supported-version property +to dtb and specify --fw-version when creating a capsule file with the +mkeficapsule tool. +When executing capsule update, U-Boot checks if fw_version is greater than +or equal to lowest-supported-version. If fw_version is less than +lowest-supported-version, the update will fail. +For example, if lowest-supported-version is set to 7 and you run capsule +update using a capsule file with --fw-version of 5, the update will fail. +When the --fw-version in the capsule file is updated, lowest-supported-version +in the dtb might be updated accordingly. + +To insert the lowest supported version into a dtb + +.. code-block:: console + + $ dtc -@ -I dts -O dtb -o version.dtbo version.dts + $ fdtoverlay -i orig.dtb -o new.dtb -v version.dtbo + +where version.dts looks like:: + + /dts-v1/; + /plugin/; + &{/} { + firmware-version { + image1 { + image-type-id = "09D7CF52-0720-4710-91D1-08469B7FE9C8"; + image-index = <1>; + lowest-supported-version = <3>; + }; + }; + }; + +The properties of image-type-id and image-index must match the value +defined in the efi_fw_image array as image_type_id and image_index. + Executing the boot manager ~~~~~~~~~~~~~~~~~~~~~~~~~~