]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelSiliconPkg/MicrocodeUpdate: Fix incorrect checksum issue
authorChen A Chen <chen.a.chen@intel.com>
Mon, 18 Feb 2019 07:21:14 +0000 (15:21 +0800)
committerLiming Gao <liming.gao@intel.com>
Mon, 25 Feb 2019 01:14:21 +0000 (09:14 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1020

The same issue has fixed in UefiCpuPkg/Microcode.c file.
Please reference b6f67b4d58b81f12f63f5f8c94cf8af3600297ab
to get more detail information.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c

index 9b5757da715a3b6520f773202af4f35d047c0adb..e45c7a8def0d104dda1d21ffa1112e00fe312e61 100644 (file)
@@ -390,6 +390,7 @@ VerifyMicrocode (
   UINTN                                   DataSize;\r
   UINT32                                  CurrentRevision;\r
   PROCESSOR_INFO                          *ProcessorInfo;\r
   UINTN                                   DataSize;\r
   UINT32                                  CurrentRevision;\r
   PROCESSOR_INFO                          *ProcessorInfo;\r
+  UINT32                                  InCompleteCheckSum32;\r
   UINT32                                  CheckSum32;\r
   UINTN                                   ExtendedTableLength;\r
   UINT32                                  ExtendedTableCount;\r
   UINT32                                  CheckSum32;\r
   UINTN                                   ExtendedTableLength;\r
   UINT32                                  ExtendedTableCount;\r
@@ -488,6 +489,10 @@ VerifyMicrocode (
     }\r
     return EFI_VOLUME_CORRUPTED;\r
   }\r
     }\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
 \r
   //\r
   // Check ProcessorSignature/ProcessorFlags\r
@@ -522,7 +527,10 @@ VerifyMicrocode (
           } else {\r
             ExtendedTable = (CPU_MICROCODE_EXTENDED_TABLE *)(ExtendedTableHeader + 1);\r
             for (Index = 0; Index < ExtendedTableCount; Index++) {\r
           } 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
               if (CheckSum32 != 0) {\r
                 DEBUG((DEBUG_ERROR, "VerifyMicrocode - The checksum for ExtendedTable entry with index 0x%x is incorrect\n", Index));\r
               } else {\r