]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Library / DxeSecurityManagementLib / DxeSecurityManagementLib.c
index aa4d93b6f3a2c1ebf24401a3db613f2d7afd4b67..65d788bc6863b3c1aa3dae6e49d608a91ed4c049 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Provides generic security measurement functions for DXE module.\r
 \r
-Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2018, 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
@@ -68,8 +68,8 @@ ReallocateSecurityHandlerTable (
   // Reallocate memory for security info structure.\r
   //\r
   mSecurityTable = ReallocatePool (\r
-                     mMaxNumberOfSecurityHandler * sizeof (SECURITY_INFO), \r
-                     (mMaxNumberOfSecurityHandler + SECURITY_HANDLER_TABLE_SIZE) * sizeof (SECURITY_INFO), \r
+                     mMaxNumberOfSecurityHandler * sizeof (SECURITY_INFO),\r
+                     (mMaxNumberOfSecurityHandler + SECURITY_HANDLER_TABLE_SIZE) * sizeof (SECURITY_INFO),\r
                      mSecurityTable\r
                      );\r
 \r
@@ -88,7 +88,7 @@ ReallocateSecurityHandlerTable (
 }\r
 \r
 /**\r
- Check whether an operation is valid according to the requirement of current operation, \r
+ Check whether an operation is valid according to the requirement of current operation,\r
  which must make sure that the measure image operation is the last one.\r
 \r
  @param CurrentAuthOperation  Current operation.\r
@@ -102,14 +102,14 @@ CheckAuthenticationOperation (
   IN  UINT32    CurrentAuthOperation,\r
   IN  UINT32    CheckAuthOperation\r
   )\r
-{ \r
+{\r
   //\r
   // Make sure new auth operation can be recognized.\r
   //\r
   ASSERT ((CheckAuthOperation & ~(EFI_AUTH_IMAGE_OPERATION_MASK | EFI_AUTH_OPERATION_AUTHENTICATION_STATE | EFI_AUTH_OPERATION_IMAGE_REQUIRED)) == 0);\r
-  \r
+\r
   //\r
-  // When current operation includes measure image operation, \r
+  // When current operation includes measure image operation,\r
   // only another measure image operation or none operation will be allowed.\r
   //\r
   if ((CurrentAuthOperation & EFI_AUTH_OPERATION_MEASURE_IMAGE) == EFI_AUTH_OPERATION_MEASURE_IMAGE) {\r
@@ -120,9 +120,9 @@ CheckAuthenticationOperation (
       return FALSE;\r
     }\r
   }\r
-  \r
+\r
   //\r
-  // When current operation doesn't include measure image operation, \r
+  // When current operation doesn't include measure image operation,\r
   // any new operation will be allowed.\r
   //\r
   return TRUE;\r
@@ -184,12 +184,12 @@ RegisterSecurityHandler (
   Execute registered handlers until one returns an error and that error is returned.\r
   If none of the handlers return an error, then EFI_SUCCESS is returned.\r
 \r
-  Before exectue handler, get the image buffer by file device path if a handler \r
+  Before exectue handler, get the image buffer by file device path if a handler\r
   requires the image file. And return the image buffer to each handler when exectue handler.\r
 \r
   The handlers are executed in same order to their registered order.\r
 \r
-  @param[in]  AuthenticationStatus \r
+  @param[in]  AuthenticationStatus\r
                            This is the authentication type returned from the Section\r
                            Extraction protocol. See the Section Extraction Protocol\r
                            Specification for details on this type.\r
@@ -197,9 +197,9 @@ RegisterSecurityHandler (
                            being dispatched. This will optionally be used for logging.\r
 \r
   @retval EFI_SUCCESS            The file specified by File did authenticate when more\r
-                                 than one security handler services were registered, \r
-                                 or the file did not authenticate when no security \r
-                                 handler service was registered. And the platform policy \r
+                                 than one security handler services were registered,\r
+                                 or the file did not authenticate when no security\r
+                                 handler service was registered. And the platform policy\r
                                  dictates that the DXE Core may use File.\r
   @retval EFI_INVALID_PARAMETER  File is NULL.\r
   @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and\r
@@ -226,7 +226,7 @@ ExecuteSecurityHandlers (
   EFI_HANDLE    Handle;\r
   EFI_DEVICE_PATH_PROTOCOL        *Node;\r
   EFI_DEVICE_PATH_PROTOCOL        *FilePathToVerfiy;\r
-  \r
+\r
   if (FilePath == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -237,7 +237,7 @@ ExecuteSecurityHandlers (
   if (mNumberOfSecurityHandler == 0) {\r
     return EFI_SUCCESS;\r
   }\r
-  \r
+\r
   Status                      = EFI_SUCCESS;\r
   FileBuffer                  = NULL;\r
   FileSize                    = 0;\r
@@ -309,8 +309,8 @@ ReallocateSecurity2HandlerTable (
   // Reallocate memory for security info structure.\r
   //\r
   mSecurity2Table = ReallocatePool (\r
-                     mMaxNumberOfSecurity2Handler * sizeof (SECURITY2_INFO), \r
-                     (mMaxNumberOfSecurity2Handler + SECURITY_HANDLER_TABLE_SIZE) * sizeof (SECURITY2_INFO), \r
+                     mMaxNumberOfSecurity2Handler * sizeof (SECURITY2_INFO),\r
+                     (mMaxNumberOfSecurity2Handler + SECURITY_HANDLER_TABLE_SIZE) * sizeof (SECURITY2_INFO),\r
                      mSecurity2Table\r
                      );\r
 \r
@@ -329,17 +329,17 @@ ReallocateSecurity2HandlerTable (
 }\r
 \r
 /**\r
-  Check whether an operation is valid according to the requirement of current operation, \r
+  Check whether an operation is valid according to the requirement of current operation,\r
   which must make sure that the measure image operation is the last one.\r
-  \r
+\r
   If AuthenticationOperation is not recongnized, return FALSE.\r
   If AuthenticationOperation is EFI_AUTH_OPERATION_NONE, return FALSE.\r
   If AuthenticationOperation includes security operation and authentication operation, return FALSE.\r
   If the previous register handler can't be executed before the later register handler, return FALSE.\r
-  \r
+\r
   @param CurrentAuthOperation  Current operation.\r
   @param CheckAuthOperation    Operation to be checked.\r
-  \r
+\r
   @retval  TRUE   Operation is valid for current operation.\r
   @retval  FALSE  Operation is invalid for current operation.\r
 **/\r
@@ -348,21 +348,21 @@ CheckAuthentication2Operation (
   IN  UINT32    CurrentAuthOperation,\r
   IN  UINT32    CheckAuthOperation\r
   )\r
-{ \r
+{\r
   //\r
   // Make sure new auth operation can be recognized.\r
   //\r
   if (CheckAuthOperation == EFI_AUTH_OPERATION_NONE) {\r
     return FALSE;\r
   }\r
-  if ((CheckAuthOperation & ~(EFI_AUTH_IMAGE_OPERATION_MASK | \r
-                              EFI_AUTH_NONE_IMAGE_OPERATION_MASK | \r
+  if ((CheckAuthOperation & ~(EFI_AUTH_IMAGE_OPERATION_MASK |\r
+                              EFI_AUTH_NONE_IMAGE_OPERATION_MASK |\r
                               EFI_AUTH_OPERATION_IMAGE_REQUIRED)) != 0) {\r
     return FALSE;\r
   }\r
 \r
   //\r
-  // When current operation includes measure image operation, \r
+  // When current operation includes measure image operation,\r
   // only another measure image or none image operation will be allowed.\r
   //\r
   if ((CurrentAuthOperation & EFI_AUTH_OPERATION_MEASURE_IMAGE) == EFI_AUTH_OPERATION_MEASURE_IMAGE) {\r
@@ -373,7 +373,7 @@ CheckAuthentication2Operation (
       return FALSE;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Any other operation will be allowed.\r
   //\r
@@ -434,16 +434,16 @@ RegisterSecurity2Handler (
 }\r
 \r
 /**\r
-  Execute registered handlers based on input AuthenticationOperation until \r
-  one returns an error and that error is returned. \r
-  \r
+  Execute registered handlers based on input AuthenticationOperation until\r
+  one returns an error and that error is returned.\r
+\r
   If none of the handlers return an error, then EFI_SUCCESS is returned.\r
   The handlers those satisfy AuthenticationOperation will only be executed.\r
   The handlers are executed in same order to their registered order.\r
 \r
-  @param[in]  AuthenticationOperation   \r
+  @param[in]  AuthenticationOperation\r
                            The operation type specifies which handlers will be executed.\r
-  @param[in]  AuthenticationStatus \r
+  @param[in]  AuthenticationStatus\r
                            The authentication status for the input file.\r
   @param[in]  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
@@ -461,7 +461,7 @@ RegisterSecurity2Handler (
   @retval EFI_SUCCESS             FileBuffer is NULL and current user has permission to start\r
                                   UEFI device drivers on the device path specified by DevicePath.\r
   @retval EFI_SECURITY_VIOLATION  The file specified by File or FileBuffer did not\r
-                                  authenticate, and the platform policy dictates that \r
+                                  authenticate, and the platform policy dictates that\r
                                   the file should be placed in the untrusted state.\r
   @retval EFI_SECURITY_VIOLATION  FileBuffer FileBuffer is NULL and the user has no\r
                                   permission to start UEFI device drivers on the device path specified\r
@@ -472,7 +472,7 @@ RegisterSecurity2Handler (
   @retval EFI_ACCESS_DENIED       The file specified by File did not authenticate, and\r
                                   the platform policy dictates that the DXE\r
                                   Foundation may not use File.\r
-  @retval EFI_INVALID_PARAMETER   File and FileBuffer are both NULL. \r
+  @retval EFI_INVALID_PARAMETER   File and FileBuffer are both NULL.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r