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 794AC740039 for ; Tue, 9 Jan 2024 18:21:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=QMQrbSPQl++/WStbagOMcAxW9RmlSfmwDpRNnAaXhOY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1704824470; v=1; b=ZrE/Ar26v9LsCBm7GR3UF8TcF8GAF2vtZ+zxEcDpjq+eT+lQz77DIhCH05uprS3tPWb2NNEn o1CodJUPJpuZ+tixTkePPQzzGXLN+MMnF1zS3Y/MYKh6gQ2Ax7AlvnW13t58ruFs08gzA30AJah 80swFqXimFp479QGrFzqAzsQ= X-Received: by 127.0.0.2 with SMTP id fOm6YY7687511xwQOS1Ikcq1; Tue, 09 Jan 2024 10:21:10 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.24571.1704824465406611858 for ; Tue, 09 Jan 2024 10:21:05 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AA1FF153B; Tue, 9 Jan 2024 10:21:50 -0800 (PST) X-Received: from beelzebub.ast.arm.com (unknown [10.118.29.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 114543F5A1; Tue, 9 Jan 2024 10:21:05 -0800 (PST) From: "Stuart Yoder" To: devel@edk2.groups.io, Edhaya.Chandran@arm.com, gaojie@byosoft.com.cn Cc: ilias.apalodimas@linaro.org, heinrich.schuchardt@canonical.com, Samer.El-Haj-Mahmoud@arm.com, Jiewen.Yao@intel.com Subject: [edk2-devel] [PATCH v2 4/6] uefi-sct/SctPkg: TCG2 Protocol: add HashLogExtendEvent test Date: Tue, 9 Jan 2024 12:20:51 -0600 Message-Id: <20240109182053.2540542-5-stuart.yoder@arm.com> In-Reply-To: <20240109182053.2540542-1-stuart.yoder@arm.com> References: <20240109182053.2540542-1-stuart.yoder@arm.com> MIME-Version: 1.0 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 Reply-To: devel@edk2.groups.io,stuart.yoder@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: rvzaV3EUTY8SFEM1OrtsIZHkx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="ZrE/Ar26"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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; =0D extern EFI_GUID gTcg2ConformanceTestAssertionGuid006;=0D =0D +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_007_GUID \=0D +{ 0xa8e1b5e6, 0xfc09, 0x461c, {0xb0, 0xe9, 0x2a, 0x49, 0xcd, 0x25, 0xc1, 0= x24 }}=0D +=0D +extern EFI_GUID gTcg2ConformanceTestAssertionGuid007;=0D +=0D +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_008_GUID \=0D +{ 0x26f04a9b, 0x7b7a, 0x4f47, {0xbe, 0xa8, 0xb1, 0xa6, 0x02, 0x65, 0x19, 0= x8a }}=0D +=0D +extern EFI_GUID gTcg2ConformanceTestAssertionGuid008;=0D +=0D +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_009_GUID \=0D +{ 0x4d1d9985, 0x91e2, 0x4948, {0x89, 0x16, 0xbb, 0x98, 0x13, 0x62, 0x39, 0= x1d }}=0D +=0D +extern EFI_GUID gTcg2ConformanceTestAssertionGuid009;=0D +=0D +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_010_GUID \=0D +{ 0xfb59cab7, 0x4f8c, 0x4ded, {0xa4, 0x1c, 0xc8, 0x41, 0x20, 0x1c, 0x37, 0= x22 }}=0D +=0D +extern EFI_GUID gTcg2ConformanceTestAssertionGuid010;=0D +=0D +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_011_GUID \=0D +{ 0x0363d22f, 0xc66a, 0x4872, {0xa5, 0x46, 0x06, 0x7f, 0x6a, 0x0d, 0xdb, 0= xcd }}=0D +=0D +extern EFI_GUID gTcg2ConformanceTestAssertionGuid011;=0D +=0D +#define EFI_TEST_TCG2CONFORMANCE_ASSERTION_012_GUID \=0D +{ 0x9cd6d636, 0x603a, 0x4b78, {0x80, 0xa3, 0xa3, 0xb9, 0xcc, 0x6a, 0x0b, 0= x08 }}=0D +=0D +extern EFI_GUID gTcg2ConformanceTestAssertionGuid012;=0D 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 \=0D {0x847f1ae0, 0xb429, 0x49f1, {0x9e, 0x0c, 0x8f, 0x43, 0xfb, 0x55, 0x34, 0= x54} }=0D =0D +#define EFI_TCG2_PROTOCOL_TEST_ENTRY_GUID0103 \=0D + {0x907a7878, 0xb294, 0xf147, {0xe9, 0x0a, 0x65, 0x43, 0xab, 0x55, 0x76, 0= x46} }=0D +=0D +#define EV_POST_CODE 0x01=0D +=0D +#define EFI_TCG2_EXTEND_ONLY 0x0000000000000001=0D +=0D +#define PE_COFF_IMAGE 0x0000000000000010=0D +=0D EFI_STATUS=0D EFIAPI=0D BBTestTCG2ProtocolUnload (=0D @@ -82,6 +91,18 @@ BBTestGetActivePcrBanksConformanceTestCheckpoint2 ( IN EFI_TCG2_PROTOCOL *TCG2=0D );=0D =0D +EFI_STATUS=0D +BBTestHashLogExtendEventConformanceTestCheckpoint1 (=0D + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,=0D + IN EFI_TCG2_PROTOCOL *TCG2=0D + );=0D +=0D +EFI_STATUS=0D +BBTestHashLogExtendEventConformanceTestCheckpoint2 (=0D + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,=0D + IN EFI_TCG2_PROTOCOL *TCG2=0D + );=0D +=0D EFI_STATUS=0D BBTestGetCapabilityConformanceTest (=0D IN EFI_BB_TEST_PROTOCOL *This,=0D @@ -98,3 +119,11 @@ BBTestGetActivePcrBanksConformanceTest ( IN EFI_HANDLE SupportHandle=0D );=0D =0D +EFI_STATUS=0D +BBTestHashLogExtendEventConformanceTest (=0D + IN EFI_BB_TEST_PROTOCOL *This,=0D + IN VOID *ClientInterface,=0D + IN EFI_TEST_LEVEL TestLevel,=0D + IN EFI_HANDLE SupportHandle=0D + );=0D +=0D 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;=0D =0D EFI_GUID gTcg2ConformanceTestAssertionGuid006 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_006_GUID;=0D +=0D +EFI_GUID gTcg2ConformanceTestAssertionGuid007 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_007_GUID;=0D +=0D +EFI_GUID gTcg2ConformanceTestAssertionGuid008 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_008_GUID;=0D +=0D +EFI_GUID gTcg2ConformanceTestAssertionGuid009 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_009_GUID;=0D +=0D +EFI_GUID gTcg2ConformanceTestAssertionGuid010 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_010_GUID;=0D +=0D +EFI_GUID gTcg2ConformanceTestAssertionGuid011 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_011_GUID;=0D +=0D +EFI_GUID gTcg2ConformanceTestAssertionGuid012 =3D EFI_TEST_TCG2CONFORMANCE= _ASSERTION_012_GUID;=0D 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;=0D }=0D =0D +/**=0D + * @brief Entrypoint for HashLogExtendEvent() Function Test.=0D + * 2 checkpoints will be tested.=0D + * @param This a pointer of EFI_BB_TEST_PROTOCOL=0D + * @param ClientInterface A pointer to the interface array under test=0D + * @param TestLevel Test "thoroughness" control=0D + * @param SupportHandle A handle containing protocols required=0D + * @return EFI_SUCCESS=0D + * @return EFI_NOT_FOUND=0D + */=0D +=0D +EFI_STATUS=0D +BBTestHashLogExtendEventConformanceTest (=0D + IN EFI_BB_TEST_PROTOCOL *This,=0D + IN VOID *ClientInterface,=0D + IN EFI_TEST_LEVEL TestLevel,=0D + IN EFI_HANDLE SupportHandle=0D + )=0D +{=0D + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;=0D + EFI_STATUS Status;=0D + EFI_TCG2_PROTOCOL *TCG2;=0D + //=0D + // init=0D + //=0D + TCG2 =3D (EFI_TCG2_PROTOCOL*)ClientInterface;=0D +=0D + // Ensure Protocol not NULL=0D + if (TCG2 =3D=3D NULL)=0D + return EFI_UNSUPPORTED;=0D +=0D + // Get the Standard Library Interface=0D + //=0D + Status =3D gtBS->HandleProtocol (=0D + SupportHandle,=0D + &gEfiStandardTestLibraryGuid,=0D + (VOID **) &StandardLib=0D + );=0D + if (EFI_ERROR(Status)) {=0D + return Status;=0D + }=0D +=0D + // Test HashLogExtendEvent with invalid arguments=0D + BBTestHashLogExtendEventConformanceTestCheckpoint1 (StandardLib, TCG2);= =0D +=0D + // Test HashLogExtendEvent with valid arguments=0D + BBTestHashLogExtendEventConformanceTestCheckpoint2 (StandardLib, TCG2);= =0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D EFI_STATUS=0D BBTestGetCapabilityConformanceTestCheckpoint1 (=0D IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,=0D @@ -518,3 +569,235 @@ BBTestGetActivePcrBanksConformanceTestCheckpoint2 ( =0D return EFI_SUCCESS;=0D }=0D +=0D +EFI_STATUS=0D +BBTestHashLogExtendEventConformanceTestCheckpoint1 (=0D + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,=0D + IN EFI_TCG2_PROTOCOL *TCG2=0D + )=0D +{=0D + EFI_TEST_ASSERTION AssertionType;=0D + EFI_STATUS Status;=0D + UINT64 Flags =3D 0;=0D + EFI_PHYSICAL_ADDRESS DataToHash;=0D + UINT64 DataToHashLen;=0D + EFI_TCG2_EVENT *EfiTcgEvent;=0D + const CHAR8 *EventData =3D "TCG2 Protocol Test= ";=0D + const CHAR8 *Str =3D "The quick brown fox jump= s over the lazy dog";=0D + UINT32 EfiTcgEventSize =3D sizeof(EFI_TCG= 2_EVENT) + SctAsciiStrLen(EventData);=0D +=0D + DataToHash =3D (EFI_PHYSICAL_ADDRESS)Str;=0D + DataToHashLen =3D SctAsciiStrLen(Str);=0D +=0D + Status =3D gtBS->AllocatePool (=0D + EfiBootServicesData,=0D + EfiTcgEventSize,=0D + (VOID **)&EfiTcgEvent=0D + );=0D +=0D + EfiTcgEvent->Header.HeaderSize =3D sizeof(EFI_TCG2_EVENT_HEADER);=0D + EfiTcgEvent->Header.HeaderVersion =3D 1;=0D + EfiTcgEvent->Header.EventType =3D EV_POST_CODE;=0D + EfiTcgEvent->Header.PCRIndex =3D 16;=0D + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(Ev= entData);=0D +=0D + // Ensure HashLogExtendEvent returns Invalid Parameter when passing in N= ULL DataToHash pointer=0D + // EFI Protocol Spec Section 6.6.5 #1=0D + Status =3D TCG2->HashLogExtendEvent (=0D + TCG2,=0D + Flags,=0D + (EFI_PHYSICAL_ADDRESS)NULL,=0D + 0,=0D + EfiTcgEvent);=0D +=0D + if (EFI_INVALID_PARAMETER !=3D Status) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gTcg2ConformanceTestAssertionGuid007,=0D + L"TCG2_PROTOCOL.HashLogExtendEvent - Test with NULL DataT= oHash Pointer should return EFI_INVALID_PARAMETER",=0D + L"%a:%d: Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + // Ensure HashLogExtendEvent returns Invalid Parameter when passing in N= ULL EfiTcgEvent pointer=0D + // EFI Protocol Spec Section 6.6.5 #1=0D + Status =3D TCG2->HashLogExtendEvent (=0D + TCG2,=0D + Flags,=0D + DataToHash,=0D + DataToHashLen,=0D + NULL);=0D +=0D + if (EFI_INVALID_PARAMETER !=3D Status) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gTcg2ConformanceTestAssertionGuid008,=0D + L"TCG2_PROTOCOL.HashLogExtendEvent - Test with NULL EfiTc= gEvent Pointer should return EFI_INVALID_PARAMETER",=0D + L"%a:%d: Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + // Ensure HashLogExtendEvent returns Invalid Parameter when passed in Ev= entSize < HeaderSize + sizeof(UINT32)=0D + // EFI Protocol Spec Section 6.6.5 #2=0D + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + sizeof(UINT32) - = 1;=0D +=0D + Status =3D TCG2->HashLogExtendEvent (=0D + TCG2,=0D + Flags,=0D + DataToHash,=0D + DataToHashLen,=0D + EfiTcgEvent);=0D +=0D + if (EFI_INVALID_PARAMETER !=3D Status) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gTcg2ConformanceTestAssertionGuid009,=0D + L"TCG2_PROTOCOL.HashLogExtendEvent - Test with Event.Size= < Event.Header.HeaderSize + sizeof(UINT32) should return EFI_INVALID_PARAM= ETER",=0D + L"%a:%d: Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + // Ensure HashLogExtendEvent returns Invalid Parameter when passing in P= CR Index > 23=0D + // EFI Protocol Spec Section 6.6.5 #3=0D + EfiTcgEvent->Header.PCRIndex =3D 24;=0D + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(Ev= entData);=0D +=0D + Status =3D TCG2->HashLogExtendEvent (=0D + TCG2,=0D + Flags,=0D + DataToHash,=0D + DataToHashLen,=0D + EfiTcgEvent);=0D +=0D + if (EFI_INVALID_PARAMETER !=3D Status) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gTcg2ConformanceTestAssertionGuid010,=0D + L"TCG2_PROTOCOL.HashLogExtendEvent - Test with PCRIndex >= 23 should return EFI_INVALID_PARAMETER",=0D + L"%a:%d: Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +EFI_STATUS=0D +BBTestHashLogExtendEventConformanceTestCheckpoint2 (=0D + IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib,=0D + IN EFI_TCG2_PROTOCOL *TCG2=0D + )=0D +{=0D + EFI_TCG2_EVENT *EfiTcgEvent;=0D + EFI_TEST_ASSERTION AssertionType;=0D + EFI_STATUS Status;=0D + UINT64 Flags =3D 0;=0D + EFI_PHYSICAL_ADDRESS DataToHash;=0D + UINT64 DataToHashLen;=0D + const CHAR8 *Str =3D "The quick brown fox jump= s over the lazy dog";=0D + const CHAR8 *EventData =3D "TCG2 Protocol Test= ";=0D + UINT32 EfiTcgEventSize =3D sizeof(EFI_TCG2_EVENT) + SctAsciiStrLen(Event= Data);=0D +=0D + DataToHash =3D (EFI_PHYSICAL_ADDRESS)Str;=0D + DataToHashLen =3D SctAsciiStrLen(Str);=0D +=0D + Status =3D gtBS->AllocatePool (=0D + EfiBootServicesData,=0D + EfiTcgEventSize,=0D + (VOID **)&EfiTcgEvent=0D + );=0D +=0D + EfiTcgEvent->Header.HeaderSize =3D sizeof(EFI_TCG2_EVENT_HEADER);=0D + EfiTcgEvent->Header.HeaderVersion =3D 1;=0D + EfiTcgEvent->Header.EventType =3D EV_POST_CODE;=0D + EfiTcgEvent->Header.PCRIndex =3D 16;=0D + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(Ev= entData);=0D +=0D + // Perform HashLogExtendEvent over test buffer to PCR 16=0D + Status =3D TCG2->HashLogExtendEvent (=0D + TCG2,=0D + Flags,=0D + DataToHash,=0D + DataToHashLen,=0D + EfiTcgEvent);=0D +=0D + if (Status !=3D EFI_SUCCESS) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gTcg2ConformanceTestAssertionGuid011,=0D + L"TCG2_PROTOCOL.HashLogExtendEvent - HashLogExtendEvent()= Test: HashLogExtendEvent should return EFI_SUCCESS",=0D + L"%a:%d: Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + // Test with valid Parameters but with Flags =3D PE_COFF_IMAGE=0D + // EFI Protocol Spec Section 6.6.5 #4=0D + Flags =3D PE_COFF_IMAGE;=0D +=0D + Status =3D TCG2->HashLogExtendEvent (=0D + TCG2,=0D + Flags,=0D + DataToHash,=0D + DataToHashLen,=0D + EfiTcgEvent);=0D +=0D + if (Status !=3D EFI_UNSUPPORTED) {=0D + AssertionType =3D EFI_TEST_ASSERTION_FAILED;=0D + } else {=0D + AssertionType =3D EFI_TEST_ASSERTION_PASSED;=0D + }=0D +=0D + StandardLib->RecordAssertion (=0D + StandardLib,=0D + AssertionType,=0D + gTcg2ConformanceTestAssertionGuid012,=0D + L"TCG2_PROTOCOL.HashLogExtendEvent - HashLogExtendEvent()= Test Handling of PE_COFF_IMAGE flag",=0D + L"%a:%d: Status - %r",=0D + __FILE__,=0D + (UINTN)__LINE__,=0D + Status=0D + );=0D +=0D + gtBS->FreePool (EfiTcgEvent);=0D +=0D + return EFI_SUCCESS;=0D +}=0D 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,=0D BBTestGetActivePcrBanksConformanceTest=0D },=0D + {=0D + EFI_TCG2_PROTOCOL_TEST_ENTRY_GUID0103,=0D + L"HashLogExtendEvent_Conf",=0D + L"Test the HashLogExtendEvent API",=0D + EFI_TEST_LEVEL_DEFAULT,=0D + gSupportProtocolGuid1,=0D + EFI_TEST_CASE_AUTO,=0D + BBTestHashLogExtendEventConformanceTest=0D + },=0D 0=0D };=0D =0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- 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/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-