]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Tcg/MemoryOverwriteRequestControlLock/TcgMorLock.c
SecurityPkg: Fix spelling errors
[mirror_edk2.git] / SecurityPkg / Tcg / MemoryOverwriteRequestControlLock / TcgMorLock.c
index 7ca707915e25425ee859482bb8dc28e874c0ce88..aa230eeefa75f199c5e7925f89c9ad1d5281b0ed 100644 (file)
@@ -1,17 +1,11 @@
 /** @file\r
   TCG MOR (Memory Overwrite Request) Lock Control Driver.\r
 \r
-  This driver initilize MemoryOverwriteRequestControlLock variable.\r
+  This driver initializes MemoryOverwriteRequestControlLock variable.\r
   This module will add Variable Hook and allow MemoryOverwriteRequestControlLock variable set only once.\r
 \r
-Copyright (c) 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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -51,7 +45,7 @@ IsAnyMorVariable (
   UINTN   Index;\r
 \r
   for (Index = 0; Index < sizeof(mMorVariableType)/sizeof(mMorVariableType[0]); Index++) {\r
-    if ((StrCmp (VariableName, mMorVariableType[Index].VariableName) == 0) && \r
+    if ((StrCmp (VariableName, mMorVariableType[Index].VariableName) == 0) &&\r
         (CompareGuid (VendorGuid, mMorVariableType[Index].VendorGuid))) {\r
       return TRUE;\r
     }\r
@@ -74,7 +68,7 @@ IsMorLockVariable (
   IN EFI_GUID                               *VendorGuid\r
   )\r
 {\r
-  if ((StrCmp (VariableName, MEMORY_OVERWRITE_REQUEST_CONTROL_LOCK_NAME) == 0) && \r
+  if ((StrCmp (VariableName, MEMORY_OVERWRITE_REQUEST_CONTROL_LOCK_NAME) == 0) &&\r
       (CompareGuid (VendorGuid, &gEfiMemoryOverwriteRequestControlLockGuid))) {\r
     return TRUE;\r
   }\r
@@ -101,7 +95,7 @@ IsMorLockVariable (
   @retval  EFI_DEVICE_ERROR       The variable could not be saved due to a hardware failure.\r
   @retval  EFI_WRITE_PROTECTED    The variable in question is read-only.\r
   @retval  EFI_WRITE_PROTECTED    The variable in question cannot be deleted.\r
-  @retval  EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\r
+  @retval  EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\r
                                   set but the AuthInfo does NOT pass the validation check carried\r
                                   out by the firmware.\r
   @retval  EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.\r
@@ -142,21 +136,22 @@ SetVariableCheckHandlerMor (
     //\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
+  //\r
+  // Delete not OK\r
+  //\r
+  if ((DataSize != sizeof(UINT8)) || (Data == NULL) || (Attributes == 0)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   //\r
   // check format\r
   //\r
   if (IsMorLockVariable(VariableName, VendorGuid)) {\r
-    //\r
-    // Delete not OK\r
-    //\r
-    if ((DataSize == 0) || (Data == NULL) || (Attributes == 0)) {\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
     //\r
     // set to any other value not OK\r
     //\r
-    if ((DataSize != sizeof(UINT8)) || ((*(UINT8 *)Data != 1) && (*(UINT8 *)Data != 0))) {\r
+    if ((*(UINT8 *)Data != 1) && (*(UINT8 *)Data != 0)) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
   }\r
@@ -172,7 +167,7 @@ SetVariableCheckHandlerMor (
   @param[in] ImageHandle  Image handle of this driver.\r
   @param[in] SystemTable  A Pointer to the EFI System Table.\r
 \r
-  @retval EFI_SUCEESS     \r
+  @retval EFI_SUCCESS\r
   @return Others          Some error occurs.\r
 **/\r
 EFI_STATUS\r