From patchwork Fri Aug 13 07:12:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 496552 Delivered-To: patch@linaro.org Received: by 2002:a02:cf8a:0:0:0:0:0 with SMTP id w10csp274069jar; Fri, 13 Aug 2021 00:13:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVVR1NKyRGJ16N8ipCoOW/eQjeVtSixXafN28lVpXHLOZAB0xdAGRNnEppIJ/shL+Hb5uT X-Received: by 2002:a05:6402:270a:: with SMTP id y10mr1292476edd.385.1628838798744; Fri, 13 Aug 2021 00:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628838798; cv=none; d=google.com; s=arc-20160816; b=PS88LmwKVbiIuxi1MyGvnHXz3KT+CpESsmDhuJVhNobt51yP9fcodUIE4+4R6Lcu5G QmOJti7ZKIzvObgkjAd9Y2o2NgZGa3Cm8PLMS4IUWyMEJMjwQyusCUCwOgvWjSwBWBuP ikx64cCu0MMd6TfATGCMoc39W71rFT3/FGVr+5mfUWYcJ67k6vMdYbgJpKfvPXDOAApM 9NJIQWXwYbMzSAc/TRNca1et7O8sUewlFIWXbMiM/Hkhm4jRzCaYz9IJAmmSSBudQ41K T0lNbhn+mIEI53yPLCujewivavO/NoXQz5NAhiuBuGZsfn8wNyOeYQeAOzgPEesqy2C0 6uog== 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=DcLXUswaVVNp+gZdcP6dSnSRecZwqeYFTMz56L1G1fY=; b=WK2UuCxqLhBY0OCH9isq05kANDWmNlv087fs74S4IaKx2o3eYQVXowP20UnzlPK8I2 ywuGxmSlz1BMeRKIov1VdvZPJ4YRG1OyYFybJEnoMACCwDtKAVSbz3jvtkTokaIUMOVA VOeyAihQH1uGRIQx9H/cL47VOjPUF2NY3eWGxbfLAP+b9pB/55JHkDeym4ECRCvLP/AN jZXLZ3uvLTNFGMnKmfr9n8q9SiANftPVWvgg0ijPUxCef/HAPc9AFzkxiy9Iz9xW4hDn vwIradUZfccaeEooxaI/2/IcC0zv6S7TQHbXCg2a6m15JWm2nGia6EOv4gd588PWCCZY qb1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGaDEcLh; 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 ks26si844828ejb.542.2021.08.13.00.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Aug 2021 00:13:18 -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=YGaDEcLh; 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 C697C82D5B; Fri, 13 Aug 2021 09:12:54 +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="YGaDEcLh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3335682DD9; Fri, 13 Aug 2021 09:12:36 +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-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) (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 9838682DD5 for ; Fri, 13 Aug 2021 09:12:30 +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-x102a.google.com with SMTP id nt11so14054537pjb.2 for ; Fri, 13 Aug 2021 00:12:30 -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=DcLXUswaVVNp+gZdcP6dSnSRecZwqeYFTMz56L1G1fY=; b=YGaDEcLhkovzTCkL1MGQcRPBpDoT73a8OG9m8VnJCPE9HACAowOCE8W8nAhGX+71Li +13ZXgh69OWaszemiVmI6gONugTEPhgfkEXYzKkj90EbNroW6CDkeL4ZDDrtUUrz2ZyQ cQNBfY9usOZetJkglnseBF/4Sd5tutsTks32+5xb4yTbibAv8NgwtpUnFHF2B53niGUM 67KKik91aYIu8mWd2Achk3OZ/kKdRLUXZ8l4Ia7LotAV04lm8QX10y36Xs8NNzQEFumi DAGaUUMSoucOc6SiFg5n5y40kwfYw9uK9QbZmJuORck/UeHqm7uFV236h+ONEHteEm0y xm3g== 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=DcLXUswaVVNp+gZdcP6dSnSRecZwqeYFTMz56L1G1fY=; b=nBtwwYhVvyZ8hxhqxpW5tBux+ceLnIB+3CYG8qJmABXfMSI24zxZLeBYeG5BE2lkWw XHI3PSyTrB8yXXcAYNIPPHZZDJ0wjUm0+PAWmZo6Q1352JWwtgySrreIaS33nfgSGBFU OIWbTOrrfbzIZH3AfgEUwm6W7u3lr+SUNujmGmcvR+RCMP7s0+/PW297XlYdAtli4E/I toJMVMo71gXS5oDbP0i1GLCRKZGnukxLoz+530fvXwintPWvgNM1Pu99Lx6lp0vy9Sd7 VIyLsWF8Kbh+YRNa26uSD6zqdfiXY+Oo4qveLrEXROk7jE1TqfyLwV6v+yZxFAIcJruQ 2gkw== X-Gm-Message-State: AOAM530ETmW9KX/ECsziiyNGndiP5xglNxxl2Y680QMTMCiVgjRrMOKt qAn+YJItf4B/p0Y6jl8MaTkJJA== X-Received: by 2002:a17:90a:c085:: with SMTP id o5mr1239910pjs.113.1628838749023; Fri, 13 Aug 2021 00:12:29 -0700 (PDT) Received: from localhost.localdomain ([2400:2411:502:a100:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id u21sm987078pfh.163.2021.08.13.00.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Aug 2021 00:12:28 -0700 (PDT) From: Masahisa Kojima To: Heinrich Schuchardt , Alexander Graf , Ilias Apalodimas , Simon Glass , Masahisa Kojima , Dhananjay Phadke , AKASHI Takahiro , u-boot@lists.denx.de Subject: [PATCH v4 4/5] efi_loader: refactor efi_append_scrtm_version() Date: Fri, 13 Aug 2021 16:12:42 +0900 Message-Id: <20210813071243.18885-5-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210813071243.18885-1-masahisa.kojima@linaro.org> References: <20210813071243.18885-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 8557fce1da..2d03809e85 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; }