public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] IntelSiliconPkg/MicrocodeUpdate: Fix incorrect checksum issue
@ 2019-02-22  0:48 Chen A Chen
  2019-02-22  9:47 ` Ni, Ray
  0 siblings, 1 reply; 2+ messages in thread
From: Chen A Chen @ 2019-02-22  0:48 UTC (permalink / raw)
  To: edk2-devel

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.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
---
 .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c       | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
index 9b5757da71..e45c7a8def 100644
--- a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
+++ b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
@@ -390,6 +390,7 @@ VerifyMicrocode (
   UINTN                                   DataSize;
   UINT32                                  CurrentRevision;
   PROCESSOR_INFO                          *ProcessorInfo;
+  UINT32                                  InCompleteCheckSum32;
   UINT32                                  CheckSum32;
   UINTN                                   ExtendedTableLength;
   UINT32                                  ExtendedTableCount;
@@ -488,6 +489,10 @@ VerifyMicrocode (
     }
     return EFI_VOLUME_CORRUPTED;
   }
+  InCompleteCheckSum32 = CheckSum32;
+  InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorSignature.Uint32;
+  InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorFlags;
+  InCompleteCheckSum32 -= MicrocodeEntryPoint->Checksum;
 
   //
   // Check ProcessorSignature/ProcessorFlags
@@ -522,7 +527,10 @@ VerifyMicrocode (
           } else {
             ExtendedTable = (CPU_MICROCODE_EXTENDED_TABLE *)(ExtendedTableHeader + 1);
             for (Index = 0; Index < ExtendedTableCount; Index++) {
-              CheckSum32 = CalculateSum32((UINT32 *)ExtendedTable, sizeof(CPU_MICROCODE_EXTENDED_TABLE));
+              CheckSum32 = InCompleteCheckSum32;
+              CheckSum32 += ExtendedTable->ProcessorSignature.Uint32;
+              CheckSum32 += ExtendedTable->ProcessorFlag;
+              CheckSum32 += ExtendedTable->Checksum;
               if (CheckSum32 != 0) {
                 DEBUG((DEBUG_ERROR, "VerifyMicrocode - The checksum for ExtendedTable entry with index 0x%x is incorrect\n", Index));
               } else {
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] IntelSiliconPkg/MicrocodeUpdate: Fix incorrect checksum issue
  2019-02-22  0:48 [PATCH] IntelSiliconPkg/MicrocodeUpdate: Fix incorrect checksum issue Chen A Chen
@ 2019-02-22  9:47 ` Ni, Ray
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ray @ 2019-02-22  9:47 UTC (permalink / raw)
  To: Chen, Chen A, edk2-devel@lists.01.org

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Chen
> A Chen
> Sent: Friday, February 22, 2019 8:49 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH] IntelSiliconPkg/MicrocodeUpdate: Fix incorrect
> checksum issue
> 
> 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.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
> ---
>  .../Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c       | 10
> +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git
> a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> index 9b5757da71..e45c7a8def 100644
> ---
> a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> +++
> b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> @@ -390,6 +390,7 @@ VerifyMicrocode (
>    UINTN                                   DataSize;
>    UINT32                                  CurrentRevision;
>    PROCESSOR_INFO                          *ProcessorInfo;
> +  UINT32                                  InCompleteCheckSum32;
>    UINT32                                  CheckSum32;
>    UINTN                                   ExtendedTableLength;
>    UINT32                                  ExtendedTableCount;
> @@ -488,6 +489,10 @@ VerifyMicrocode (
>      }
>      return EFI_VOLUME_CORRUPTED;
>    }
> +  InCompleteCheckSum32 = CheckSum32;
> +  InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorSignature.Uint32;
> +  InCompleteCheckSum32 -= MicrocodeEntryPoint->ProcessorFlags;
> +  InCompleteCheckSum32 -= MicrocodeEntryPoint->Checksum;
> 
>    //
>    // Check ProcessorSignature/ProcessorFlags
> @@ -522,7 +527,10 @@ VerifyMicrocode (
>            } else {
>              ExtendedTable = (CPU_MICROCODE_EXTENDED_TABLE
> *)(ExtendedTableHeader + 1);
>              for (Index = 0; Index < ExtendedTableCount; Index++) {
> -              CheckSum32 = CalculateSum32((UINT32 *)ExtendedTable,
> sizeof(CPU_MICROCODE_EXTENDED_TABLE));
> +              CheckSum32 = InCompleteCheckSum32;
> +              CheckSum32 += ExtendedTable->ProcessorSignature.Uint32;
> +              CheckSum32 += ExtendedTable->ProcessorFlag;
> +              CheckSum32 += ExtendedTable->Checksum;
>                if (CheckSum32 != 0) {
>                  DEBUG((DEBUG_ERROR, "VerifyMicrocode - The checksum for
> ExtendedTable entry with index 0x%x is incorrect\n", Index));
>                } else {
> --
> 2.16.2.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-22  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-22  0:48 [PATCH] IntelSiliconPkg/MicrocodeUpdate: Fix incorrect checksum issue Chen A Chen
2019-02-22  9:47 ` Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox