diff --git a/SecurityPkg/Library/HashLibTpm2/HashLibTpm2PeilessSecLib.c b/SecurityPkg/Library/HashLibTpm2/HashLibTpm2PeilessSecLib.c index 39fff8e90d..5d07d0e5ec 100644 --- a/SecurityPkg/Library/HashLibTpm2/HashLibTpm2PeilessSecLib.c +++ b/SecurityPkg/Library/HashLibTpm2/HashLibTpm2PeilessSecLib.c @@ -586,9 +586,7 @@ HasLibTpm2PeilessSecLibConstructor ( } TcgPcrEvent = (TCG_PCR_EVENT *)EventLog; - TcgEfiSpecIdEventStruct = (TCG_EfiSpecIDEventStruct *) - (EventLog + OFFSET_OF (TCG_PCR_EVENT, Event)); - + TcgEfiSpecIdEventStruct = (TCG_EfiSpecIDEventStruct *)TcgPcrEvent->Event; CopyMem (&NumberOfAlgorithms, TcgEfiSpecIdEventStruct + 1, sizeof (NumberOfAlgorithms)); DigestSize = (TCG_EfiSpecIdEventAlgorithmSize *)((UINT8 *)TcgEfiSpecIdEventStruct + sizeof (*TcgEfiSpecIdEventStruct) + sizeof (NumberOfAlgorithms));