]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
SecurityPkg: Update VariableAuthenticated driver with following changes:
[mirror_edk2.git] / MdeModulePkg / Universal / SecurityStubDxe / SecurityStub.c
index 2eb325ec56148fc124c0d944148a1701ba2f839c..8e81d87f95981f2fb633907948f354601d64baf9 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
-  This driver supports platform security service.\r
-  \r
-  Copyright (c) 2006 - 2007, Intel Corporation                                              \r
-  All rights reserved. This program and the accompanying materials                          \r
+  This driver produces security architectural protocol based on SecurityManagementLib.\r
\r
+  Copyright (c) 2006 - 2009, 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
   http://opensource.org/licenses/bsd-license.php                                            \r
 **/\r
 \r
 \r
-#include "SecurityStub.h"\r
+#include <Uefi.h>\r
+#include <Protocol/Security.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/SecurityManagementLib.h>\r
 \r
 //\r
 // Handle for the Security Architectural Protocol instance produced by this driver\r
 //\r
 EFI_HANDLE                  mSecurityArchProtocolHandle = NULL;\r
 \r
-//\r
-// Security Architectural Protocol instance produced by this driver\r
-//\r
-EFI_SECURITY_ARCH_PROTOCOL  mSecurityStub = { \r
-  SecurityStubAuthenticateState \r
-};\r
-\r
-\r
 /**\r
   The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific \r
   policy from the DXE core response to an attempt to use a file that returns a \r
@@ -60,45 +57,34 @@ EFI_SECURITY_ARCH_PROTOCOL  mSecurityStub = {
   @param  File             This is a pointer to the device path of the file that is\r
                            being dispatched. This will optionally be used for logging.\r
 \r
-  @retval EFI_SUCCESS           The file specified by File did authenticate, and the\r
-                                platform policy dictates that the DXE Core may use File.\r
-  @retval EFI_INVALID_PARAMETER Driver is NULL.\r
-  @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and\r
-                                the platform policy dictates that File should be placed\r
-                                in the untrusted state. A file may be promoted from\r
-                                the untrusted to the trusted state at a future time\r
-                                with a call to the Trust() DXE Service.\r
-  @retval EFI_ACCESS_DENIED     The file specified by File did not authenticate, and\r
-                                the platform policy dictates that File should not be\r
-                                used for any purpose.\r
-\r
+  @retval EFI_SUCCESS            Do nothing and return success.\r
+  @retval EFI_INVALID_PARAMETER  File is NULL.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 SecurityStubAuthenticateState (\r
-  IN EFI_SECURITY_ARCH_PROTOCOL  *This,\r
-  IN UINT32                      AuthenticationStatus,\r
-  IN EFI_DEVICE_PATH_PROTOCOL    *File\r
+  IN CONST EFI_SECURITY_ARCH_PROTOCOL  *This,\r
+  IN UINT32                            AuthenticationStatus,\r
+  IN CONST EFI_DEVICE_PATH_PROTOCOL    *File\r
   )\r
 {\r
-  if (File == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
+  return ExecuteSecurityHandlers (AuthenticationStatus, File);\r
 }\r
 \r
+//\r
+// Security Architectural Protocol instance produced by this driver\r
+//\r
+EFI_SECURITY_ARCH_PROTOCOL  mSecurityStub = { \r
+  SecurityStubAuthenticateState \r
+};\r
 \r
 /**\r
-  The user Entry Point for DXE driver. The user code starts with this function\r
-  as the real entry point for the image goes into a library that calls this \r
-  function.\r
+  Installs Security Architectural Protocol.\r
 \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
-  @param[in] SystemTable    A pointer to the EFI System Table.\r
+  @param  ImageHandle  The image handle of this driver.\r
+  @param  SystemTable  A pointer to the EFI System Table.\r
   \r
-  @retval EFI_SUCCESS       The entry point is executed successfully.\r
-  @retval other             Some error occurs when executing this entry point.\r
+  @retval EFI_SUCCESS   Install the sample Security Architectural Protocol successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -126,5 +112,5 @@ SecurityStubInitialize (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  return Status;\r
+  return EFI_SUCCESS;\r
 }\r