From patchwork Wed Jul 7 13:36:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 470807 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp6006309jao; Wed, 7 Jul 2021 06:37:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynxpaRnpfS6prXzcPdo6IIRrLm5Afh9PA1cPfKjokoqKP8XR+tU0SLuWmcb6orZWVAX9T8 X-Received: by 2002:a17:906:c30c:: with SMTP id s12mr23637108ejz.98.1625665048390; Wed, 07 Jul 2021 06:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625665048; cv=none; d=google.com; s=arc-20160816; b=b2Lp6bmJYF8txQf9RCevh2Gq1Qpr+2QdmQh6Hy6UtbSRGYvwGNqhqefwMzBc3sxpTC dlWD73GmarHQ55m+aFWKzs4QSLdnj1moAikjr9uJTfigeaWscOb8DBGVmdFUQKQMspaR Bqz0xAjG8VHftB0aEc1XsSriVi1hLlBctArUTWTrpJlCzkXXUpnBr2ahM6v+hopFyZvG h+uB4CU73S558OiP/QZIzCebKO+YkRIMS2f+xuCYcfNb+7FhT3+35CYiOwU5TwtiSyeC E8/U6co2xGmwgo/r3HtAqJWnbayUH77ed8mDOp8UTyGwJuEmp6oRm/Zu7eKvNo7AKBr+ FXcQ== 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=0RMll/Zb3XgRIaLgk5chq9sXoP6Fk2K8uIGjTRfKQJo=; b=LFE5zaeUsL7m6hbqnVFg7cw6rpXiRtnL4L9S9YO1ggrLGuSCT62pRWB0fz4llYZkBK t7ta7INTjlO+cijvLMB/IlRZ1qfZ4b+p0D8O7RwcTtRe0NZLcLc+R1mdwTk+YOoMMEOD 6nEVQC708pbr2RkvUtxwGybZr5Dg8CX6HSiOBawcEEGDwDBqJ4Yha7UIiry9HfyJ95zV F7OXU4WIKrjKbss+H+wK3LeeCYFinkjLWl0CBaDUPgTkScUVkFu3aqaEh06g5NE5p670 Xt6egDM6HqNyRIEGDw8YP67DNKdU6w5BAptRXiOgE7WLKvDkyWMeJl5cbnWvy3GCij2x O+jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZXdjNEya; 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 b13si7913185edz.49.2021.07.07.06.37.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 06:37:28 -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=ZXdjNEya; 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 460CE82E68; Wed, 7 Jul 2021 15:36:58 +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="ZXdjNEya"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 61A4082E0A; Wed, 7 Jul 2021 15:36:49 +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-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (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 7CF7E82E23 for ; Wed, 7 Jul 2021 15:36:44 +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-x534.google.com with SMTP id 37so2311370pgq.0 for ; Wed, 07 Jul 2021 06:36:44 -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=0RMll/Zb3XgRIaLgk5chq9sXoP6Fk2K8uIGjTRfKQJo=; b=ZXdjNEyaokyET75oea0wN2QyB4KJGGsTWjA5RarVLwwUS5/iSxjJ8Ay68DgXrBaKbR DAmuqKUXtqSAcXgxh0eoV4klMfVnqGYEjS5Hiz5WAxhFonW3ozYiLdzEdpx7Gh4ELUxk 9pY9ICfDLxxcSJGX3usrLBZDVU80/rS3H7Hy/eo+YB+6UlPEqPUTa+9LSrRAXwgbU9yb cC9b+SR3634cYmc/v77uc1mrBRcFFec3jC6DbYGlYRQhGkm7cvC+0xdlXr3fow5q0q9K HkO5BhxHk0m4to/3eXofYNgaXGDkKBN0oJqh8oTOO5CWi6+dEQ3HBRnpA5KlABcX5X6K 1Ipg== 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=0RMll/Zb3XgRIaLgk5chq9sXoP6Fk2K8uIGjTRfKQJo=; b=NpY8VYWE7p1SqOXLmGvXeQWcqrLzo2+ypdSlaF4K0vTADyW45+cSZuGc/MdlNnMGZY iy3Sb8RKOvJEbX+I1ATCSkLy5l1ERDwp9PjtXFPZ1gbmqP0M1zSn33Qc2b/6RmWA305S wyIqOwdvHwxINs+SVV9l0QvLIyAu4pk6FbeZKpkNbcU1ClrFVDjYZE0MEfCiTjy7weEj AMDSLVmN/ataAMVesgA285oeLUcR+Sq+fT5t/sW3MuFoRuuOpCs/ioaCYDbU7Hv4J6/Y al7V2QQ5ZCBXHKAA/F9LpiLEdeO3avJNIusLFg/M2EVxlYCB+t9gPI9rd8D4yKdtTp5b VzMg== X-Gm-Message-State: AOAM531hXEAHNesnnBmObqmeRwL6h4c6HAOeIV3LauxbAAJeceSWCSQx cUZzU+1UnP+nAZpnUQmZ0Vkx2w== X-Received: by 2002:a63:5144:: with SMTP id r4mr26522325pgl.223.1625665002949; Wed, 07 Jul 2021 06:36:42 -0700 (PDT) Received: from localhost.localdomain ([2400:2411:502:a100:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id t9sm6438659pjs.50.2021.07.07.06.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 06:36:42 -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 5/5] efi_loader: refactor efi_append_scrtm_version() Date: Wed, 7 Jul 2021 22:36:38 +0900 Message-Id: <20210707133638.12630-6-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210707133638.12630-1-masahisa.kojima@linaro.org> References: <20210707133638.12630-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 --- 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 823abd8217..00e442cea5 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; }