From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96902C4338F for ; Fri, 6 Aug 2021 07:03:48 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB62761131 for ; Fri, 6 Aug 2021 07:03:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BB62761131 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0F84F82EE5; Fri, 6 Aug 2021 09:03:22 +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="GohKjQEg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A289982EA5; Fri, 6 Aug 2021 09:03:12 +0200 (CEST) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 7737882E23 for ; Fri, 6 Aug 2021 09:03:04 +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-pj1-x1031.google.com with SMTP id mt6so15013833pjb.1 for ; Fri, 06 Aug 2021 00:03:04 -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=bdzYWTvWnrRQKlAmG80XhkxPwAgRAxEObGY3kS4a0nM=; b=GohKjQEg0coeI1BJvVBgxRWUKvBaKu5EPxhK1SxatOXfiaMBCofB5uCGMSHa4mVtXR uRx1koiVfLeH8PuLCWmec4KI2HR/3jbMeRPFTsgH4ydfbUKL/HpRwh6Lc+ww69znDMBu 34NTLJl6d+rCxFneFAh8uxmH9IA5hgYaUmPLph7DWiODR0YGhkTEdkzNQz10QP20OmiQ EJurRXeRKIqWvvPNDvUDLOd4vafENDAuD5/Umfk16RRemuqBFFMhELlktjOMriXjcLu7 zsQTfCivHXAkD83bTKac7EAksRkwEBt4lMMPMk3rpYlE/yoImHhpg6VioVYF/h69tNoi 37UQ== 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=bdzYWTvWnrRQKlAmG80XhkxPwAgRAxEObGY3kS4a0nM=; b=R9eSo7FLfcFxo64IVpIlsibfF42aMDD+pguxFfwHVxjRVDK4LbalSGoDdtVigFT3Gl jctrJHIsmlQ4LBGVuc3oLR+gWIbRz99Gq7MfTHhftCk5iRIWvRzzm4Rw+vtxG5ZiT9sb 1Y/xC3mcBGbWWOMJ/42Gn93S0NUMQto9m1p7p8kmJR/KofnZW91YTKCkisbj6nKXFZp0 R9Fu28zO4nl1l/WMI4kokxNDHFiph6k7lNPqiFJsWMp5ppYSNvlSWEDBvQjs2czc8Wx6 /EszslTOhVXP2bFb5sSZIyfg7kIQs1TzmGmiXzLkHVnl8cBxe8V5j2td+k3RCmQp2RFo 3qJg== X-Gm-Message-State: AOAM530HvfKsIIit63UAC1eedDZu0XNHAgLZeZ7JFwAe4NPFg+Ks7XQc R0gvfK/CAUlh0xvGSyGmLU3QAA== X-Google-Smtp-Source: ABdhPJzq4e/BVxUNjbjZRto0Z6Y3l4FOUhquwEpDNEoJfwSh+M33dMifk0kGDdLPFT7sC4OUprjWTA== X-Received: by 2002:a17:90a:1b2e:: with SMTP id q43mr8978501pjq.230.1628233382874; Fri, 06 Aug 2021 00:03:02 -0700 (PDT) Received: from localhost.localdomain ([2400:2411:502:a100:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id u24sm5145304pfm.27.2021.08.06.00.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 00:03:02 -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 v3 4/5] efi_loader: refactor efi_append_scrtm_version() Date: Fri, 6 Aug 2021 16:02:14 +0900 Message-Id: <20210806070215.19887-5-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210806070215.19887-1-masahisa.kojima@linaro.org> References: <20210806070215.19887-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 --- (no changes since v1) lib/efi_loader/efi_tcg2.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index bcd8626ff7..f38d578a32 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; } -- 2.17.1