]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c
SecurityPkg: Fix spelling errors
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / SecureBootConfigDxe / SecureBootConfigImpl.c
index 6123b5669779a87927076b11671eca29d6fc433b..83497a23f52d3ff2ba41b8bdf0d777361329c614 100644 (file)
@@ -1,15 +1,9 @@
 /** @file\r
   HII Config Access protocol implementation of SecureBoot configuration module.\r
 \r
-Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2018 Hewlett Packard Enterprise Development LP<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
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -240,7 +234,7 @@ SaveSecureBootVariable (
                                    it's caller's responsibility to free the memory when finish using it.\r
 \r
   @retval EFI_SUCCESS              Create time based payload successfully.\r
-  @retval EFI_OUT_OF_RESOURCES     There are not enough memory resourses to create time based payload.\r
+  @retval EFI_OUT_OF_RESOURCES     There are not enough memory resources to create time based payload.\r
   @retval EFI_INVALID_PARAMETER    The parameter is invalid.\r
   @retval Others                   Unexpected error happens.\r
 \r
@@ -396,7 +390,7 @@ SetSecureBootMode (
   @param[out]  PkCert                Point to the data buffer to store the signature list.\r
 \r
   @return EFI_UNSUPPORTED            Unsupported Key Length.\r
-  @return EFI_OUT_OF_RESOURCES       There are not enough memory resourses to form the signature list.\r
+  @return EFI_OUT_OF_RESOURCES       There are not enough memory resources to form the signature list.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -513,7 +507,7 @@ EnrollPlatformKey (
   DEBUG ((EFI_D_INFO, "FilePostFix = %s\n", FilePostFix));\r
 \r
   //\r
-  // Prase the selected PK file and generature PK certificate list.\r
+  // Prase the selected PK file and generate PK certificate list.\r
   //\r
   Status = CreatePkX509SignatureList (\r
             Private->FileContext->FHandle,\r
@@ -1094,7 +1088,7 @@ IsSignatureFoundInDatabase (
   }\r
 \r
   //\r
-  // Enumerate all signature data in SigDB to check if executable's signature exists.\r
+  // Enumerate all signature data in SigDB to check if signature exists for executable.\r
   //\r
   CertList = (EFI_SIGNATURE_LIST *) Data;\r
   while ((DataSize > 0) && (DataSize >= CertList->SignatureListSize)) {\r
@@ -1318,7 +1312,7 @@ Done:
 /**\r
   Check whether the signature list exists in given variable data.\r
 \r
-  It searches the signature list for the ceritificate hash by CertType.\r
+  It searches the signature list for the certificate hash by CertType.\r
   If the signature list is found, get the offset of Database for the\r
   next hash of a certificate.\r
 \r
@@ -1816,7 +1810,7 @@ LoadPeImage (
   Calculate hash of Pe/Coff image based on the authenticode image hashing in\r
   PE/COFF Specification 8.0 Appendix A\r
 \r
-  Notes: PE/COFF image has been checked by BasePeCoffLib PeCoffLoaderGetImageInfo() in \r
+  Notes: PE/COFF image has been checked by BasePeCoffLib PeCoffLoaderGetImageInfo() in\r
   the function LoadPeImage ().\r
 \r
   @param[in]    HashAlg   Hash algorithm type.\r
@@ -1831,7 +1825,6 @@ HashPeImage (
   )\r
 {\r
   BOOLEAN                   Status;\r
-  UINT16                    Magic;\r
   EFI_IMAGE_SECTION_HEADER  *Section;\r
   VOID                      *HashCtx;\r
   UINTN                     CtxSize;\r
@@ -1874,27 +1867,13 @@ HashPeImage (
   // Measuring PE/COFF Image Header;\r
   // But CheckSum field and SECURITY data directory (certificate) are excluded\r
   //\r
-  if (mNtHeader.Pe32->FileHeader.Machine == IMAGE_FILE_MACHINE_IA64 && mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
-    //\r
-    // NOTE: Some versions of Linux ELILO for Itanium have an incorrect magic value\r
-    //       in the PE/COFF Header. If the MachineType is Itanium(IA64) and the\r
-    //       Magic value in the OptionalHeader is EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC\r
-    //       then override the magic value to EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC\r
-    //\r
-    Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;\r
-  } else {\r
-    //\r
-    // Get the magic value from the PE/COFF Optional Header\r
-    //\r
-    Magic = mNtHeader.Pe32->OptionalHeader.Magic;\r
-  }\r
 \r
   //\r
   // 3.  Calculate the distance from the base of the image header to the image checksum address.\r
   // 4.  Hash the image header from its base to beginning of the image checksum.\r
   //\r
   HashBase = mImageBase;\r
-  if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
+  if (mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
     //\r
     // Use PE32 offset.\r
     //\r
@@ -1915,7 +1894,7 @@ HashPeImage (
   // 6.  Get the address of the beginning of the Cert Directory.\r
   // 7.  Hash everything from the end of the checksum to the start of the Cert Directory.\r
   //\r
-  if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
+  if (mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
     //\r
     // Use PE32 offset.\r
     //\r
@@ -1937,7 +1916,7 @@ HashPeImage (
   // 8.  Skip over the Cert Directory. (It is sizeof(IMAGE_DATA_DIRECTORY) bytes.)\r
   // 9.  Hash everything from the end of the Cert Directory to the end of image header.\r
   //\r
-  if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
+  if (mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
     //\r
     // Use PE32 offset\r
     //\r
@@ -1958,7 +1937,7 @@ HashPeImage (
   //\r
   // 10. Set the SUM_OF_BYTES_HASHED to the size of the header.\r
   //\r
-  if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
+  if (mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
     //\r
     // Use PE32 offset.\r
     //\r
@@ -2032,7 +2011,7 @@ HashPeImage (
   //\r
   if (mImageSize > SumOfBytesHashed) {\r
     HashBase = mImageBase + SumOfBytesHashed;\r
-    if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
+    if (mNtHeader.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {\r
       //\r
       // Use PE32 offset.\r
       //\r
@@ -2128,7 +2107,7 @@ HashPeImageByType (
 }\r
 \r
 /**\r
-  Enroll a new executable's signature into Signature Database.\r
+  Enroll a new signature of executable into Signature Database.\r
 \r
   @param[in] PrivateData     The module's private data.\r
   @param[in] VariableName    Variable name of signature database, must be\r
@@ -2198,7 +2177,7 @@ EnrollAuthentication2Descriptor (
   }\r
 \r
   //\r
-  // Diretly set AUTHENTICATION_2 data to SetVariable\r
+  // Directly set AUTHENTICATION_2 data to SetVariable\r
   //\r
   Status = gRT->SetVariable(\r
                   VariableName,\r
@@ -2229,7 +2208,7 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Enroll a new executable's signature into Signature Database.\r
+  Enroll a new signature of executable into Signature Database.\r
 \r
   @param[in] PrivateData     The module's private data.\r
   @param[in] VariableName    Variable name of signature database, must be\r
@@ -2268,7 +2247,7 @@ EnrollImageSignatureToSigDB (
   // Form the SigDB certificate list.\r
   // Format the data item into EFI_SIGNATURE_LIST type.\r
   //\r
-  // We need to parse executable's signature data from specified signed executable file.\r
+  // We need to parse signature data of executable from specified signed executable file.\r
   // In current implementation, we simply trust the pass-in signed executable file.\r
   // In reality, it's OS's responsibility to verify the signed executable file.\r
   //\r
@@ -3290,7 +3269,7 @@ SecureBootExtractConfigFromVariable (
   SecureBootMode   = NULL;\r
 \r
   //\r
-  // Initilize the Date and Time using system time.\r
+  // Initialize the Date and Time using system time.\r
   //\r
   ConfigData->CertificateFormat = HASHALG_RAW;\r
   ConfigData->AlwaysRevocation = TRUE;\r
@@ -3327,15 +3306,15 @@ SecureBootExtractConfigFromVariable (
   }\r
 \r
   //\r
-  // Check SecureBootEnable & Pk status, fix the inconsistence. \r
+  // Check SecureBootEnable & Pk status, fix the inconsistency.\r
   // If the SecureBootEnable Variable doesn't exist, hide the SecureBoot Enable/Disable\r
   // Checkbox.\r
   //\r
   ConfigData->AttemptSecureBoot = FALSE;\r
-  GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, (VOID**)&SecureBootEnable, NULL);  \r
+  GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, (VOID**)&SecureBootEnable, NULL);\r
 \r
   //\r
-  // Fix Pk, SecureBootEnable inconsistence\r
+  // Fix Pk and SecureBootEnable inconsistency\r
   //\r
   if ((SetupMode != NULL) && (*SetupMode) == USER_MODE) {\r
     ConfigData->HideSecureBoot = FALSE;\r
@@ -4385,7 +4364,7 @@ SecureBootCallback (
         Value->u8 = SECURE_BOOT_MODE_STANDARD;\r
         Status = EFI_SUCCESS;\r
       }\r
-    } \r
+    }\r
     goto EXIT;\r
   }\r
 \r