From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.groups.io (mail04.groups.io [45.79.224.9]) by spool.mail.gandi.net (Postfix) with ESMTPS id A1313D80CA0 for ; Tue, 16 Apr 2024 14:54:40 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=9/umu6KPjP09bsp4X8CjOWRbEx4TTOlx3A1Y4w5+ckg=; 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:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1713279279; v=1; b=MH3ikxaAh/DjzguieQZey6smAvQXH4CrmwX8J0MMByxRJNo5FBu5z8HW3m2635ZYOjJTulBv Qyv/z3ibGuybTlr5pw55oro9Ii3k2kn4Vvd7FI83bxFgNlxbmEutSEcVz5qeB+X2GwV45cYNNNt zr5ukE8w6EdOWZIy9Yj4DhGyezjWMJogmbe8h3M4a9Z8fstU4sdE24876xCfGA20e0C1nJ9F9dk aQ/c6bdFme7CVriDntcShv/kogPsWZlyq1GYcflE2zKIwwU2iIxDfJIKW4J0L8KV0BXceuzt01v GI+akuRiI4MfiW8yy7H+sgs3oUrc9NJip0oQPVDThysEw== X-Received: by 127.0.0.2 with SMTP id IGgeYY7687511xBqYwDiq0g8; Tue, 16 Apr 2024 07:54:39 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.22743.1713279273782628983 for ; Tue, 16 Apr 2024 07:54:33 -0700 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 9DBFE1480; Tue, 16 Apr 2024 07:55:01 -0700 (PDT) X-Received: from beelzebub.ast.arm.com (u203013-lin.austin.arm.com [10.118.29.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 434D93F792; Tue, 16 Apr 2024 07:54:33 -0700 (PDT) From: "Stuart Yoder" To: devel@edk2.groups.io, Edhaya.Chandran@arm.com, gaojie@byosoft.com.cn Cc: Alex_Fox@phoenix.com, heinrich.schuchardt@canonical.com, David_Wright@phoenix.com, lichao@loongson.cn Subject: [edk2-devel] [PATCH v2 4/4] uefi-sct/SctPkg: TCG2 Protocol: clean up type conversion warnings Date: Tue, 16 Apr 2024 09:54:01 -0500 Message-Id: <20240416145401.3213797-5-stuart.yoder@arm.com> In-Reply-To: <20240416145401.3213797-1-stuart.yoder@arm.com> References: <20240416145401.3213797-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 Resent-Date: Tue, 16 Apr 2024 07:54:33 -0700 Resent-From: stuart.yoder@arm.com Reply-To: devel@edk2.groups.io,stuart.yoder@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: sqRJW4P5rTSxFlpYOvF7Wscex7686176AA= 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=MH3ikxaA; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.9 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) The VS2015x86 build encountered errors due to type conversion warnings. Resolve these by adding casts and refactoring. Signed-off-by: Stuart Yoder --- uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2Protoco= lBBTestConformance.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest= /TCG2ProtocolBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Prot= ocol/TCG2/BlackBoxTest/TCG2ProtocolBBTestConformance.c index cba1ec1b9e2c..2a3cd6aa4f23 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2Pr= otocolBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2Pr= otocolBBTestConformance.c @@ -639,7 +639,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint1 ( EFI_TCG2_EVENT *EfiTcgEvent; const CHAR8 *EventData =3D "TCG2 Protocol Te= st"; const CHAR8 *Str =3D "The quick brown fox ju= mps over the lazy dog"; - UINT32 EfiTcgEventSize =3D sizeof(EFI_T= CG2_EVENT) + SctAsciiStrLen(EventData); + UINT32 EfiTcgEventSize =3D (UINT32)(siz= eof(EFI_TCG2_EVENT) + SctAsciiStrLen(EventData)); =20 DataToHash =3D (EFI_PHYSICAL_ADDRESS)Str; DataToHashLen =3D SctAsciiStrLen(Str); @@ -654,7 +654,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint1 ( EfiTcgEvent->Header.HeaderVersion =3D 1; EfiTcgEvent->Header.EventType =3D EV_POST_CODE; EfiTcgEvent->Header.PCRIndex =3D 16; - EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(= EventData); + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + (UINT32)SctAsci= iStrLen(EventData); =20 // Ensure HashLogExtendEvent returns Invalid Parameter when passing in= NULL DataToHash pointer // EFI Protocol Spec Section 6.6.5 #1 @@ -710,7 +710,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint1 ( =20 // Ensure HashLogExtendEvent returns Invalid Parameter when passed in = EventSize < HeaderSize + sizeof(UINT32) // EFI Protocol Spec Section 6.6.5 #2 - EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + sizeof(UINT32) = - 1; + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + (UINT32)sizeof(= UINT32) - 1; =20 Status =3D TCG2->HashLogExtendEvent ( TCG2, @@ -739,7 +739,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint1 ( // Ensure HashLogExtendEvent returns Invalid Parameter when passing in= PCR Index > 23 // EFI Protocol Spec Section 6.6.5 #3 EfiTcgEvent->Header.PCRIndex =3D 24; - EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(= EventData); + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + (UINT32)SctAsci= iStrLen(EventData); =20 Status =3D TCG2->HashLogExtendEvent ( TCG2, @@ -782,7 +782,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint2 ( UINT64 DataToHashLen; const CHAR8 *Str =3D "The quick brown fox ju= mps over the lazy dog"; const CHAR8 *EventData =3D "TCG2 Protocol Te= st"; - UINT32 EfiTcgEventSize =3D sizeof(EFI_TCG2_EVENT) + SctAsciiStrLen(Eve= ntData); + UINT32 EfiTcgEventSize =3D (UINT32)(sizeof(EFI_TCG2_EVENT) + SctAsciiS= trLen(EventData)); =20 DataToHash =3D (EFI_PHYSICAL_ADDRESS)Str; DataToHashLen =3D SctAsciiStrLen(Str); @@ -797,7 +797,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint2 ( EfiTcgEvent->Header.HeaderVersion =3D 1; EfiTcgEvent->Header.EventType =3D EV_POST_CODE; EfiTcgEvent->Header.PCRIndex =3D 16; - EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(= EventData); + EfiTcgEvent->Size =3D EfiTcgEvent->Header.HeaderSize + (UINT32)SctAsci= iStrLen(EventData); =20 // Perform HashLogExtendEvent over test buffer to PCR 16 Status =3D TCG2->HashLogExtendEvent ( @@ -991,9 +991,7 @@ BBTestGetEventLogConformanceTestCheckpoint2 ( } =20 // Verify EventLog Signature - Status =3D SctCompareMem(EventLogHeaderSpecEvent->signature, signature= , sizeof(signature)); - - if (Status !=3D EFI_SUCCESS) { + if (SctCompareMem(EventLogHeaderSpecEvent->signature, signature, sizeo= f(signature) !=3D 0)) { StandardLib->RecordMessage ( StandardLib, EFI_VERBOSE_LEVEL_DEFAULT, @@ -1076,7 +1074,7 @@ BBTestSubmitCommandConformanceTestCheckpoint1 ( CommandInput.Tag =3D SctSwapBytes16(ST_NO_SESSIONS); CommandInput.CommandSize =3D SctSwapBytes32(sizeof(TPM2_HASH_COMMAND))= ; CommandInput.CommandCode =3D SctSwapBytes32(TPM_CC_Hash); - CommandInput.data.size =3D SctSwapBytes16(SctAsciiStrLen(Str)); + CommandInput.data.size =3D SctSwapBytes16((UINT16)SctAsciiStrLen(Str))= ; SctAsciiStrCpy((CHAR8 *)CommandInput.data.buffer, Str); CommandInput.hashAlg =3D SctSwapBytes16(TPM_ALG_SHA256); CommandInput.hierarchy =3D SctSwapBytes32(TPM_RH_NULL); --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117886): https://edk2.groups.io/g/devel/message/117886 Mute This Topic: https://groups.io/mt/105558010/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-