diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-02-23 03:09:55 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-02-23 03:09:55 +0000 |
commit | 89cd8129f72bc2c445839efcddace560bfdfeb8f (patch) | |
tree | 250846f6b5adee2d466831f6c827610698889cec /MdeModulePkg/Core/Pei | |
parent | 59424fff04b0d47b796e91b47d6826db6aac1721 (diff) | |
download | edk2-89cd8129f72bc2c445839efcddace560bfdfeb8f.zip edk2-89cd8129f72bc2c445839efcddace560bfdfeb8f.tar.gz edk2-89cd8129f72bc2c445839efcddace560bfdfeb8f.tar.bz2 |
Update PeiCore and DxeCore to verify FFS data checksum.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11332 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Pei')
-rw-r--r-- | MdeModulePkg/Core/Pei/FwVol/FwVol.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c index c40f0ea..941657c 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -162,6 +162,7 @@ FindFileEx ( UINT64 FvLength;
UINT8 ErasePolarity;
UINT8 FileState;
+ UINT8 DataCheckSum;
//
// Convert the handle of FV to FV header for memory-mapped firmware volume
@@ -219,6 +220,16 @@ FindFileEx ( FileLength = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF;
FileOccupiedSize = GET_OCCUPIED_SIZE(FileLength, 8);
+ DataCheckSum = FFS_FIXED_CHECKSUM;
+ if ((FfsFileHeader->Attributes & FFS_ATTRIB_CHECKSUM) == FFS_ATTRIB_CHECKSUM) {
+ DataCheckSum = CalculateCheckSum8 ((CONST UINT8 *)FfsFileHeader + sizeof(EFI_FFS_FILE_HEADER), FileLength - sizeof(EFI_FFS_FILE_HEADER));
+ }
+ if (FfsFileHeader->IntegrityCheck.Checksum.File != DataCheckSum) {
+ ASSERT (FALSE);
+ *FileHeader = NULL;
+ return EFI_NOT_FOUND;
+ }
+
if (FileName != NULL) {
if (CompareGuid (&FfsFileHeader->Name, (EFI_GUID*)FileName)) {
*FileHeader = FfsFileHeader;
|