From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=chen.a.chen@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0C3BD211CD601 for ; Thu, 21 Feb 2019 16:48:38 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2019 16:48:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,397,1544515200"; d="scan'208";a="321077516" Received: from chenche4.ccr.corp.intel.com ([10.239.9.12]) by fmsmga006.fm.intel.com with ESMTP; 21 Feb 2019 16:48:37 -0800 From: Chen A Chen To: edk2-devel@lists.01.org Date: Fri, 22 Feb 2019 08:48:35 +0800 Message-Id: <20190222004835.13780-1-chen.a.chen@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Subject: [PATCH] IntelSiliconPkg/MicrocodeUpdate: Fix incorrect checksum issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2019 00:48:39 -0000 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 Cc: Ray Ni Cc: Rangasai V Chaganty --- .../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