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 7DC72D80127 for ; Mon, 18 Mar 2024 20:43:58 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=X79ZXKtjkKlMW7KQboBrrs6jz/W8F/pvNpGJ6C60ESg=; 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=1710794637; v=1; b=XUhIuI/UrQaWPrBy2/UI1YG+H6Odxibui4FexpRlp4LjuPVPHn6HM8D7RuuYGNVtGDWc1vyY bYGH9m8NfO+lnViHZ4sYFGmCbmVmFkG/qtNlbSAB0QKSAKz7o4r9Dtj8fTM0SmswEuWR1SxsySK RbV0I/M7DG7l1++t1ey6+Nz0soE73hRWjjIbE+BOauXwPHpz0iKidDGttxf+Z1K7O/ZmLE4G/ZC iJZL/bUA+Hmw1D19i7wxCBH7WlCou1OM9lO8EFYtfMEiNVcDfnTW9L+G0gDL/v3B8LQmV5Bvvbl 25fQqkLYI6kpXAiTsnnroGZ42YiU5zmiSh9bAULijJV9A== X-Received: by 127.0.0.2 with SMTP id 2D2OYY7687511xUWic0f7C3b; Mon, 18 Mar 2024 13:43:57 -0700 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.93]) by mx.groups.io with SMTP id smtpd.web10.56306.1710794636194963556 for ; Mon, 18 Mar 2024 13:43:56 -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:53 +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:53 +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" , Sunny Wang Subject: Re: [edk2-devel] [PATCH v2 4/6] uefi-sct/SctPkg: TCG2 Protocol: add HashLogExtendEvent test Thread-Topic: [edk2-devel] [PATCH v2 4/6] uefi-sct/SctPkg: TCG2 Protocol: add HashLogExtendEvent test Thread-Index: AQHaQyjba0tK2CYDuk6R7t7regRdJrE+Y5vw Date: Mon, 18 Mar 2024 20:43:53 +0000 Message-ID: References: <20240109182053.2540542-1-stuart.yoder@arm.com> <20240109182053.2540542-5-stuart.yoder@arm.com> In-Reply-To: <20240109182053.2540542-5-stuart.yoder@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 5FE0FE1093AFF948843568182303FFF8.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: wto/KCQqEiOk27MNv224d/lhgQvOTFrB+Xmiphe/NS5sZxaQYqM+V9S33D3XYFvJZ4NTnFGGhvi6F6zHNJye4iE/hbCzofVpRB0OcaA5BKMw4duiXokFHq2wmHkGvFdMtqw/OYw0krQ4Xy4mZy5oIDqLntsVkicLfM1eEkqrF00koV7Ksyi0KPqBWXYezZm3reqmeQbnkyrCiQ9Erd1lh//kh45pK3z3jsf/mJT2s99g3rR9yDWhu3KLXkmLNtKNhAuxal/MHV2Igzn5BK8LsfRnUcDIUqxqim5nolL75tMxqoH0DsJoRD+6VahviUm0spHpaZ+TwuygKqorsWZmN1ViLJ+rF1RWoG49ZDJOJ24gnC+Mukvjk/dEPrNN+6vT/CrIaeC1PgCaLSNLXK/+bENWTj8uxInAC0fCu6Q4F/509w5ewogO/zKI0Lki/ByyHzzhf7L5w7RVJhFx9Qt8Y0/CsqK4sANySGtNwyrkTjMTTXH52LxCgJPKttqgNSe96YRQaSx42+1ThdSct5f2hwpNV+L96TIjjMPm32aEzwn8dOxQq+/K1d6mUjYuLHd1m7uI0dJTfWu389le2dBpU90nR3UxesdYbthEH346DuA= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?7zebz1KdBzHlyPRW/S6wek5ftFWgnfZF19bJ7o1DP1h+GysRfGVFOY2fNZEN?= =?us-ascii?Q?imr9cRnt8aGEeaVFoXlm6HH0FjmshDKp3o24gwj4PGz+MkezeXUKh27mrLhi?= =?us-ascii?Q?tdijEbWkXXXWqhfoLo80tjsij93pjA5A2CF+iNNa0mnM15pCHDfWWz0BQUXd?= =?us-ascii?Q?JuTuS5BIDJ9w65nw3UV6yK0Bkst7a8unPCzXV+xrKKsFqEwdPMVs8kPKrn/X?= =?us-ascii?Q?HerjEs0grPYqbiOyp9A205d2XpFhKCADQ/2VbOflVaBe4Q0w0+GNbUGh1OWt?= =?us-ascii?Q?ENDkww9QQZpjRIjVlUwWKqTAnfcLnQ8m8FSRtS1gxAfe8UFmKlk/rHx06tEq?= =?us-ascii?Q?saTAoIVtnstrZIMjRs0J4fj2wm/Cm9sH3fNacrEycbtOj5xCnRSq5S1v6E/x?= =?us-ascii?Q?I4WbpEF2HOCxRQqccavDIAecBT1YuNoib9C4aHu/UQDQUuKKQvMTM4E4dKEX?= =?us-ascii?Q?BwzA34fgtqS8u0KfC5MNri18k65ZunTkvAKYoep3K8pwxsW/YQ46XkkxTCim?= =?us-ascii?Q?01ZKj7D0HfSpsxaR9mAAt/EiSoE42tx50G9FltC8ZRawwPzn/cbmUVbYsojJ?= =?us-ascii?Q?SQy4Ng0MOv8pq/t+Eni3uSramCt6zohimL6j+Y5Roa1maTorP16VK4NVZ0Xx?= =?us-ascii?Q?q/d9tO7UYtRdgEvuBr0ybaVADziIrGZV1oxwDVJTNMis1xUV0znXSgalvZDC?= =?us-ascii?Q?2RW6iCNsQSIgGmHVL/yZvMkQVG47etGKDLIvvhDRIiFTTbN0jhOolyTaUpGN?= =?us-ascii?Q?cbbc1kCaz2NdlA9WlVHYmR3nDCaAGcV4BPrGTsSxT5k3CxadyQA29Oa5JEeQ?= =?us-ascii?Q?SYx822ThqxR1Hcc8p8SAa3lSbw3jr5tFClQ+g3Me/Jultrrw4/VoJ+df3UT7?= =?us-ascii?Q?ZhsK5SaXaafth6VcrwQVo/K9ojgR5KFu7/QfP+SVT4KjaoWMd7u4ckv5SkED?= =?us-ascii?Q?JGQ7V+3Ujckvprg4HQ0Z6a9xpr7ycdlPNe2y+duWULgqTQFntKAW8RwVXD87?= =?us-ascii?Q?6H3ClNaiywPC1zf3GDrBGg+KNfOkoVoqxSqiNTtoPfER+2U4YSpBJuVNLh19?= =?us-ascii?Q?zBs6TLGuHV2iynOw0Le2j6SdvwSP8jX5GeIg3JCXXbXD+f8FR3pzdHmXhdot?= =?us-ascii?Q?fiJDKJ8P/lZ+yNCEc3Ww7VA7RBtdZ7+aKuVW3lSMrZ0rU0w5sKr2GUGvxNNn?= =?us-ascii?Q?wULFqBmSklrA9kXCAjy61OAFvonPYq8dxNoIJjj6gRsVfzuapWQEshsfuXtg?= =?us-ascii?Q?5cV+BnLUBwET3MHbShqF07YVYYo2p9obJEpqGbxjPMEHu0VYPPgw/qwnCVJi?= =?us-ascii?Q?TNWwwJj930VYsBFTiK1ETmhy8g8oSyWp/r9FmUd142LhWoJRsLuK2qpnnZCp?= =?us-ascii?Q?q8UBaH2QlJhKopA+3v5znpNb3/IVyMgiUtRwB7IVdYzw5C3Cp2XRSWsDzXIX?= =?us-ascii?Q?OsfGk9JXKbHxTWKpm2HpUSSk6MbXYKQa5/VhsblO32xtWZKnMSXYZjTAfebI?= =?us-ascii?Q?7/jChovmhg9O1m7t2COe8rmusdCb0/96wEyjXkTj252QUJssGrFuniO1t3Z8?= =?us-ascii?Q?9xeJEXxmJp6kjSmE1gU=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: 7991bf16-9a92-460d-00ab-08dc478c1fba X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2024 20:43:53.2467 (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: c+PaWDoovEQuEnRewTfMO9s8DoTRe0fEwdQqpazetLun59sVqrN70pcV8HMCj9Fb+pIaFfbhUkU+6SZyQUki4Q== 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:56 -0700 Reply-To: devel@edk2.groups.io,Sunny.Wang@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 4dY6mk7GDQiA7Z7K0apFY2K5x7686176AA= 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="XUhIuI/U"; 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 4/6] uefi-sct/SctPkg: TCG2 Protocol: add Ha= shLogExtendEvent test From: Joseph Hemann -add tests for HashLogExtendEvent() -tests with valid, invalid, and out of range parameters -do extend of data to PCR 16 Signed-off-by: Joseph Hemann Signed-off-by: Stuart Yoder --- uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.h = | 29 ++ uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolB= BTest.h | 29 ++ uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/Guid.c = | 12 + uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolB= BTestConformance.c | 283 ++++++++++++++++++++ uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolB= BTestMain.c | 9 + 5 files changed, 362 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 d6797f5287f4..dcfd5919acda 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 @@ -56,3 +56,32 @@ extern EFI_GUID gTcg2ConformanceTestAssertionGuid005; extern EFI_GUID gTcg2ConformanceTestAssertionGuid006; +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_007_GUID \ +{ 0xa8e1b5e6, 0xfc09, 0x461c, {0xb0, 0xe9, 0x2a, 0x49, 0xcd, 0x25, 0xc1, 0= x24 }} + +extern EFI_GUID gTcg2ConformanceTestAssertionGuid007; + +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_008_GUID \ +{ 0x26f04a9b, 0x7b7a, 0x4f47, {0xbe, 0xa8, 0xb1, 0xa6, 0x02, 0x65, 0x19, 0= x8a }} + +extern EFI_GUID gTcg2ConformanceTestAssertionGuid008; + +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_009_GUID \ +{ 0x4d1d9985, 0x91e2, 0x4948, {0x89, 0x16, 0xbb, 0x98, 0x13, 0x62, 0x39, 0= x1d }} + +extern EFI_GUID gTcg2ConformanceTestAssertionGuid009; + +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_010_GUID \ +{ 0xfb59cab7, 0x4f8c, 0x4ded, {0xa4, 0x1c, 0xc8, 0x41, 0x20, 0x1c, 0x37, 0= x22 }} + +extern EFI_GUID gTcg2ConformanceTestAssertionGuid010; + +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_011_GUID \ +{ 0x0363d22f, 0xc66a, 0x4872, {0xa5, 0x46, 0x06, 0x7f, 0x6a, 0x0d, 0xdb, 0= xcd }} + +extern EFI_GUID gTcg2ConformanceTestAssertionGuid011; + +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_012_GUID \ +{ 0x9cd6d636, 0x603a, 0x4b78, {0x80, 0xa3, 0xa3, 0xb9, 0xcc, 0x6a, 0x0b, 0= x08 }} + +extern EFI_GUID gTcg2ConformanceTestAssertionGuid012; 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 80c02d9ed2d2..cbbadef4a5c7 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 @@ -40,6 +40,15 @@ Abstract: #define EFI_TCG2_PROTOCOL_TEST_ENTRY_GUID0102 \ {0x847f1ae0, 0xb429, 0x49f1, {0x9e, 0x0c, 0x8f, 0x43, 0xfb, 0x55, 0x34, 0= x54} } +#define EFI_TCG2_PROTOCOL_TEST_ENTRY_GUID0103 \ + {0x907a7878, 0xb294, 0xf147, {0xe9, 0x0a, 0x65, 0x43, 0xab, 0x55, 0x76, 0= x46} } + +#define EV_POST_CODE 0x01 + +#define EFI_TCG2_EXTEND_ONLY 0x0000000000000001 + +#define PE_COFF_IMAGE 0x0000000000000010 + EFI_STATUS EFIAPI BBTestTCG2ProtocolUnload ( @@ -82,6 +91,18 @@ BBTestGetActivePcrBanksConformanceTestCheckpoint2 ( IN EFI_TCG2_PROTOCOL *TCG2 ); +EFI_STATUS +BBTestHashLogExtendEventConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_TCG2_PROTOCOL *TCG2 + ); + +EFI_STATUS +BBTestHashLogExtendEventConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_TCG2_PROTOCOL *TCG2 + ); + EFI_STATUS BBTestGetCapabilityConformanceTest ( IN EFI_BB_TEST_PROTOCOL *This, @@ -98,3 +119,11 @@ BBTestGetActivePcrBanksConformanceTest ( IN EFI_HANDLE SupportHandle ); +EFI_STATUS +BBTestHashLogExtendEventConformanceTest ( + 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 0dc2cfddfcbf..ccc20259d128 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 @@ -39,3 +39,15 @@ EFI_GUID gTcg2ConformanceTestAssertionGuid004 =3D EFI_TE= ST_TCG2CONFORMANCE_ASSERTI EFI_GUID gTcg2ConformanceTestAssertionGuid005 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_005_GUID; EFI_GUID gTcg2ConformanceTestAssertionGuid006 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_006_GUID; + +EFI_GUID gTcg2ConformanceTestAssertionGuid007 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_007_GUID; + +EFI_GUID gTcg2ConformanceTestAssertionGuid008 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_008_GUID; + +EFI_GUID gTcg2ConformanceTestAssertionGuid009 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_009_GUID; + +EFI_GUID gTcg2ConformanceTestAssertionGuid010 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_010_GUID; + +EFI_GUID gTcg2ConformanceTestAssertionGuid011 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_011_GUID; + +EFI_GUID gTcg2ConformanceTestAssertionGuid012 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_012_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 681f57ac224a..2768eef725e8 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 @@ -140,6 +140,57 @@ BBTestGetActivePcrBanksConformanceTest ( return EFI_SUCCESS; } +/** + * @brief Entrypoint for HashLogExtendEvent() 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 +BBTestHashLogExtendEventConformanceTest ( + 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 HashLogExtendEvent with invalid arguments + BBTestHashLogExtendEventConformanceTestCheckpoint1 (StandardLib, TCG2); + + // Test HashLogExtendEvent with valid arguments + BBTestHashLogExtendEventConformanceTestCheckpoint2 (StandardLib, TCG2); + + return EFI_SUCCESS; +} + EFI_STATUS BBTestGetCapabilityConformanceTestCheckpoint1 ( IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, @@ -518,3 +569,235 @@ BBTestGetActivePcrBanksConformanceTestCheckpoint2 ( return EFI_SUCCESS; } + +EFI_STATUS +BBTestHashLogExtendEventConformanceTestCheckpoint1 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_TCG2_PROTOCOL *TCG2 + ) +{ + EFI_TEST_ASSERTION AssertionType; + EFI_STATUS Status; + UINT64 Flags =3D 0; + EFI_PHYSICAL_ADDRESS DataToHash; + UINT64 DataToHashLen; + EFI_TCG2_EVENT *EfiTcgEvent; + const CHAR8 *EventData =3D "TCG2 Protocol Test= "; + const CHAR8 *Str =3D "The quick brown fox jump= s over the lazy dog"; + UINT32 EfiTcgEventSize =3D sizeof(EFI_TCG= 2_EVENT) + SctAsciiStrLen(EventData); + + DataToHash =3D (EFI_PHYSICAL_ADDRESS)Str; + DataToHashLen =3D SctAsciiStrLen(Str); + + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + EfiTcgEventSize, + (VOID **)&EfiTcgEvent + ); + + EfiTcgEvent->Header.HeaderSize =3D sizeof(EFI_TCG2_EVENT_HEADER); + EfiTcgEvent->Header.HeaderVersion =3D 1; + EfiTcgEvent->Header.EventType =3D EV_POST_CODE; + EfiTcgEvent->Header.PCRIndex =3D 16; + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(Ev= entData); + + // Ensure HashLogExtendEvent returns Invalid Parameter when passing in N= ULL DataToHash pointer + // EFI Protocol Spec Section 6.6.5 #1 + Status =3D TCG2->HashLogExtendEvent ( + TCG2, + Flags, + (EFI_PHYSICAL_ADDRESS)NULL, + 0, + EfiTcgEvent); + + if (EFI_INVALID_PARAMETER !=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gTcg2ConformanceTestAssertionGuid007, + L"TCG2_PROTOCOL.HashLogExtendEvent - Test with NULL DataT= oHash Pointer should return EFI_INVALID_PARAMETER", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // Ensure HashLogExtendEvent returns Invalid Parameter when passing in N= ULL EfiTcgEvent pointer + // EFI Protocol Spec Section 6.6.5 #1 + Status =3D TCG2->HashLogExtendEvent ( + TCG2, + Flags, + DataToHash, + DataToHashLen, + NULL); + + if (EFI_INVALID_PARAMETER !=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gTcg2ConformanceTestAssertionGuid008, + L"TCG2_PROTOCOL.HashLogExtendEvent - Test with NULL EfiTc= gEvent Pointer should return EFI_INVALID_PARAMETER", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // Ensure HashLogExtendEvent returns Invalid Parameter when passed in Ev= entSize < HeaderSize + sizeof(UINT32) + // EFI Protocol Spec Section 6.6.5 #2 + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + sizeof(UINT32) - = 1; + + Status =3D TCG2->HashLogExtendEvent ( + TCG2, + Flags, + DataToHash, + DataToHashLen, + EfiTcgEvent); + + if (EFI_INVALID_PARAMETER !=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gTcg2ConformanceTestAssertionGuid009, + L"TCG2_PROTOCOL.HashLogExtendEvent - Test with Event.Size= < Event.Header.HeaderSize + sizeof(UINT32) should return EFI_INVALID_PARAM= ETER", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // Ensure HashLogExtendEvent returns Invalid Parameter when passing in P= CR Index > 23 + // EFI Protocol Spec Section 6.6.5 #3 + EfiTcgEvent->Header.PCRIndex =3D 24; + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(Ev= entData); + + Status =3D TCG2->HashLogExtendEvent ( + TCG2, + Flags, + DataToHash, + DataToHashLen, + EfiTcgEvent); + + if (EFI_INVALID_PARAMETER !=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gTcg2ConformanceTestAssertionGuid010, + L"TCG2_PROTOCOL.HashLogExtendEvent - Test with PCRIndex >= 23 should return EFI_INVALID_PARAMETER", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + return EFI_SUCCESS; +} + +EFI_STATUS +BBTestHashLogExtendEventConformanceTestCheckpoint2 ( + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib, + IN EFI_TCG2_PROTOCOL *TCG2 + ) +{ + EFI_TCG2_EVENT *EfiTcgEvent; + EFI_TEST_ASSERTION AssertionType; + EFI_STATUS Status; + UINT64 Flags =3D 0; + EFI_PHYSICAL_ADDRESS DataToHash; + UINT64 DataToHashLen; + const CHAR8 *Str =3D "The quick brown fox jump= s over the lazy dog"; + const CHAR8 *EventData =3D "TCG2 Protocol Test= "; + UINT32 EfiTcgEventSize =3D sizeof(EFI_TCG2_EVENT) + SctAsciiStrLen(Event= Data); + + DataToHash =3D (EFI_PHYSICAL_ADDRESS)Str; + DataToHashLen =3D SctAsciiStrLen(Str); + + Status =3D gtBS->AllocatePool ( + EfiBootServicesData, + EfiTcgEventSize, + (VOID **)&EfiTcgEvent + ); + + EfiTcgEvent->Header.HeaderSize =3D sizeof(EFI_TCG2_EVENT_HEADER); + EfiTcgEvent->Header.HeaderVersion =3D 1; + EfiTcgEvent->Header.EventType =3D EV_POST_CODE; + EfiTcgEvent->Header.PCRIndex =3D 16; + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(Ev= entData); + + // Perform HashLogExtendEvent over test buffer to PCR 16 + Status =3D TCG2->HashLogExtendEvent ( + TCG2, + Flags, + DataToHash, + DataToHashLen, + EfiTcgEvent); + + if (Status !=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gTcg2ConformanceTestAssertionGuid011, + L"TCG2_PROTOCOL.HashLogExtendEvent - HashLogExtendEvent()= Test: HashLogExtendEvent should return EFI_SUCCESS", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // Test with valid Parameters but with Flags =3D PE_COFF_IMAGE + // EFI Protocol Spec Section 6.6.5 #4 + Flags =3D PE_COFF_IMAGE; + + Status =3D TCG2->HashLogExtendEvent ( + TCG2, + Flags, + DataToHash, + DataToHashLen, + EfiTcgEvent); + + if (Status !=3D EFI_UNSUPPORTED) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gTcg2ConformanceTestAssertionGuid012, + L"TCG2_PROTOCOL.HashLogExtendEvent - HashLogExtendEvent()= Test Handling of PE_COFF_IMAGE flag", + L"%a:%d: Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + gtBS->FreePool (EfiTcgEvent); + + 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 7fc202246cd8..f7b9e487eda2 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 @@ -56,6 +56,15 @@ EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] =3D { EFI_TEST_CASE_AUTO, BBTestGetActivePcrBanksConformanceTest }, + { + EFI_TCG2_PROTOCOL_TEST_ENTRY_GUID0103, + L"HashLogExtendEvent_Conf", + L"Test the HashLogExtendEvent API", + EFI_TEST_LEVEL_DEFAULT, + gSupportProtocolGuid1, + EFI_TEST_CASE_AUTO, + BBTestHashLogExtendEventConformanceTest + }, 0 }; -- 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113488): https://edk2.groups.io/g/devel/message/113488 Mute This Topic: https://groups.io/mt/103625303/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 (#116848): https://edk2.groups.io/g/devel/message/116848 Mute This Topic: https://groups.io/mt/103625303/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-