From: "Stuart Yoder" <stuart.yoder@arm.com>
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 [thread overview]
Message-ID: <20240416145401.3213797-5-stuart.yoder@arm.com> (raw)
In-Reply-To: <20240416145401.3213797-1-stuart.yoder@arm.com>
The VS2015x86 build encountered errors due to type conversion
warnings. Resolve these by adding casts and refactoring.
Signed-off-by: Stuart Yoder <stuart.yoder@arm.com>
---
uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTestConformance.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/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTestConformance.c
index cba1ec1b9e2c..2a3cd6aa4f23 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTestConformance.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/TCG2/BlackBoxTest/TCG2ProtocolBBTestConformance.c
@@ -639,7 +639,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint1 (
EFI_TCG2_EVENT *EfiTcgEvent;
const CHAR8 *EventData = "TCG2 Protocol Test";
const CHAR8 *Str = "The quick brown fox jumps over the lazy dog";
- UINT32 EfiTcgEventSize = sizeof(EFI_TCG2_EVENT) + SctAsciiStrLen(EventData);
+ UINT32 EfiTcgEventSize = (UINT32)(sizeof(EFI_TCG2_EVENT) + SctAsciiStrLen(EventData));
DataToHash = (EFI_PHYSICAL_ADDRESS)Str;
DataToHashLen = SctAsciiStrLen(Str);
@@ -654,7 +654,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint1 (
EfiTcgEvent->Header.HeaderVersion = 1;
EfiTcgEvent->Header.EventType = EV_POST_CODE;
EfiTcgEvent->Header.PCRIndex = 16;
- EfiTcgEvent->Size = EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(EventData);
+ EfiTcgEvent->Size = EfiTcgEvent->Header.HeaderSize + (UINT32)SctAsciiStrLen(EventData);
// Ensure HashLogExtendEvent returns Invalid Parameter when passing in NULL DataToHash pointer
// EFI Protocol Spec Section 6.6.5 #1
@@ -710,7 +710,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint1 (
// Ensure HashLogExtendEvent returns Invalid Parameter when passed in EventSize < HeaderSize + sizeof(UINT32)
// EFI Protocol Spec Section 6.6.5 #2
- EfiTcgEvent->Size = EfiTcgEvent->Header.HeaderSize + sizeof(UINT32) - 1;
+ EfiTcgEvent->Size = EfiTcgEvent->Header.HeaderSize + (UINT32)sizeof(UINT32) - 1;
Status = 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 = 24;
- EfiTcgEvent->Size = EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(EventData);
+ EfiTcgEvent->Size = EfiTcgEvent->Header.HeaderSize + (UINT32)SctAsciiStrLen(EventData);
Status = TCG2->HashLogExtendEvent (
TCG2,
@@ -782,7 +782,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint2 (
UINT64 DataToHashLen;
const CHAR8 *Str = "The quick brown fox jumps over the lazy dog";
const CHAR8 *EventData = "TCG2 Protocol Test";
- UINT32 EfiTcgEventSize = sizeof(EFI_TCG2_EVENT) + SctAsciiStrLen(EventData);
+ UINT32 EfiTcgEventSize = (UINT32)(sizeof(EFI_TCG2_EVENT) + SctAsciiStrLen(EventData));
DataToHash = (EFI_PHYSICAL_ADDRESS)Str;
DataToHashLen = SctAsciiStrLen(Str);
@@ -797,7 +797,7 @@ BBTestHashLogExtendEventConformanceTestCheckpoint2 (
EfiTcgEvent->Header.HeaderVersion = 1;
EfiTcgEvent->Header.EventType = EV_POST_CODE;
EfiTcgEvent->Header.PCRIndex = 16;
- EfiTcgEvent->Size = EfiTcgEvent->Header.HeaderSize + SctAsciiStrLen(EventData);
+ EfiTcgEvent->Size = EfiTcgEvent->Header.HeaderSize + (UINT32)SctAsciiStrLen(EventData);
// Perform HashLogExtendEvent over test buffer to PCR 16
Status = TCG2->HashLogExtendEvent (
@@ -991,9 +991,7 @@ BBTestGetEventLogConformanceTestCheckpoint2 (
}
// Verify EventLog Signature
- Status = SctCompareMem(EventLogHeaderSpecEvent->signature, signature, sizeof(signature));
-
- if (Status != EFI_SUCCESS) {
+ if (SctCompareMem(EventLogHeaderSpecEvent->signature, signature, sizeof(signature) != 0)) {
StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
@@ -1076,7 +1074,7 @@ BBTestSubmitCommandConformanceTestCheckpoint1 (
CommandInput.Tag = SctSwapBytes16(ST_NO_SESSIONS);
CommandInput.CommandSize = SctSwapBytes32(sizeof(TPM2_HASH_COMMAND));
CommandInput.CommandCode = SctSwapBytes32(TPM_CC_Hash);
- CommandInput.data.size = SctSwapBytes16(SctAsciiStrLen(Str));
+ CommandInput.data.size = SctSwapBytes16((UINT16)SctAsciiStrLen(Str));
SctAsciiStrCpy((CHAR8 *)CommandInput.data.buffer, Str);
CommandInput.hashAlg = SctSwapBytes16(TPM_ALG_SHA256);
CommandInput.hierarchy = SctSwapBytes32(TPM_RH_NULL);
--
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]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-04-16 14:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 14:53 [edk2-devel] [PATCH v2 0/4] TCG2 protocol clean up Stuart Yoder
2024-04-16 14:53 ` [edk2-devel] [PATCH v2 1/4] uefi-sct/SctPkg: TCG2 Protocol: correct definition of TPMT_HA struct Stuart Yoder
2024-04-24 11:16 ` G Edhaya Chandran
2024-04-24 11:32 ` G Edhaya Chandran
2024-04-24 11:36 ` G Edhaya Chandran
2024-04-24 13:58 ` Stuart Yoder
2024-04-25 5:40 ` G Edhaya Chandran
2024-04-16 14:53 ` [edk2-devel] [PATCH v2 2/4] uefi-sct/SctPkg: TCG2 Protocol: use OFFSET_OF for computing offsets Stuart Yoder
2024-04-24 11:17 ` G Edhaya Chandran
2024-04-16 14:54 ` [edk2-devel] [PATCH v2 3/4] uefi-sct/SctPkg: TCG2 Protocol: #pragma pack cleanup Stuart Yoder
2024-04-24 11:17 ` G Edhaya Chandran
2024-04-16 14:54 ` Stuart Yoder [this message]
2024-04-24 11:17 ` [edk2-devel] [PATCH v2 4/4] uefi-sct/SctPkg: TCG2 Protocol: clean up type conversion warnings G Edhaya Chandran
2024-04-22 19:15 ` [edk2-devel] [PATCH v2 0/4] TCG2 protocol clean up Heinrich Schuchardt
2024-04-23 9:52 ` G Edhaya Chandran
2024-05-03 23:47 ` [edk2-devel] edk2-test Release candidate 2: edk2-test-rc2_202405 // " G Edhaya Chandran
2024-05-05 22:21 ` [edk2-devel] edk2-test Release candidate 2: edk2-test-rc2_202405 Heinrich Schuchardt
2024-05-06 17:26 ` G Edhaya Chandran
2024-05-09 20:23 ` [edk2-devel] edk2-test Release candidate 2: edk2-test-rc2_202405 // RE: [PATCH v2 0/4] TCG2 protocol clean up David Wright
2024-05-10 2:43 ` G Edhaya Chandran
2024-05-10 2:55 ` Chao Li
2024-05-10 14:56 ` G Edhaya Chandran
2024-05-11 2:47 ` Chao Li
[not found] ` <17CE4F3DF61B149E.21609@groups.io>
2024-05-13 6:21 ` Chao Li
2024-05-13 15:21 ` G Edhaya Chandran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240416145401.3213797-5-stuart.yoder@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox