From patchwork Fri Aug 6 07:02:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 492809 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp45534jap; Fri, 6 Aug 2021 00:03:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUeKPlfTlzsv3qR9IUeN6oUA6hmfKSZyZYU7A7FcudqrmOlfrmYmeHw6HQPnvDVslGvdhu X-Received: by 2002:a05:6402:1a3a:: with SMTP id be26mr11203543edb.232.1628233427819; Fri, 06 Aug 2021 00:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628233427; cv=none; d=google.com; s=arc-20160816; b=YyxzaVWQt1k9PsO0doxxenV6rmRxE7CUiBmMkyKnD1qVrJfdWWNtD4kLSAl9Lhhdci GokgnPzvs+8rGDMjKw6/wLHKGNe8jkcAjbNS9eZgRaXscdww0fpvCx4OYrRGLkG40g3n x2tfck+eUknnsxzFLFXcFQHqGZmcoWvXeNFEZ33y4vXRxcbzq4otjtmgaY7zDdIpACoP LmsJ2H7MuJjo+H1bDdPJmUnp6tuSl4dI/UaOngYvOmFOsr37a+Y4C5wFEpAqwmV+qxiC uLqvakuGDiBZG+aWOzTzJfbDSf0pLD/8cwKEik6p30KkYuU4Bz69J0CNehu0hu8Fy1rw yZgw== 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=bdzYWTvWnrRQKlAmG80XhkxPwAgRAxEObGY3kS4a0nM=; b=mGAVTWdjy5nOTciusxkaiYwl+SzbxpWOJtShm2Ek38ldkZXhtH8q8b/mjmaqc6c7rH n/xuCnPujFoHqLubIjdutUdwWa23Rl7eep2RC18oqcCeVJYeCk9tbf1oRDAy8sUN8/0M 1KeD5YtEFsFaV9Y+VJ7/ALk1peBZ/WhXCVnaaHstfm9NwnDyewIOVdRIeqCB6GuDgnc2 isuIqy4f0IERcjVI2YubAx+AZ+7+XVy3L66cabqjRLZvZmkWx4q3cI0Xpm6bPqLEqOzh +3zooxALpBH67lyZQXti75laY+wRCUrWIVhqzISTHERKAfGicjbq+HDbLWGtFTf6J2DL LPJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GohKjQEg; 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 jg40si8827415ejc.451.2021.08.06.00.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 00:03:47 -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=GohKjQEg; 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 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) 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-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-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(-) -- 2.17.1 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; }