From patchwork Wed Jun 7 05:41:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 690173 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp140037wru; Tue, 6 Jun 2023 22:44:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4DUyT2hTGWLIVrR5zsQ5HGCGULk/aX5KDpL/5Mv46jAh9tzWNtrJjyVlbBzrkNJLj85jdK X-Received: by 2002:a17:903:41c6:b0:1b1:ac87:b47a with SMTP id u6-20020a17090341c600b001b1ac87b47amr5000597ple.65.1686116667266; Tue, 06 Jun 2023 22:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686116667; cv=none; d=google.com; s=arc-20160816; b=qzjyj0tAx/roPItkXj7wHNmVhDj0td9RAtbX+kFx6BLV6ZBV1lmquFC4My2hXWrBM1 mTh49RlcmqYVbOWSQBkCkyzO7jIVKZ2O46If7j2DOgdiJrauXbsGRTK1JhnQskCZMBiT BJXeq3BI/fM5GT0fhtqh0rp6mI1RkVbIey88KIp2Wy8XLOfR0PaIfGih5gmc9l3Zkh+E T67j2cqttxe2y+M3XKwQz343I2rvRXjWp9a1JyswpCbE19GjNCykbgeqbj8ZpqHkipN1 argHR1MKZ+0rbRjoIELtk//cJJgaLD8smPcR2nU2wvwQNYIhBmOtnvzRvM77+H7CxOIV 8mjw== 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=GekJf54cNwveUDLIyaTdKWFSJvGR2cdNqkCjKKGaaq+WkEB+f3Y1TAK98JOf+yo9Or uEvCyiQJsVhh18yNbzUTnKJhWwsaSUucbcVbaBCfGfg65DwQYJB84i5+oNVkkHEb9XZA emEjK8vuKtuEehU67IjAaPQolT2ZoDWJGY96e1E0NgLc2T63k2ows63mO3SwgZTMSzCA O+yg5ogoJqJ9UcSHpftMZaziGcXxmhRE3UwxxCBVQpkeThcJp61bFBbHVNqnm3fcXVV+ A1YZfrNS+405dSw4p7TYvSZ3LWEecSbU98PY92rxBZqXN/Efm/VfVMuv7N+7bYflx9S6 x1Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=luvx5eyC; 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 e8-20020a17090301c800b001aafc6a76e1si8557586plh.69.2023.06.06.22.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 22:44:27 -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=luvx5eyC; 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 9422A8609B; Wed, 7 Jun 2023 07:43:07 +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="luvx5eyC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB4D786071; Wed, 7 Jun 2023 07:43:05 +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-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) (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 ADC9D85FB2 for ; Wed, 7 Jun 2023 07:43:01 +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-yb1-xb35.google.com with SMTP id 3f1490d57ef6-ba81deea9c2so7445556276.2 for ; Tue, 06 Jun 2023 22:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686116580; x=1688708580; 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=luvx5eyC4T8E2V6v7PRXruhpfenyfisLoQmD9LJY/jWX7lg6nxqCDT7V2peGUZ75zl inuEqxFswnbCD8diR6TeHUEWlrfql08SGHF5AlsM7qa7nFJbaDdbD62X6rNQJBn/k6Jc R64wM1LUaxzbbCJKp1Ji+wyehXQ8aHe6eNoHh4sYDANLtRHOJ80OBXSy/S/lt8TABV0c 1xmm1wyNPrWK4XTd7ECIOAJ917U3e0bvwrnl7ALQcP3xzJZsRkwikQc8nWDylzQDdl/q 9+wu/a2VIRkSQBb8udj1vj5HBJW+3Vgrk9gx7SiMYs7ufd6oTv/67NlWPu3er4yHZICJ AoKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686116580; x=1688708580; 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=a8zZV2+MErEkxQZWp/2+jinnLPa5BG7Hscpd+SCuRuTKOIjVlBMBqKbauDYrevGzZY cwhC3f0StHXBAOmWl17ARpJMve+X5KzKMbFCcXLWFc4oG4VH5wX+mut4agSA4L+Q9H1K CULVVwlpBJhg9wbumKKJ3INBxhaEepi7qQqWW93qYAPReH0LPXUukz2IE28lc//unsBw ITGpFqiEEY7D5J6xuEqNlnft+H92C50Y8z87ILhP5YQClCOrmEHc+bPqTUoILh8TPCKC q2ahwe4Kf9kp4nn/fspjhtpzkg/CeHVlQig7D9AIqNQArR1QMDISpicoMwN0WsZ0uKAH 0xAA== X-Gm-Message-State: AC+VfDw/OPfBxgfa4RzZgYOxDwtPI383wpZ3JxX44UAlvyYaoz159szR AmcFSatbxEB8UiW7KOyjhavpTK6BW6NzBRmowkU= X-Received: by 2002:a0d:df90:0:b0:55a:26cf:33e with SMTP id i138-20020a0ddf90000000b0055a26cf033emr4670786ywe.42.1686116580001; Tue, 06 Jun 2023 22:43:00 -0700 (PDT) Received: from ubuntu-SVE15129CJS.. ([240d:1a:cf7:5800:d3c2:bf07:d08b:b72d]) by smtp.gmail.com with ESMTPSA id fh2-20020a17090b034200b0024df2b712a7sm469033pjb.52.2023.06.06.22.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 22:42:59 -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 v9 08/10] doc: uefi: add anti-rollback documentation Date: Wed, 7 Jun 2023 14:41:58 +0900 Message-Id: <20230607054201.42702-9-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607054201.42702-1-masahisa.kojima@linaro.org> References: <20230607054201.42702-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 ~~~~~~~~~~~~~~~~~~~~~~~~~~