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 38DADD80127 for ; Mon, 18 Mar 2024 20:43:46 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=PlUKgcMOQhhphVLpBL8kUltlH9wNpEgU+9E1k3MWpBY=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:nodisclaimer:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1710794624; v=1; b=pezQoX75HJff+5vPAWoGzQLu5ppogf27tfrhmF+kFYh46Ssmy2OOqQDWGGNxIGdiBHJh2fet Bxd2w5DHQl75hxYYtmsDOvTtlbxsRQwaeay/gNzCMQkctoBRUjrkKlW82ctDxenq7spYtIwXSKq QsN/cWGn4S/lpkr7sXot3gwJQt8otldHAw+rpxh0WZKZ8YT1hiziZYJTaWsgLsB2rYfY38F5NHP 788o2eLs2iHCEXgykfu1CpaelN78QXdrG5mYcgWDDFNrULxypi1DP44KMyx5Fu/hiIU1+poaU4+ 27L3ud70zccxDdiEln6I94+ngkBj9K9q0i3HyJzPrIKiA== X-Received: by 127.0.0.2 with SMTP id yKKBYY7687511xAdTMCyxH0v; Mon, 18 Mar 2024 13:43:44 -0700 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.103]) by mx.groups.io with SMTP id smtpd.web10.56300.1710794623735394474 for ; Mon, 18 Mar 2024 13:43:44 -0700 X-Received: from AS8PR08MB7791.eurprd08.prod.outlook.com (2603:10a6:20b:52d::6) by AM8PR08MB6545.eurprd08.prod.outlook.com (2603:10a6:20b:368::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26; Mon, 18 Mar 2024 20:43:41 +0000 X-Received: from AS8PR08MB7791.eurprd08.prod.outlook.com ([fe80::8ed9:ec8b:75b7:f127]) by AS8PR08MB7791.eurprd08.prod.outlook.com ([fe80::8ed9:ec8b:75b7:f127%6]) with mapi id 15.20.7386.025; Mon, 18 Mar 2024 20:43:41 +0000 From: "Sunny Wang" To: "devel@edk2.groups.io" , Stuart Yoder , G Edhaya Chandran , "gaojie@byosoft.com.cn" CC: "ilias.apalodimas@linaro.org" , "heinrich.schuchardt@canonical.com" , Samer El-Haj-Mahmoud , "Jiewen.Yao@intel.com" Subject: Re: [edk2-devel] [PATCH v2 3/6] uefi-sct/SctPkg: TCG2 Protocol: add GetActivePcrBanks test Thread-Topic: [edk2-devel] [PATCH v2 3/6] uefi-sct/SctPkg: TCG2 Protocol: add GetActivePcrBanks test Thread-Index: AQHaQyjUix+ul5+B+02LZfRKYHqw8bE+Y4Rg Date: Mon, 18 Mar 2024 20:43:41 +0000 Message-ID: References: <20240109182053.2540542-1-stuart.yoder@arm.com> <20240109182053.2540542-4-stuart.yoder@arm.com> In-Reply-To: <20240109182053.2540542-4-stuart.yoder@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 2D2263E95ED20F4FAB48724E36AE43D9.0 x-checkrecipientchecked: true x-ms-publictraffictype: Email x-ms-traffictypediagnostic: AS8PR08MB7791:EE_|AM8PR08MB6545:EE_ nodisclaimer: true x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: NSK3vYHATIEQMjj/EslbTUuI9LSXOZq4HowkCOTKUPoJpWr23xW8aY6P6lOollTj2Ai/093AecM7/t1nNId3aZp0lS/ZTY+s3SxtUL3YuhYPo2NUu9WhaYo+mFCS6n3BVFqeMTaDkvpicX2dZX3fr9rGbLZnAwDARrcAmnWIb48SEumwjqieY6oIbo/OVpK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0xjQobvJVMlHH/F8nEz8ijwSw?= =?us-ascii?Q?ikZ2/2Q09n6zcNFSaTQRODr1W/LFgF2Db70h5L1DA74YcL4IjZLHliMRJPny?= =?us-ascii?Q?XHdbU4yE+6lFUQ9pXTWxq4I750YtFlT5C6bWWKW65bE5FViy+nPQbXwn57lT?= =?us-ascii?Q?b0OpEKJwnq5ZSqlFitdFuFJ210HN/mC0G4vo13IGz1r0gK1hjKAQxHLa4WkH?= =?us-ascii?Q?4Q43iUYNSf1TgN7r+r0=3D?= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7791.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2e08e75-1903-4a98-cffe-08dc478c186c X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2024 20:43:41.0381 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: cdlLp3OVxmV0vO5eGjADYww0ja/ndshPGBGIIsqeKI2U1g2zcIwPoa6XDR5+uEOLuq1h2v9h3DgxvDgcJpbVxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6545 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: Mon, 18 Mar 2024 13:43:44 -0700 Reply-To: devel@edk2.groups.io,Sunny.Wang@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 7uIeDDH19VTtCZBxJvFCQyT1x7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" 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=pezQoX75; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none) Looks good to me. For others' reference, the change has been already verified by running Syst= emReady SIE (Security Interface extension) tests on multiple SystemReady ce= rtified Arm systems. Reviewed-by: Sunny Wang -----Original Message----- From: devel@edk2.groups.io On Behalf Of Stuart Yoder= via groups.io Sent: Tuesday, January 9, 2024 12:21 PM To: devel@edk2.groups.io; G Edhaya Chandran ; gaoj= ie@byosoft.com.cn Cc: ilias.apalodimas@linaro.org; heinrich.schuchardt@canonical.com; Samer E= l-Haj-Mahmoud ; Jiewen.Yao@intel.com Subject: [edk2-devel] [PATCH v2 3/6] uefi-sct/SctPkg: TCG2 Protocol: add Ge= tActivePcrBanks test From: Joseph Hemann -add test for GetActivePcrBanks() -checkpoint for NULL pointer passed for buffer -checkpoint for test of function with proper input Signed-off-by: Joseph Hemann Signed-off-by: Stuart Yoder --- uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.h = | 11 ++ uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolB= BTest.h | 23 +++ uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.c = | 4 + uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolB= BTestConformance.c | 159 ++++++++++++++++++++ uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolB= BTestMain.c | 9 ++ 5 files changed, 206 insertions(+) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/G= uid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.h index 50b14272939f..d6797f5287f4 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.h +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.h @@ -45,3 +45,14 @@ extern EFI_GUID gTcg2ConformanceTestAssertionGuid003; { 0x8ddb031b, 0x7448, 0x40ee, {0xb1, 0xa2, 0xe6, 0xf8, 0xe8, 0xc4, 0xe5, 0= x5f }} extern EFI_GUID gTcg2ConformanceTestAssertionGuid004; + +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_005_GUID \ +{ 0x7a1e79a3, 0x4064, 0x4372, {0xbb, 0x64, 0x55, 0xb8, 0xf2, 0xa5, 0xa3, 0= x26 }} + +extern EFI_GUID gTcg2ConformanceTestAssertionGuid005; + +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_006_GUID \ +{ 0xb0e717c4, 0xb1e2, 0x49f7, {0xb2, 0xd7, 0x60, 0x58, 0x97, 0x7d, 0x09, 0= x2c }} + +extern EFI_GUID gTcg2ConformanceTestAssertionGuid006; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/T= CG2ProtocolBBTest.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/Black= BoxTest/TCG2ProtocolBBTest.h index a7ce2db322d9..80c02d9ed2d2 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2Prot= ocolBBTest.h +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2Prot= ocolBBTest.h @@ -37,6 +37,9 @@ Abstract: #define EFI_TCG2_PROTOCOL_TEST_ENTRY_GUID0101 \ {0x39ff9c71, 0x4b41, 0x4e5b, {0xae, 0xd7, 0x87, 0xc7, 0x94, 0x18, 0x7d, 0= x67} } +#define EFI_TCG2_PROTOCOL_TEST_ENTRY_GUID0102 \ + {0x847f1ae0, 0xb429, 0x49f1, {0x9e, 0x0c, 0x8f, 0x43, 0xfb, 0x55, 0x34, 0= x54} } + EFI_STATUS EFIAPI BBTestTCG2ProtocolUnload ( @@ -67,6 +70,18 @@ BBTestGetCapabilityConformanceTestCheckpoint4 ( IN EFI_TCG2_PROTOCOL *TCG2 ); +EFI_STATUS +BBTestGetActivePcrBanksConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_TCG2_PROTOCOL *TCG2 + ); + +EFI_STATUS +BBTestGetActivePcrBanksConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_TCG2_PROTOCOL *TCG2 + ); + EFI_STATUS BBTestGetCapabilityConformanceTest ( IN EFI_BB_TEST_PROTOCOL *This, @@ -75,3 +90,11 @@ BBTestGetCapabilityConformanceTest ( IN EFI_HANDLE SupportHandle ); +EFI_STATUS +BBTestGetActivePcrBanksConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ); + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/G= uid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.c index 3e75ffdc0a60..0dc2cfddfcbf 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.c @@ -35,3 +35,7 @@ EFI_GUID gTcg2ConformanceTestAssertionGuid002 =3D EFI_TES= T_TCG2CONFORMANCE_ASSERTI EFI_GUID gTcg2ConformanceTestAssertionGuid003 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_003_GUID; EFI_GUID gTcg2ConformanceTestAssertionGuid004 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_004_GUID; + +EFI_GUID gTcg2ConformanceTestAssertionGuid005 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_005_GUID; + +EFI_GUID gTcg2ConformanceTestAssertionGuid006 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_006_GUID; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/T= CG2ProtocolBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol= /TCG2/BlackBoxTest/TCG2ProtocolBBTestConformance.c index 686cf4baebcd..681f57ac224a 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2Prot= ocolBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2Prot= ocolBBTestConformance.c @@ -87,6 +87,58 @@ BBTestGetCapabilityConformanceTest ( return EFI_SUCCESS; } +/** + * @brief Entrypoint for GetActivePcrBanks() Function Test. + * 2 checkpoints will be tested. + * @param This a pointer of EFI_BB_TEST_PROTOCOL + * @param ClientInterface A pointer to the interface array under test + * @param TestLevel Test "thoroughness" control + * @param SupportHandle A handle containing protocols required + * @return EFI_SUCCESS + * @return EFI_NOT_FOUND + */ + +EFI_STATUS +BBTestGetActivePcrBanksConformanceTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_TCG2_PROTOCOL *TCG2; + + // + // init + // + TCG2 =3D (EFI_TCG2_PROTOCOL*)ClientInterface; + + // Ensure Protocol not NULL + if (TCG2 =3D=3D NULL) + return EFI_UNSUPPORTED; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + + // Test with invalid (NULL) bitmap + BBTestGetActivePcrBanksConformanceTestCheckpoint1 (StandardLib, TCG2); + + // Test with valid bitmap + BBTestGetActivePcrBanksConformanceTestCheckpoint2 (StandardLib, TCG2); + + return EFI_SUCCESS; +} EFI_STATUS BBTestGetCapabilityConformanceTestCheckpoint1 ( @@ -359,3 +411,110 @@ BBTestGetCapabilityConformanceTestCheckpoint4 ( return EFI_SUCCESS; } +EFI_STATUS +BBTestGetActivePcrBanksConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_TCG2_PROTOCOL *TCG2 + ) +{ + EFI_TEST_ASSERTION AssertionType; + EFI_STATUS Status; + + EFI_TCG2_EVENT_ALGORITHM_BITMAP *ActivePcrBanks =3D NULL; + Status =3D TCG2->GetActivePcrBanks ( + TCG2, + ActivePcrBanks); + + // Ensure GetActivePcrBanks returns Invalid Parameter when passing in NU= LL pointer + if (EFI_INVALID_PARAMETER =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gTcg2ConformanceTestAssertionGuid005, + L"TCG2_PROTOCOL.GetActivePcrBanks - GetActivePcrBanks() r= eturns EFI_INVALID_PARAMETER with NULL pointer Passed in", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + return EFI_SUCCESS; +} + +EFI_STATUS +BBTestGetActivePcrBanksConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_TCG2_PROTOCOL *TCG2 + ) +{ + EFI_TEST_ASSERTION AssertionType; + EFI_STATUS Status; + EFI_TCG2_EVENT_ALGORITHM_BITMAP ActivePcrBanks; + EFI_TCG2_BOOT_SERVICE_CAPABILITY BootServiceCap; + + Status =3D TCG2->GetActivePcrBanks ( + TCG2, + &ActivePcrBanks); + + // Ensure GetActivePcrBanks returns EFI_SUCCESS + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_DEFAULT, + L"\r\nTCG2 Protocol GetActivePcrBanks Test: GetActive= PcrBanks should return EFI_SUCCESS" + ); + + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + EFI_TCG2_EVENT_ALGORITHM_BITMAP BitMapAlgos =3D EFI_TCG2_BOOT_HASH_ALG_= SHA256 | EFI_TCG2_BOOT_HASH_ALG_SHA384 | EFI_TCG2_BOOT_HASH_ALG_SHA512; + + // Ensure ActivePcrBanks has SHA256/384/512 in its Bitmap + if (!(ActivePcrBanks & BitMapAlgos)) { + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_DEFAULT, + L"\r\nTCG2 Protocol GetActivePcrBanks Test: GetActive= PcrBanks should have SHA256/384/512 Algorithm in its Bitmap. ActivePcrBanks= =3D %x", + ActivePcrBanks + ); + + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + BootServiceCap.Size =3D sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY); + + Status =3D TCG2->GetCapability ( + TCG2, + &BootServiceCap); + + // Ensure ActivePcrBanks is the same returned as GetCapability() + if (ActivePcrBanks !=3D BootServiceCap.ActivePcrBanks) { + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_DEFAULT, + L"\r\nTCG2 Protocol GetActivePcrBanks Test:Returned A= ctivePcrBanks should match the one returned by GetCapability()" + ); + + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gTcg2ConformanceTestAssertionGuid006, + L"TCG2_PROTOCOL.GetActivePcrBanks - GetActivePcrBanks sho= uld return with EFI_SUCCESS and have SHA256/384/512 Algoritms in its Bitmap= ", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + return EFI_SUCCESS; +} diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/T= CG2ProtocolBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/B= lackBoxTest/TCG2ProtocolBBTestMain.c index 1de87e9d4c66..7fc202246cd8 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2Prot= ocolBBTestMain.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2Prot= ocolBBTestMain.c @@ -47,6 +47,15 @@ EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] =3D { EFI_TEST_CASE_AUTO, BBTestGetCapabilityConformanceTest }, + { + EFI_TCG2_PROTOCOL_TEST_ENTRY_GUID0102, + L"GetActivePcrBanks_Conf", + L"Test the GetActivePcrBanks API", + EFI_TEST_LEVEL_DEFAULT, + gSupportProtocolGuid1, + EFI_TEST_CASE_AUTO, + BBTestGetActivePcrBanksConformanceTest + }, 0 }; -- 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113486): https://edk2.groups.io/g/devel/message/113486 Mute This Topic: https://groups.io/mt/103625301/5985097 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [Sunny.Wang@arm.com] -=3D-=3D-=3D-=3D-=3D-=3D IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you. -=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 (#116847): https://edk2.groups.io/g/devel/message/116847 Mute This Topic: https://groups.io/mt/103625301/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-