From patchwork Wed May 31 03:35:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 687227 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1054877wru; Tue, 30 May 2023 20:37:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5e2yIA3O/H+zFd1zrtJ0nXrOBAF5dfWGIwVkOfoff5K+0AixGPp0i+8AkX1i20wzaYGCVf X-Received: by 2002:a05:6358:919c:b0:123:5851:f09f with SMTP id j28-20020a056358919c00b001235851f09fmr593063rwa.23.1685504263898; Tue, 30 May 2023 20:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685504263; cv=none; d=google.com; s=arc-20160816; b=SRQkoLVOBm8o6iG2uk/2t/6nex9Md7ulL0woXwzt1kswXG9G7+HxuXyn4PH94/MRyz b71xVvTwQyZj91canCcfCjRrwZE8MCOcB0FhQbB7FBAIYsX93Vpb6uRCjJMjmleJ8+pe r3ZLAB2auGrbzwRgTV8kN8jN+/OPH7BsKU1ApgioxqnLOMyzkuy86YnF/ir4ovsduver jYPMML5AE4XI+MUY/PTdO6vp2cJO3SpkQFJJ0MpY1R+cENbd/UTDk+Hf1E7OTagLoPTt m3xuUCb58/IhJWDxs+yfinWBuiKK0phOTWEwXwzcIw8IeaEppdpFI/QDFGxybghZbwEi TF3w== 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=ru095f4FwT6Uqe3ASe/q3BDrpLL4fomU05EebJHRAmI=; b=I7Uu8aIFSCQfW02e3BwTx+BNwrabSuOVe/VwuyzEyZZ5jGdsWp+v50ErKao8AyJIhP E1Q4IScjaGzGVHYwEAhkWx2u4ESakSRcCw8pLZIXwbIH/H0Bcq68H/Ga2anmdzNRAJTv aUJmNeXam+5pq+aAoQ5lKo1VXlUD25wtJkMnaGoNkXiZckd0DhDx/GrpJO5rme7WqtXW GkqaV5i6dVPDz3DUIG4ue245TKr1AIHV2/Mi/unqSDMHMafiUwpaKB0bctp40xfOJFW1 WGn55HJhBcAeyPVYA6CROGqjA7W8ipxWWKitk7Zl9oI1CrB8DWz2jaovlc5uxT9do5pq vILw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fOqj5GRm; 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 fv6-20020a17090b0e8600b00256bb961a29si268856pjb.35.2023.05.30.20.37.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 20:37:43 -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=fOqj5GRm; 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 E006F861BE; Wed, 31 May 2023 05:36:26 +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="fOqj5GRm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EE4D4861B0; Wed, 31 May 2023 05:36:15 +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-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) (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 855CE861A3 for ; Wed, 31 May 2023 05:36:11 +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-oo1-xc33.google.com with SMTP id 006d021491bc7-557ca32515eso2628909eaf.3 for ; Tue, 30 May 2023 20:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685504169; x=1688096169; 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=ru095f4FwT6Uqe3ASe/q3BDrpLL4fomU05EebJHRAmI=; b=fOqj5GRmoM0RSZZgX9Yy1ak+Cs1nz76O+4hfWcADKt7Z6biw/ZdU/N60bekpLNAouv JZzNNAI30yEcnA//GALToAC+dls+2Vx2o5YE2zQuCp6BVAzWbpGCWtY3D5AWCz8v5gsm 4dOG3r3MDQ9AdtQK/7HnTWdWlYXuizuCaezoa+xsj/b1whe1jK3rYXKwhqaoy2k4xDRi AxbPIYnlnlaTjyPC8VnoJHmnHO8amABYunnUicPHn8Mn1o66OS/30XVHTsZo8TZyewVb WdZ+hNcS4mQLjejTaVnNJHwjo7w1mg8OaCMOm3ui2j9+k6KCbsi1RQiZxBYPhJ9WewBs /x5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685504169; x=1688096169; 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=ru095f4FwT6Uqe3ASe/q3BDrpLL4fomU05EebJHRAmI=; b=BnqiLFzjXrlf6NQ3I3FDEdDNvwrsq2RWL72z1JRA85j/PWTMxGk8UnD6AcdC09Wa3J awbpqRnJtE+JtSUKSp84ZfXuG+xQA6fB48FgNjIjKkalmp3SZZn2fVFULN+qW5B4w6A+ 1S+1w/v/mUtlbF1WkamaLaSsjHsT3V33jXgc/viWY8OvtQGpJglZQLu+wrXT7gocxnEl 1YaZWPd1MWX+WYpKpNpvSuHPYkXUQL4BXvXn+nXweCaKwKiJyol8FZPHf5CYUf3Pp/+v s6uufldbW3RFNa3d4vTenBRa86fuze+46JXGY8D0WqZKfrVxKWXdgbXrADiFbw49BNJQ weMA== X-Gm-Message-State: AC+VfDzExf/g8KhobnO6ixywbTyCYHPxP5Y3Un4xbgMmUZlvcw9PT7aB bgNQyOKID3DlnaSg/jTHECc0zGwDlWHUSJcBtxI= X-Received: by 2002:a05:6808:1386:b0:398:f32:9509 with SMTP id c6-20020a056808138600b003980f329509mr2457678oiw.41.1685504169691; Tue, 30 May 2023 20:36:09 -0700 (PDT) Received: from ubuntu-SVE15129CJS.. ([240d:1a:cf7:5800:b037:3ab0:51c1:7dff]) by smtp.gmail.com with ESMTPSA id b4-20020a170902d30400b001b0395c3ffasm85709plc.180.2023.05.30.20.36.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 20:36:09 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Masahisa Kojima Subject: [PATCH v7 08/10] doc: uefi: add anti-rollback documentation Date: Wed, 31 May 2023 12:35:21 +0900 Message-Id: <20230531033523.1581973-9-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230531033523.1581973-1-masahisa.kojima@linaro.org> References: <20230531033523.1581973-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 --- 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~