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
UINTN DataSize;\r
UINT32 CurrentRevision;\r
PROCESSOR_INFO *ProcessorInfo;\r
+ UINT32 InCompleteCheckSum32;\r
UINT32 CheckSum32;\r
UINTN ExtendedTableLength;\r
UINT32 ExtendedTableCount;\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
} 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