]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.c
Add TPM2 support defined in trusted computing group.
[mirror_edk2.git] / SecurityPkg / Library / DxeTpmMeasurementLib / DxeTpmMeasurementLib.c
index ffeac59ba4d5f5d7d420bd386bc1cc6a6602070c..7a2ec7f221e5fd04d01552a81f2223c21a560853 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This library is used by other modules to measure data to TPM.\r
 \r
-Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved. <BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <PiDxe.h>\r
 \r
 #include <Protocol/TcgService.h>\r
-#include <Protocol/TrEEProtocol.h>\r
+#include <Protocol/Tcg2Protocol.h>\r
 \r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
@@ -120,37 +120,37 @@ Tpm20MeasureAndLogData (
   )\r
 {\r
   EFI_STATUS                Status;\r
-  EFI_TREE_PROTOCOL         *TreeProtocol;\r
-  TrEE_EVENT                *TreeEvent;\r
+  EFI_TCG2_PROTOCOL         *Tcg2Protocol;\r
+  EFI_TCG2_EVENT            *Tcg2Event;\r
 \r
   //\r
-  // TrEEPresentFlag is checked in HashLogExtendEvent\r
+  // TPMPresentFlag is checked in HashLogExtendEvent\r
   //\r
-  Status = gBS->LocateProtocol (&gEfiTrEEProtocolGuid, NULL, (VOID **) &TreeProtocol);\r
+  Status = gBS->LocateProtocol (&gEfiTcg2ProtocolGuid, NULL, (VOID **) &Tcg2Protocol);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
-  TreeEvent = (TrEE_EVENT *) AllocateZeroPool (LogLen + sizeof (TrEE_EVENT));\r
-  if(TreeEvent == NULL) {\r
+  Tcg2Event = (EFI_TCG2_EVENT *) AllocateZeroPool (LogLen + sizeof (EFI_TCG2_EVENT));\r
+  if(Tcg2Event == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  TreeEvent->Size = (UINT32)LogLen + sizeof (TrEE_EVENT) - sizeof(TreeEvent->Event);\r
-  TreeEvent->Header.HeaderSize    = sizeof(TrEE_EVENT_HEADER);\r
-  TreeEvent->Header.HeaderVersion = TREE_EVENT_HEADER_VERSION;\r
-  TreeEvent->Header.PCRIndex      = PcrIndex;\r
-  TreeEvent->Header.EventType     = EventType;\r
-  CopyMem (&TreeEvent->Event[0], EventLog, LogLen);\r
+  Tcg2Event->Size = (UINT32)LogLen + sizeof (EFI_TCG2_EVENT) - sizeof(Tcg2Event->Event);\r
+  Tcg2Event->Header.HeaderSize    = sizeof(EFI_TCG2_EVENT_HEADER);\r
+  Tcg2Event->Header.HeaderVersion = EFI_TCG2_EVENT_HEADER_VERSION;\r
+  Tcg2Event->Header.PCRIndex      = PcrIndex;\r
+  Tcg2Event->Header.EventType     = EventType;\r
+  CopyMem (&Tcg2Event->Event[0], EventLog, LogLen);\r
 \r
-  Status = TreeProtocol->HashLogExtendEvent (\r
-                           TreeProtocol,\r
+  Status = Tcg2Protocol->HashLogExtendEvent (\r
+                           Tcg2Protocol,\r
                            0,\r
                            (EFI_PHYSICAL_ADDRESS)(UINTN)HashData,\r
                            HashDataLen,\r
-                           TreeEvent\r
+                           Tcg2Event\r
                            );\r
-  FreePool (TreeEvent);\r
+  FreePool (Tcg2Event);\r
 \r
   return Status;\r
 }\r