From patchwork Wed Jul 14 13:00:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 476744 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp545728jao; Wed, 14 Jul 2021 06:00:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyufiwwxgh7D638jbwmw0KijjP6yAU9SD6NZU4TRW5fomBJO2ojVjxAJF4H0uZmdn3KUiJs X-Received: by 2002:a50:9f8e:: with SMTP id c14mr13481622edf.283.1626267626248; Wed, 14 Jul 2021 06:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626267626; cv=none; d=google.com; s=arc-20160816; b=o5WIARArt1+SJT7cIbVsXrI0gJ2JLIouVwXcG/Pbkls8brJRwnvxEaZq4wmMXqZ1ar M2WXY3DBj3y7KcY5nHD4XSYWzu8oUcr/h2jOlg6AeNA2S+LyGSLKz/Ai3YLNDtKVTjgO fzJR/uk7tkogqsUWrXUMaZb1nFfdgTSzK4Y+eVLEoBWV7pfHfcxVSojPtJqEuJonTxbD 0fbtOd22dPGkhpbJmZBO++mi9vWpKQTunv6RJoES+LLRwW2srXA9ILZ47LVb1SkK8ox5 0MO5aSjmJxvOSA3CBWK6b3aHkv8zrsW0FUGBgjdSEnLf5dJQZCWkgCDMQE8BeQRdQaHm qhsQ== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=XZx3gtBECc26PxTN/5rlJQTrqXCgZNQqIBoi6qZj1rw=; b=RzstrlrgqAT4wUBw7pYxBhmRvAH0EWyTshRvuUSuN9pi7bkZcwJ3U90ilEcFIj1pYe c9L9c5NIzebKMw10KKuf2LtF8sKPxMiN25j+ZUQAZL7cqBl2KyWmXsZoGhOtJKarQRO9 JoToG5v8zPiJ32HtKJtvKiyyuCFVioEEmOyE6cMaRlixNbI2gj++2BGnc2iSN+mcKdXN 0K9xGiXvswpKnFx2G+Wi9sPJjkdD/7rmFkGJX0KIES5ZtJRAeg2aiO7P0Lk5rNqPKAqL sE6VNDXToiRMm5a4aZUQMkRWaqxondDkq7Zu/TRjvwouAlRyTK1zrOt7mKXF7oKVDrZc m9Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ncd7mrmS; 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 j22si2555681edr.518.2021.07.14.06.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 06:00:26 -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=Ncd7mrmS; 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 4221482970; Wed, 14 Jul 2021 14:59:48 +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="Ncd7mrmS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B67408202A; Wed, 14 Jul 2021 14:59:39 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) (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 91590812A6 for ; Wed, 14 Jul 2021 14:59:35 +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-pg1-x536.google.com with SMTP id u14so2287270pga.11 for ; Wed, 14 Jul 2021 05:59:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=XZx3gtBECc26PxTN/5rlJQTrqXCgZNQqIBoi6qZj1rw=; b=Ncd7mrmSYoHrYZ+37Y1EMzZ9nBxlw8trefLM5NeVCviU98hHw62ZC845Rar+xb436k FiDw2X1e/QVro6VHWuGFtVzdD0n5Lfi8cgQY1cLWakiJ40DWSAtlYDrcYsslUn9hCzTH CrrONj5lhf2v9oE5+G2SONN2/+wmQ1/DZwDmsb3vYj3bQ6uQGXJURKkz/bNNsLMARhLJ 1uau/3N+1QMTPasMMilQqR81zMpETlF7tTx/zTpn99GFoZXj6SHVM2tN7lqnzqTkxWDf 6pmcbZZZx8Qsb0xIQZr1agCbTcp1WgquGbJiKbSwNIGWRcuCAk3IjEMfRwLVQ4vrobJD fyHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=XZx3gtBECc26PxTN/5rlJQTrqXCgZNQqIBoi6qZj1rw=; b=pC56me18RrW2C66T6VXTjUcRHMylOs7JmpHRKl5/Ou0JwCwID5Ne2JUWaGCMhn/R/J g2cAqYAwCRw8iUqVOEhspn/9/dKdbJQyP4OHEOcd6+VmBWI+B4KCOVrWMv2lAuv5Qvf7 Hq56IkiakBb0F4PnXR01un7t/Sw/QzKj0+L7ZPvA3AWJQ3vSHMYjfq+8kWsm5hhN9DUR NkAw4X6rcDBkhV4B6/uTOVTwnCKmdLDJzQ9ZfVQZV2aOwdFq+XyjVWOzYSSfmSr0OmXB xs9k5GkDfTFDCd4Vpo8TiBcv9Z2Zqymr0FE3QGm1LJgrBMRy2mMYq8DqBE4/0L8vTpob adoA== X-Gm-Message-State: AOAM531eWkSz6d6r0YIXD027SRgBG7hbNsZwz5jRgH3xkHaBCcaHpe6o w9BY8a4fJZsr9Ru5Tv1tQdMWeA== X-Received: by 2002:aa7:93cd:0:b029:328:9d89:a790 with SMTP id y13-20020aa793cd0000b02903289d89a790mr10125311pff.71.1626267574007; Wed, 14 Jul 2021 05:59:34 -0700 (PDT) Received: from localhost.localdomain ([2400:2411:502:a100:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id m21sm2787509pfo.159.2021.07.14.05.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 05:59:33 -0700 (PDT) From: Masahisa Kojima To: Heinrich Schuchardt , Alexander Graf , Ilias Apalodimas , Simon Glass , Masahisa Kojima , Dhananjay Phadke , u-boot@lists.denx.de Subject: [PATCH v2 5/6] efi_loader: refactor efi_append_scrtm_version() Date: Wed, 14 Jul 2021 22:00:05 +0900 Message-Id: <20210714130006.17837-6-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210714130006.17837-1-masahisa.kojima@linaro.org> References: <20210714130006.17837-1-masahisa.kojima@linaro.org> 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 Refactor efi_append_scrtm_version() to use common function for adding eventlog and extending PCR. Signed-off-by: Masahisa Kojima --- Changes in v2: no update lib/efi_loader/efi_tcg2.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) -- 2.17.1 diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index 32e3818af4..564ac2255a 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -1321,23 +1321,11 @@ out: */ static efi_status_t efi_append_scrtm_version(struct udevice *dev) { - struct tpml_digest_values digest_list; u8 ver[] = U_BOOT_VERSION_STRING; - const int pcr_index = 0; efi_status_t ret; - ret = tcg2_create_digest(ver, sizeof(ver), &digest_list); - if (ret != EFI_SUCCESS) - goto out; + ret = tcg2_measure_event(dev, 0, EV_S_CRTM_VERSION, sizeof(ver), ver); - ret = tcg2_pcr_extend(dev, pcr_index, &digest_list); - if (ret != EFI_SUCCESS) - goto out; - - ret = tcg2_agile_log_append(pcr_index, EV_S_CRTM_VERSION, &digest_list, - sizeof(ver), ver); - -out: return ret; }