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

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-boun...@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.c...@intel.com>
> Cc: Ray Ni <ray...@intel.com>
> Cc: Rangasai V Chaganty <rangasai.v.chaga...@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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to