]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
MdeModulePkg/SecurityStubDxe: Defer 3rd party image before EndOfDxe
[mirror_edk2.git] / MdeModulePkg / Universal / SecurityStubDxe / SecurityStub.c
index f2ed384c945b01d0e5223a836eff18c1f9eca2ed..a75d8dc223e1490faac98c1f4fb1f3f345aa9a4a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This driver produces Security2 and Security architectural protocol based on SecurityManagementLib.\r
  \r
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2016, 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
@@ -20,6 +20,7 @@
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/SecurityManagementLib.h>\r
+#include "Defer3rdPartyImageLoad.h"\r
 \r
 //\r
 // Handle for the Security Architectural Protocol instance produced by this driver\r
@@ -69,13 +70,20 @@ SecurityStubAuthenticateState (
   IN CONST EFI_DEVICE_PATH_PROTOCOL    *File\r
   )\r
 {\r
-  return ExecuteSecurity2Handlers (EFI_AUTH_OPERATION_AUTHENTICATION_STATE, \r
+  EFI_STATUS Status;\r
+  \r
+  Status = ExecuteSecurity2Handlers (EFI_AUTH_OPERATION_AUTHENTICATION_STATE, \r
                                    AuthenticationStatus, \r
                                    File,\r
                                    NULL, \r
                                    0, \r
                                    FALSE\r
                                    );\r
+  if (Status == EFI_SUCCESS) {\r
+    Status = ExecuteSecurityHandlers (AuthenticationStatus, File);\r
+  }\r
+  \r
+  return Status;\r
 }\r
 \r
 /**\r
@@ -133,6 +141,15 @@ Security2StubAuthenticate (
   IN BOOLEAN                           BootPolicy\r
   )\r
 {\r
+  EFI_STATUS                           Status;\r
+\r
+  if (FileBuffer != NULL) {\r
+    Status = Defer3rdPartyImageLoad (File, BootPolicy);\r
+    if (EFI_ERROR (Status)) {\r
+      return Status;\r
+    }\r
+  }\r
+\r
   return ExecuteSecurity2Handlers (EFI_AUTH_OPERATION_VERIFY_IMAGE | \r
                                    EFI_AUTH_OPERATION_DEFER_IMAGE_LOAD | \r
                                    EFI_AUTH_OPERATION_MEASURE_IMAGE |\r
@@ -193,5 +210,7 @@ SecurityStubInitialize (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  Defer3rdPartyImageLoadInitialize ();\r
+\r
   return EFI_SUCCESS;\r
 }\r