From patchwork Tue Nov 9 09:44:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 518041 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp1458002iml; Tue, 9 Nov 2021 01:42:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyS2WmFEO9OoDnYBJLtBf31KwSJ++bfyDk7cenqGyVRlY0Zw7V81uc3q0AlnKxVQbxjLs1k X-Received: by 2002:a17:906:2ed5:: with SMTP id s21mr7646293eji.30.1636450958076; Tue, 09 Nov 2021 01:42:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636450958; cv=none; d=google.com; s=arc-20160816; b=qYZl6vE9yF1FsAJSLxaPybOc6Lxyo9azznsKqSBCFS5eQV757fWDzkagVPeoTZNlbS 5Bw4+q4q2PIFud5GsHSyLtoLW0SfmhGsRGlvtoPFA5dSTcjzLL6nXVodZMEHpXHvinJ+ wDBa6QReEWjPJmhkP86USNTi1biSDEsJv6eeAM3ht0+5C2ecV9BsUuUEBKVNYdkJJiLF frwJ4eYF1h/VO6DcfRuBR6g2dK9HCVsTmGtg3cjEymrxRDkTcq6Ld6OhsIU5gXq2ztBY gqR1FgUmJRAUWC/hu/qwbIspEz1/h/Lq6KSv2jKwTukb4a9rU7c2QCod42ESnPOUTo+7 urog== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=Viim77u1fSjx86FQuMsEnbfBO0Sa/SSK3mgeIK1HXuM=; b=i+FNU8OGHYP0uGWbaHJwQVJKimkwLxQ7a9e95kARhzuNwttPNrp5ToMOe38w3XrxKJ EFkWUNs8TrRfBLZhngWx9WV3EOtO5Yw5D2eq7UgP1cU3JrXeQuBSx4+R5YdmmK+FpbIp cF/2nC8toYPAxjTeQyXOXr7z36lEh6j8tjcxNqEBbzvHawL3gzaHh5jlSSskcYH27lS8 QKouIAHh4UxZa3FLTltqUfHIrui9TP3qKO/01khXZqegrYovjCXE0fGlr53wSmg9zUTZ 9YMDUOoRPbtk8c2sF5FlGo3elNg0rZcgRan1bLGTqCqkY1w1MTgDuEZymbB4yxFfHegc upTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FdudAGsf; 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 b7si30698532edt.177.2021.11.09.01.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 01:42:38 -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=FdudAGsf; 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 326BE83883; Tue, 9 Nov 2021 10:42:36 +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="FdudAGsf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D00A6838FA; Tue, 9 Nov 2021 10:42:33 +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-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (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 C426E83862 for ; Tue, 9 Nov 2021 10:42:30 +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=masahisa.kojima@linaro.org Received: by mail-pl1-x62f.google.com with SMTP id b13so19939582plg.2 for ; Tue, 09 Nov 2021 01:42:30 -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; bh=Viim77u1fSjx86FQuMsEnbfBO0Sa/SSK3mgeIK1HXuM=; b=FdudAGsfll8IboDhxWyScRwzVZ7337w1fuxgWN+5ZSYe5IEAC0pl3Cu1KVCLdNpGnn OJPjpvfdMkbYwHSkw9sreEy7xpy8OIYQfekjdtQBGE0sPKlfaQTdUaEsNn7EBTXG24Np vtvbFnOP9KtqySWnftq89mxT1B3Xh1z0SG2/CdhYBVdxRSaTLiVX1FqE9K2ynhq9OJZ2 1ZSWJnFkxmnu+FIViMFy8jK+lxTXtKfphEg1YzHCniYE4ZtwkcUhMJNzZYEMqpnetxPg XnZRNeZW9X6j/xM7I8XE5Lisoiqo5oQRLw272PEEaV3XdSd8FfSD2473kvFXlkenY6Hc lYNQ== 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; bh=Viim77u1fSjx86FQuMsEnbfBO0Sa/SSK3mgeIK1HXuM=; b=nMYsDrfHrtp8JrI0DRoja9SnbLTmYIsb6cseXp4HkPkJBAiv+WWwErncOeY2XHrEa9 PtudwHh/WDpdnqZHXuKiNQnW4PKdMQsHew+V4Uc8NoLFuWOXbq4xkZpwmMlTBsl5quz/ xSJGF83o3wh9fVClMugxYTOd33mBlYq6zVlV/a5NX7BApuwCtEJQMzgnYzJnZ+QrGBP8 Nn34K/ZB1BbO4Iteeb5Dhg+LaYUMxkAquiYXLkDLelGo7o+rV361o/5+3EJwtOvjsU70 vLk1PO6aI5DjUUabF8XB7epZoxcgOb/8zB0epcWu9Gc+fLSFOZFql3ncblIp16birWhs eoPg== X-Gm-Message-State: AOAM5326Hum/cDodpB7PnBzogSGI95rkty+nhTwWzysJ7AG+5gbR3rVs vzTRML4uxV+aQ+D4mDq4Zwsq7PT5nyM7vw== X-Received: by 2002:a17:902:be0c:b0:13e:2b53:d3 with SMTP id r12-20020a170902be0c00b0013e2b5300d3mr6014236pls.86.1636450949063; Tue, 09 Nov 2021 01:42:29 -0800 (PST) Received: from localhost.localdomain ([2400:2411:502:a100:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id n14sm14668999pgd.68.2021.11.09.01.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 01:42:28 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Masahisa Kojima , Alexander Graf Subject: [PATCH] efi_loader: fix BootOrder variable measurement handling Date: Tue, 9 Nov 2021 18:44:54 +0900 Message-Id: <20211109094454.32570-1-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 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 UEFI specification does not require that BootOrder is defined. In current implementation, boot variable measurement fails and returns EFI_NOT_FOUND if BootOrder is not defined. This commit correcly handles this case, skip the boot variable measurement if BootOrder is not defined. Signed-off-by: Masahisa Kojima Reviewed-by: Heinrich Schuchardt --- lib/efi_loader/efi_tcg2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 586f73af6d..189e4a5ba5 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -1452,8 +1452,8 @@ static efi_status_t tcg2_measure_boot_variable(struct udevice *dev) boot_order = efi_get_var(var_name, &efi_global_variable_guid, &var_data_size); if (!boot_order) { - ret = EFI_NOT_FOUND; - goto error; + /* If "BootOrder" is not defined, skip the boot variable measurement */ + return EFI_SUCCESS; } ret = tcg2_measure_variable(dev, 1, EV_EFI_VARIABLE_BOOT2, var_name,