Fix a bug to check checksum of FFS data.
authorlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 28 Oct 2009 02:10:17 +0000 (02:10 +0000)
committerlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 28 Oct 2009 02:10:17 +0000 (02:10 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1732 7335b38e-4728-0410-8992-fb3ffe349368

Source/C/Common/FvLib.c
Source/C/VolInfo/VolInfo.c

index 5045592..dc50e87 100644 (file)
@@ -704,7 +704,7 @@ Returns:
     //\r
     FileLength          = GetLength (FfsHeader->Size);\r
     Checksum            = CalculateSum8 ((UINT8 *) (FfsHeader + 1), FileLength - sizeof (EFI_FFS_FILE_HEADER));\r
-    Checksum            = (UINT8) (Checksum - FfsHeader->State);\r
+    Checksum            = Checksum + FfsHeader->IntegrityCheck.Checksum.File;\r
     if (Checksum != 0) {\r
       Error (NULL, 0, 0006, "invalid FFS file checksum", "Ffs file with Guid %s", FileGuidString);\r
       return EFI_ABORTED;\r
index e72499d..ff61c9b 100644 (file)
@@ -1060,7 +1060,7 @@ Returns:
       // Calculate file checksum
       //
       Checksum  = CalculateSum8 ((UINT8 *) (FileHeader + 1), FileLength - sizeof (EFI_FFS_FILE_HEADER));
-      Checksum  = (UINT8) (Checksum - FileHeader->State);
+      Checksum  = Checksum + FileHeader->IntegrityCheck.Checksum.File;
       if (Checksum != 0) {
         Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer);
         return EFI_ABORTED;