]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
IntelSiliconPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelSiliconPkg / Feature / Capsule / MicrocodeUpdateDxe / MicrocodeUpdate.c
index 9b5757da715a3b6520f773202af4f35d047c0adb..84914973b961c3f687c080bb0ed1b76f5be46ebd 100644 (file)
@@ -9,13 +9,7 @@
   MicrocodeWrite() and VerifyMicrocode() will receive untrusted input and do basic validation.\r
 \r
   Copyright (c) 2016 - 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
-  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
@@ -390,6 +384,7 @@ VerifyMicrocode (
   UINTN                                   DataSize;\r
   UINT32                                  CurrentRevision;\r
   PROCESSOR_INFO                          *ProcessorInfo;\r
+  UINT32                                  InCompleteCheckSum32;\r
   UINT32                                  CheckSum32;\r
   UINTN                                   ExtendedTableLength;\r
   UINT32                                  ExtendedTableCount;\r
@@ -488,6 +483,10 @@ VerifyMicrocode (
     }\r
     return EFI_VOLUME_CORRUPTED;\r
   }\r
+  InCompleteCheckSum32 = CheckSum32;\r
+  InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorSignature.Uint32;\r
+  InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorFlags;\r
+  InCompleteCheckSum32 -= MicrocodeEntryPoint->Checksum;\r
 \r
   //\r
   // Check ProcessorSignature/ProcessorFlags\r
@@ -522,7 +521,10 @@ VerifyMicrocode (
           } else {\r
             ExtendedTable = (CPU_MICROCODE_EXTENDED_TABLE *)(ExtendedTableHeader + 1);\r
             for (Index = 0; Index < ExtendedTableCount; Index++) {\r
-              CheckSum32 = CalculateSum32((UINT32 *)ExtendedTable, sizeof(CPU_MICROCODE_EXTENDED_TABLE));\r
+              CheckSum32 = InCompleteCheckSum32;\r
+              CheckSum32 += ExtendedTable->ProcessorSignature.Uint32;\r
+              CheckSum32 += ExtendedTable->ProcessorFlag;\r
+              CheckSum32 += ExtendedTable->Checksum;\r
               if (CheckSum32 != 0) {\r
                 DEBUG((DEBUG_ERROR, "VerifyMicrocode - The checksum for ExtendedTable entry with index 0x%x is incorrect\n", Index));\r
               } else {\r