]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
Measure PEimage and ActionString data according to TPM requirement.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / DxeMain / DxeMain.c
index 87d98e8b02fdf3aacd6ff8a7eb7a2cc116df989c..0f785ddbe0d94db1f0da179c6a61ca75c806aec6 100644 (file)
@@ -753,12 +753,37 @@ Returns:
 --*/\r
 {\r
   EFI_STATUS    Status;\r
+  EFI_STATUS    StatusTemp;\r
+  EFI_TCG_PLATFORM_PROTOCOL *TcgPlatformProtocol;\r
+\r
+  //\r
+  // Measure invocation of ExitBootServices, \r
+  // which is defined by TCG_EFI_Platform_1_20_Final Specification\r
+  //\r
+  TcgPlatformProtocol = NULL;\r
+  Status = CoreLocateProtocol (\r
+             &gEfiTcgPlatformProtocolGuid,\r
+             NULL,\r
+             (VOID **) &TcgPlatformProtocol\r
+             );\r
+  if (!EFI_ERROR (Status)) {\r
+    Status = TcgPlatformProtocol->MeasureAction (EFI_EXIT_BOOT_SERVICES_INVOCATION);\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
 \r
   //\r
   // Terminate memory services if the MapKey matches\r
   //\r
   Status = CoreTerminateMemoryMap (MapKey);\r
   if (EFI_ERROR (Status)) {\r
+    //\r
+    // Measure failure of ExitBootServices\r
+    //\r
+    if (TcgPlatformProtocol != NULL) {\r
+      StatusTemp = TcgPlatformProtocol->MeasureAction (EFI_EXIT_BOOT_SERVICES_FAILED);\r
+      ASSERT_EFI_ERROR (StatusTemp);\r
+    }\r
+\r
     return Status;\r
   }\r
 \r
@@ -811,6 +836,14 @@ Returns:
   //\r
   gRuntime->AtRuntime = TRUE;\r
 \r
+  //\r
+  // Measure success of ExitBootServices\r
+  //\r
+  if (TcgPlatformProtocol != NULL) {\r
+    StatusTemp = TcgPlatformProtocol->MeasureAction (EFI_EXIT_BOOT_SERVICES_SUCCEEDED);\r
+    ASSERT_EFI_ERROR (StatusTemp);\r
+  }\r
\r
   return Status;\r
 }\r
 \r