diff options
author | Star Zeng <star.zeng@intel.com> | 2016-11-16 17:17:36 +0800 |
---|---|---|
committer | Star Zeng <star.zeng@intel.com> | 2016-11-21 10:38:33 +0800 |
commit | a9f1b2e2d708ed98aa47d576a81d947dc7b79fac (patch) | |
tree | 3f0ed1927e626bdbeadcfa33682ae1a87ec031ed | |
parent | ab5b1f31c2dae23835b9b49d0fe58e14133ba4e8 (diff) | |
download | edk2-platforms-a9f1b2e2d708ed98aa47d576a81d947dc7b79fac.tar.xz |
SecurityPkg Tcg2Dxe: Get correct digest list size
Current code uses GetDigestListSize(DigestList) to get
digest list size, that is incorrect.
The code should get digest list size of digests copied
into event2 log, those digests are compacted, so
GetDigestListBinSize() should be used.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
-rw-r--r-- | SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c index 3d79a07d12..6241c5208b 100644 --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c @@ -974,6 +974,7 @@ TcgDxeLogHashEvent ( EFI_STATUS RetStatus;
TCG_PCR_EVENT2 TcgPcrEvent2;
UINT8 *DigestBuffer;
+ UINT32 *EventSizePtr;
DEBUG ((EFI_D_INFO, "SupportedEventLogs - 0x%08x\n", mTcgDxeData.BsCap.SupportedEventLogs));
@@ -1010,9 +1011,8 @@ TcgDxeLogHashEvent ( TcgPcrEvent2.PCRIndex = NewEventHdr->PCRIndex;
TcgPcrEvent2.EventType = NewEventHdr->EventType;
DigestBuffer = (UINT8 *)&TcgPcrEvent2.Digest;
- DigestBuffer = CopyDigestListToBuffer (DigestBuffer, DigestList, mTcgDxeData.BsCap.ActivePcrBanks);
- CopyMem (DigestBuffer, &NewEventHdr->EventSize, sizeof(NewEventHdr->EventSize));
- DigestBuffer = DigestBuffer + sizeof(NewEventHdr->EventSize);
+ EventSizePtr = CopyDigestListToBuffer (DigestBuffer, DigestList, mTcgDxeData.BsCap.ActivePcrBanks);
+ CopyMem (EventSizePtr, &NewEventHdr->EventSize, sizeof(NewEventHdr->EventSize));
//
// Enter critical region
@@ -1021,7 +1021,7 @@ TcgDxeLogHashEvent ( Status = TcgDxeLogEvent (
mTcg2EventInfo[Index].LogFormat,
&TcgPcrEvent2,
- sizeof(TcgPcrEvent2.PCRIndex) + sizeof(TcgPcrEvent2.EventType) + GetDigestListSize (DigestList) + sizeof(TcgPcrEvent2.EventSize),
+ sizeof(TcgPcrEvent2.PCRIndex) + sizeof(TcgPcrEvent2.EventType) + GetDigestListBinSize (DigestBuffer) + sizeof(TcgPcrEvent2.EventSize),
NewEventData,
NewEventHdr->EventSize
);
|