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=-15.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 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 24ADDC07E96 for ; Thu, 15 Jul 2021 06:46:21 +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 79F7461279 for ; Thu, 15 Jul 2021 06:46:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79F7461279 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B847080C94; Thu, 15 Jul 2021 08:46:18 +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="jl+Kvw/6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 56FB6829B7; Thu, 15 Jul 2021 08:46:16 +0200 (CEST) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (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 8660282039 for ; Thu, 15 Jul 2021 08:46:12 +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=ilias.apalodimas@linaro.org Received: by mail-ej1-x630.google.com with SMTP id qb4so7420249ejc.11 for ; Wed, 14 Jul 2021 23:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/FAoAlSLvfcI0i7QRhMXZk8GBnsbovYktdKIAdYFRD0=; b=jl+Kvw/6qrGRQBmf+y5He9NPcuh58Y604psgwuuHqKy3UYjqBkTBOEp7DnOAj6qiA5 HND0wv6hu35vq4aILEle8Fj58vJBb17qnimmCDUVHoZi+xsej7+iHvWP5QRzpNri7ox4 brQwgOQ1ebDUaro7grFDXmbgbKn/bUk1GAyd3XmbeUBOszIq2HlnZcP6Bsb47vshX7vl 3yFCwJzRQC87Ay0xr1+3OAZ5yefP/8zc2Vo+bnYiRsGfpaaNYMaLSfRA/Qk4YvEgnMEm mIcaPNtY9i2IvrDSH0iomKBSTMWX3Gzsr7Du8pLkA664Hgeb9x2P7HGX4vA0Jb2YNZka DMdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/FAoAlSLvfcI0i7QRhMXZk8GBnsbovYktdKIAdYFRD0=; b=tLZBl3wCREBIIpcZ0u0MOBJvW3lVSTKsej+S76AKJjPGiP0/5sTC+JLUdtXB2XIMDI jJLDE4GBf92p+gCa5+rQbSX6u9XTiIMire1GsNKpNRCCap2mEqIUxNLSlzaV30f7lk6Y dyARtMfVnvGR841YjvQtPidu7EAe6gBx0m9KxZg+kWKT3tRaMTPlTSlxU78hFaFqnYwI su6oaZFwNUU6HB7CsYJmHdILMUlDzEXMqXd9ApHsqSD3InUU43/wtim8oNmkGSJ0D+HS Cb8SMStyaghJ453MO4610c+qqF7hLGvF6XyWh+L9dH8pqW2FJARX5rdabn7wnm2ozmxg cpsw== X-Gm-Message-State: AOAM5308VruBS1UwNRJNN0YrphUP7HOTTWZUkUVFShrMX1VGk68nm+b4 DCSa2/vx+cl7o2f2LQrUVzMcHw== X-Google-Smtp-Source: ABdhPJwnGJo/8L8uIr1Y7xX4OxWIaFJkPIXsNj0lLOaM5gLGkdWkuSyEujTbOFvzdhklpv4tf6osTA== X-Received: by 2002:a17:906:5a98:: with SMTP id l24mr3630072ejq.90.1626331572086; Wed, 14 Jul 2021 23:46:12 -0700 (PDT) Received: from enceladus (ppp-94-66-243-35.home.otenet.gr. [94.66.243.35]) by smtp.gmail.com with ESMTPSA id g11sm1950743edt.85.2021.07.14.23.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 23:46:11 -0700 (PDT) Date: Thu, 15 Jul 2021 09:46:09 +0300 From: Ilias Apalodimas To: Masahisa Kojima Cc: Simon Glass , Heinrich Schuchardt , Alexander Graf , Dhananjay Phadke , U-Boot Mailing List Subject: Re: [PATCH 1/5] efi_loader: increase eventlog buffer size Message-ID: References: <20210707133638.12630-1-masahisa.kojima@linaro.org> <20210707133638.12630-2-masahisa.kojima@linaro.org> <303be904-9580-b7be-c059-d0fd65e8b709@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Thu, Jul 15, 2021 at 02:09:57PM +0900, Masahisa Kojima wrote: > Hi Simon, Ilias, > > On Wed, 14 Jul 2021 at 23:50, Simon Glass wrote: > > > > Hi Masahisa, > > > > On Mon, 12 Jul 2021 at 02:40, Masahisa Kojima > > wrote: > > > > > > Hi Simon, > > > > > > On Sun, 11 Jul 2021 at 09:01, Simon Glass wrote: > > > > > > > > Hi Masahisa, > > > > > > > > On Wed, 7 Jul 2021 at 20:21, Masahisa Kojima wrote: > > > > > > > > > > On Wed, 7 Jul 2021 at 22:47, Heinrich Schuchardt wrote: > > > > > > > > > > > > > > > > > > > > > > > > On 7/7/21 3:36 PM, Masahisa Kojima wrote: > > > > > > > This is a preperation to add eventlog support > > > > > > > described in TCG PC Client PFP spec. > > > > > > > > > > > > > > Signed-off-by: Masahisa Kojima > > > > > > > --- > > > > > > > lib/efi_loader/Kconfig | 2 +- > > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > > > diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig > > > > > > > index b2ab48a048..a87bf3cc98 100644 > > > > > > > --- a/lib/efi_loader/Kconfig > > > > > > > +++ b/lib/efi_loader/Kconfig > > > > > > > @@ -327,7 +327,7 @@ config EFI_TCG2_PROTOCOL > > > > > > > config EFI_TCG2_PROTOCOL_EVENTLOG_SIZE > > > > > > > int "EFI_TCG2_PROTOCOL EventLog size" > > > > > > > depends on EFI_TCG2_PROTOCOL > > > > > > > - default 4096 > > > > > > > + default 16384 > > > > > > > > > > > > I found this text in EDK II: > > > > > > > > > > > > Minimum length(in bytes) of the system preboot TCG event log area(LAML) > > > > > > ----------------------------------------------------------------------- > > > > > > > > > > > > For PC Client Implementation spec up to and including 1.2 the minimum > > > > > > log size is 64KB. (SecurityPkg/SecurityPkg.dec) > > > > > > > > > > Thank you for your feedback. > > > > > I have not checked this. > > > > > TCG spec also says "The Log Area Minimum Length for the TCG event log > > > > > MUST be at least 64KB." in ACPI chapter. > > > > > I will update to set 64KB as default. > > > > > > > > > > > > > Is this the same as the BLOBLISTT_TPM2_TCG_LOG thing? If so, can we > > > > put this in the bloblist? We want to avoid adding code in EFI which is > > > > in U-Boot. > > > > > > I think bloblist is used for data passing from SPL/TPL to u-boot. > > > > It can also be used to place things in memory that end up accessed by > > Linux, e.g. ACPI tables. So I think it fits. > > I understand bloblist can be used for eventlog, I will check further. > > > > > > Is your comment saying that the eventlog generated > > > in u-boot(done in efi_tcg2.c with this patch series) should be appended > > > into the buffer pointed by BLOBLISTT_TPM2_TCG_LOG blob? > > > > I suppose so, but this logic should be implemented in the TPM layer I > > think, not just in EFI. Otherwise we end up with another parallel > > implementation. > > Current u-boot/lib/efi_loader/efi_tcg2.c includes the code > not directly related to EFI. > I would like to suggest to divide u-boot/lib/efi_loader/efi_tcg2.c > into two files. > > 1) u-boot/lib/efi_loader/efi_tcg2.c > This file implements the EFI interfaces required in TCG EFI Protocol > Specification(https://trustedcomputinggroup.org/resource/tcg-efi-protocol-specification/). > The only problem I see with the way the efi tcg2 eventlog is currently created, is that it's all done during the efi init. Ideally this should happen earlier, especially if SPL or TF-A create their own eventlog. The status with TF-A atm is that it only creates an eventlog which then copies to secure and non-secure memory, but it doesnt extend the PCRs. We should pick that eventlog from u-boot (or better op-tee), extend the PCRs based on the information of the log and then use it as our basis and start appending events there. > 2) u-boot/lib/tcg2.c(new file) > This file implements the functionality required in TCG PC Client > Platform Firmware Profile > Specification(https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/). > This file contains the common functions to extend eventlog and PCRs, etc. Splitting up the pc client spec bits is probably a good idea. What do you have in mind? Moving tcg2_pcr_extend() and tcg2_agile_log_append() as well, or just the pc client related wrappers? > > In addition, this is different topic, I found some tpm related files > under u-boot/lib directory, I think it better to have new directory > like "tcg" and move tpm related files such as tpm_api.c, tpm-v2.c > and tpm-common.c into lib/tcg(new directory). +1 Regards /Ilias > > Thanks, > Masahisa Kojima > > > > > Regards, > > Simon