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/Dxe | |
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/Dxe')
-rw-r--r-- | MdeModulePkg/Core/Dxe/FwVol/Ffs.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/MdeModulePkg/Core/Dxe/FwVol/Ffs.c b/MdeModulePkg/Core/Dxe/FwVol/Ffs.c index aec08b2..5eb22d0 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/Ffs.c +++ b/MdeModulePkg/Core/Dxe/FwVol/Ffs.c @@ -217,6 +217,8 @@ IsValidFfsFile ( )
{
EFI_FFS_FILE_STATE FileState;
+ UINT8 DataCheckSum;
+ UINT32 FileLength;
FileState = GetFileState (ErasePolarity, FfsHeader);
switch (FileState) {
@@ -224,11 +226,14 @@ IsValidFfsFile ( case EFI_FILE_DELETED:
case EFI_FILE_DATA_VALID:
case EFI_FILE_MARKED_FOR_UPDATE:
- //
- // Some other vliadation like file content checksum might be done here.
- // For performance issue, Tiano only do FileState check.
- //
- return TRUE;
+ DataCheckSum = FFS_FIXED_CHECKSUM;
+ FileLength = *(UINT32 *)(FfsHeader->Size) & 0x00FFFFFF;
+ if ((FfsHeader->Attributes & FFS_ATTRIB_CHECKSUM) == FFS_ATTRIB_CHECKSUM) {
+ DataCheckSum = CalculateCheckSum8 ((CONST UINT8 *)FfsHeader + sizeof(EFI_FFS_FILE_HEADER), FileLength - sizeof(EFI_FFS_FILE_HEADER));
+ }
+ if (FfsHeader->IntegrityCheck.Checksum.File == DataCheckSum) {
+ return TRUE;
+ }
default:
return FALSE;
|