From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7036074003D for ; Tue, 9 Apr 2024 19:16:57 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=SWzOSmMQ9ORzrJQzcK5HgdsND4rytfAsSL1pL0MZVDQ=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1712690216; v=1; b=hiLDvnI78hGZ0gemyrmFIXrHP5EjqgtjidjLmWKpaT0KrMHpMKJmHOoTQO6eMNminXK+Lmly aDRm1kGQkPiuIv2ruavBzpX9fJCx+og0Y02YoKN79Yt18lLPADTSfnOfX6T+lqd87QY1die0Yhw lIVPFelFn7A11KV7OHc8Th4W/DM7FJ8SAuvhBH8gWqrfxqRqHP3xKvMexjitqJmRFVUwyrR7puv zRgkMRWCGtQQ/2rKAeUnGev6MoypjLL1UCX8gRwW2tEHZXnUWvBdOZeIFkg50OBJuAh47VLA739 sDECXhyKL8GuUWDJ6KdfkUzADiukl/zmBmgUhbScSUnfg== X-Received: by 127.0.0.2 with SMTP id Kfl1YY7687511xku5J9m1RN2; Tue, 09 Apr 2024 12:16:56 -0700 X-Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) by mx.groups.io with SMTP id smtpd.web11.147672.1712690215011538962 for ; Tue, 09 Apr 2024 12:16:55 -0700 X-Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-56e85b7d2d1so3974a12.1 for ; Tue, 09 Apr 2024 12:16:54 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCW5da9T4W7I6mmGNe243ZEBFiyUg+b6H75pfgGEUHAHJOOjfkF9kAC7GrPPWaaSgDqL2mH4i8ud4mbiy5WcVPw2UsZA1w== X-Gm-Message-State: cAuYdAP8ZEKJB4jA0tfPPOwpx7686176AA= X-Google-Smtp-Source: AGHT+IFUkjRUQ7716ygpqXajutA1DnnioFCSZzrH71rZ+4puIGM4SBl8vhzR+fSpKb4d5K1105cMePvMNK+uO8MftUM= X-Received: by 2002:aa7:d3c7:0:b0:56e:76e:6ea9 with SMTP id o7-20020aa7d3c7000000b0056e076e6ea9mr28102edr.6.1712690213037; Tue, 09 Apr 2024 12:16:53 -0700 (PDT) MIME-Version: 1.0 References: <94521f20aa2872c1b8f018b7db31eca4a2b8222d.1711039409.git.qinkun@google.com> <17C329C4A6D0CD18.8175@lists.confidentialcomputing.io> In-Reply-To: From: "qinkun Bao via groups.io" Date: Tue, 9 Apr 2024 09:16:40 -1000 Message-ID: Subject: Re: [edk2-devel] [linux-collab] [CCC][tac] [RFC PATCH] OvmfPkg/SecurityPkg: Add build option for coexistance of vTPM and RTMR. To: PH0PR11MB587959168F72B20E0AC836438C312@ph0pr11mb5879.namprd11.prod.outlook.com Cc: Dionna Glaze , Ard Biesheuvel , devel@edk2.groups.io, Erdem Aktas , James Bottomley , "Yao, Jiewen" , Gerd Hoffmann , linux-coco@lists.linux.dev, Michael Roth , Peter Gonda , Qinkun Bao , Tom Lendacky , Cfir Cohen , Chris Fenner , Ronald Aigner , mingshen.sun@tiktok.com, mikko.ylinen@linux.intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Tue, 09 Apr 2024 12:16:55 -0700 Resent-From: qinkun@google.com Reply-To: devel@edk2.groups.io,qinkun@google.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=hiLDvnI7; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io I brought the RFC into the CCC community (https://github.com/confidential-computing/governance) and received some comments. Forward the email into the EDK2 dev and linux-coco. Thanks, Qinkun ---------- Forwarded message --------- From: Mingshen Sun Date: Thu, Apr 4, 2024 at 1:43=E2=80=AFPM Subject: Re: [External] Re: [linux-collab] [CCC][tac] [RFC PATCH] OvmfPkg/SecurityPkg: Add build option for coexistance of vTPM and RTMR. To: Cc: , Hi Qinkun, Thanks for bringing this to the CCC community. I think the proposal makes sense to me. RTMR and vTPM measurements shouldn't be mutually exclusive. Under certain threat models (e.g., workload operator is not trusted), both of them may be valid. 1. Measurements of RTMR and vTPM can be used for cross validation with different root-of-trust. 2. Key sealing feature provided by vTPM is not available in the current TEE ecosystem. Mingshen On Thu, Apr 4, 2024 at 12:32=E2=80=AFPM qinkun Bao via lists.confidentialcomputing.io wrote: > > Hello, > > The current TDVF implementation does not extend to the vTPM if the > RTMR attestation is enabled. We are working on proposals to address > the issue. We would like to get the feedback from the CCC community > about the proposal. > > Thanks, > Qinkun > > On Thu, Apr 4, 2024 at 12:16=E2=80=AFPM qinkun Bao via > lists.confidentialcomputing.io > wrote: > > > > > > > > ---------- Forwarded message --------- > > From: qinkun Bao > > Date: Thu, Mar 21, 2024 at 9:59=E2=80=AFAM > > Subject: [RFC PATCH] OvmfPkg/SecurityPkg: Add build option for coexista= nce of vTPM and RTMR. > > To: > > Cc: , Erdem Aktas , = Jiewen Yao , Ard Biesheuvel , Peter = Gonda , Dionna Glaze , Qinkun Ba= o , James Bottomley , Gerd Hoffmann = , Tom Lendacky , Michael Roth <= michael.roth@amd.com> > > > > > > From: Qinkun Bao > > > > The UEFI v2.10 spec defines the protocol EFI_CC_MEASUREMENT_PROTOCOL > > to enable (for example) RTMR-based boot measurement for TDX VMs. > > With the current UEFI spec=E2=80=99s =E2=80=9Cshould not=E2=80=9D wordi= ng and EDK2 > > implementation, TPM measurement in TDVF is disabled when > > RTMR measurement is enabled. > > > > Mutual exclusion of the CC measurement protocol and TCG measurement > > protocol breaks backwards compatibility, which makes adoption of RTMRs > > challenging. A virtualized TPM device (vTPM) managed by the host VMM > > makes boot measurements visible to the VMM operator, but this is an > > oft-requested feature that users can choose to accept. > > > > The TPM has been a standard for over a decade and many existing > > applications rely on the TPM. Both inside and outside Google, > > we have many users that require vTPM, including features that are > > not easily available via RTMRs (e.g. sealing using keys that the > > guest OS cannot access). > > > > This patch adds a non-default build option to allow the coexistence > > of both the CC measurement and TCG protocols. Not included is a > > vendor-specific measured event in the CC event log that indicates > > whether a vTPM is attached or not. > > > > Cc: Erdem Aktas > > Cc: James Bottomley > > Cc: Jiewen Yao > > Cc: Gerd Hoffmann > > Cc: Tom Lendacky > > Cc: Michael Roth > > Signed-off-by: Qinkun Bao > > --- > > OvmfPkg/OvmfPkgX64.dsc | 9 ++++++++- > > .../DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c | 12 +++++++++++- > > .../DxeTpmMeasurementLib/DxeTpmMeasurementLib.c | 6 ++++++ > > 3 files changed, 25 insertions(+), 2 deletions(-) > > > > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc > > index 56c920168d..9bcee45047 100644 > > --- a/OvmfPkg/OvmfPkgX64.dsc > > +++ b/OvmfPkg/OvmfPkgX64.dsc > > @@ -32,7 +32,8 @@ > > DEFINE SECURE_BOOT_ENABLE =3D FALSE > > DEFINE SMM_REQUIRE =3D FALSE > > DEFINE SOURCE_DEBUG_ENABLE =3D FALSE > > - DEFINE CC_MEASUREMENT_ENABLE =3D FALSE > > + DEFINE CC_MEASUREMENT_ENABLE =3D TRUE > > + DEFINE CC_MEASUREMENT_AND_TCG2_COEXIST =3D FASLE > > > > !include OvmfPkg/Include/Dsc/OvmfTpmDefines.dsc.inc > > > > @@ -99,6 +100,11 @@ > > INTEL:*_*_X64_GENFW_FLAGS =3D --keepexceptiontable > > !endif > > RELEASE_*_*_GENFW_FLAGS =3D --zero > > +!if $(CC_MEASUREMENT_ENABLE) =3D=3D TRUE && $(CC_MEASUREMENT_AND_TCG2_= COEXIST) =3D=3D TRUE > > + MSFT:*_*_*_CC_FLAGS =3D /D CC_MEASUREMENT_AND_TCG2_COEXIST_FEATURE > > + INTEL:*_*_*_CC_FLAGS =3D /D CC_MEASUREMENT_AND_TCG2_COEXIST_FEATURE > > + GCC:*_*_*_CC_FLAGS =3D -D CC_MEASUREMENT_AND_TCG2_COEXIST_FEATURE > > +!endif > > > > # > > # Disable deprecated APIs. > > @@ -1045,6 +1051,7 @@ > > } > > !endif > > > > + > > # > > # TPM support > > # > > diff --git a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBo= otLib.c b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c > > index 73719f3b96..4c9bc8ab4a 100644 > > --- a/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c > > +++ b/SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.c > > @@ -325,7 +325,12 @@ Tcg2MeasureGptTable ( > > } > > > > DEBUG ((DEBUG_INFO, "DxeTpm2MeasureBootHandler - Cc MeasureGptTabl= e - %r\n", Status)); > > +#ifdef CC_MEASUREMENT_AND_TCG2_COEXIST_FEATURE > > + } > > + if (Tcg2Protocol !=3D NULL) { > > +#else > > } else if (Tcg2Protocol !=3D NULL) { > > +#endif > > // > > // If Tcg2Protocol is installed, then Measure GPT data with this p= rotocol. > > // > > @@ -493,7 +498,12 @@ Tcg2MeasurePeImage ( > > CcEvent > > ); > > DEBUG ((DEBUG_INFO, "DxeTpm2MeasureBootHandler - Cc MeasurePeImage= - %r\n", Status)); > > - } else if (Tcg2Protocol !=3D NULL) { > > +#ifdef CC_MEASUREMENT_AND_TCG2_COEXIST_FEATURE > > + } > > + if (Tcg2Protocol !=3D NULL) { > > +#else > > + } else if (Tcg2Protocol !=3D NULL) { > > +#endif > > Status =3D Tcg2Protocol->HashLogExtendEvent ( > > Tcg2Protocol, > > PE_COFF_IMAGE, > > diff --git a/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurement= Lib.c b/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.c > > index 6f287b31fc..b1c6198b4b 100644 > > --- a/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.c > > +++ b/SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.c > > @@ -261,7 +261,11 @@ TpmMeasureAndLogData ( > > HashData, > > HashDataLen > > ); > > +#ifdef CC_MEASUREMENT_AND_TCG2_COEXIST_FEATURE > > + } > > +#else > > } else { > > +#endif > > // > > // Try to measure using Tpm20 protocol > > // > > @@ -287,7 +291,9 @@ TpmMeasureAndLogData ( > > HashDataLen > > ); > > } > > +#ifndef CC_MEASUREMENT_AND_TCG2_COEXIST_FEATURE > > } > > +#endif > > > > return Status; > > } > > -- > > 2.44.0.291.gc1ea87d7ee-goog > > > > > > >=20 > > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117554): https://edk2.groups.io/g/devel/message/117554 Mute This Topic: https://groups.io/mt/105428501/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-