diff options
author | Dionna Glaze <dionnaglaze@google.com> | 2025-05-08 15:57:06 +0000 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-07-21 05:07:41 +0000 |
commit | 9c382953257404b229de334f8310bceb55c63f87 (patch) | |
tree | 4f59d4d6909ff3e29eb7d7245746cdc4ef510799 | |
parent | 8216419a02173421ce7070268fdd11a7caadfa4b (diff) | |
download | edk2-9c382953257404b229de334f8310bceb55c63f87.zip edk2-9c382953257404b229de334f8310bceb55c63f87.tar.gz edk2-9c382953257404b229de334f8310bceb55c63f87.tar.bz2 |
OvmfPkg: Clarify Is800155Event
The Event3 memory comparison is technically correct since the
definitions of the struct types are the same. The extended
bodies of the events are different. The Event2 size guard
for the Event3 comparison should be split to use the Event3
in its sizeof for better clarity.
The large single condition makes the function difficult to
understand, so the combined logic is split into different
conditional statements.
Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
-rw-r--r-- | OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c b/OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c index 5287cda..8547c76 100644 --- a/OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c +++ b/OvmfPkg/Tcg/TdTcg2Dxe/TdTcg2Dxe.c @@ -806,6 +806,7 @@ TdGetEventLog ( @retval FALSE This is NOT a Tcg800155PlatformIdEvent.
**/
+STATIC
BOOLEAN
Is800155Event (
IN VOID *NewEventHdr,
@@ -814,18 +815,26 @@ Is800155Event ( IN UINT32 NewEventSize
)
{
- if ((((TCG_PCR_EVENT2_HDR *)NewEventHdr)->EventType == EV_NO_ACTION) &&
- (NewEventSize >= sizeof (TCG_Sp800_155_PlatformId_Event2)) &&
- ((CompareMem (
- NewEventData,
- TCG_Sp800_155_PlatformId_Event2_SIGNATURE,
- sizeof (TCG_Sp800_155_PlatformId_Event2_SIGNATURE) - 1
- ) == 0) ||
- (CompareMem (
- NewEventData,
- TCG_Sp800_155_PlatformId_Event3_SIGNATURE,
- sizeof (TCG_Sp800_155_PlatformId_Event3_SIGNATURE) - 1
- ) == 0)))
+ if (((TCG_PCR_EVENT2_HDR *)NewEventHdr)->EventType != EV_NO_ACTION) {
+ return FALSE;
+ }
+
+ if ((NewEventSize >= sizeof (TCG_Sp800_155_PlatformId_Event2)) &&
+ (CompareMem (
+ NewEventData,
+ TCG_Sp800_155_PlatformId_Event2_SIGNATURE,
+ sizeof (TCG_Sp800_155_PlatformId_Event2_SIGNATURE) - 1
+ ) == 0))
+ {
+ return TRUE;
+ }
+
+ if ((NewEventSize >= sizeof (TCG_Sp800_155_PlatformId_Event3)) &&
+ (CompareMem (
+ NewEventData,
+ TCG_Sp800_155_PlatformId_Event3_SIGNATURE,
+ sizeof (TCG_Sp800_155_PlatformId_Event3_SIGNATURE) - 1
+ ) == 0))
{
return TRUE;
}
|