VirtualBox

Changeset 50526 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 20, 2014 5:01:32 PM (11 years ago)
Author:
vboxsync
Message:

Storage/VHDX: Finally commit and enable CRC-32c checksum validation after finding the cause for the failing checksum computation. The whole 4KB space needs to get used for the checksum though the header is only 512 bytes

Location:
trunk/src/VBox
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile.kmk

    r50458 r50526  
    264264        common/checksum/adler32.cpp \
    265265        common/checksum/crc32.cpp \
     266        common/checksum/crc32c.cpp \
    266267        common/checksum/crc64.cpp \
    267268        common/checksum/md5.cpp \
  • trunk/src/VBox/Storage/VHDX.cpp

    r48861 r50526  
    10641064            u32ChkSumSaved = pHdr1->u32Checksum;
    10651065            pHdr1->u32Checksum = 0;
    1066             //u32ChkSum = RTCrc32C(pHdr1, RT_OFFSETOF(VhdxHeader, u8Reserved[502]));
     1066            u32ChkSum = RTCrc32C(pHdr1, sizeof(VhdxHeader));
    10671067
    10681068            if (   pHdr1->u32Signature == VHDX_HEADER_SIGNATURE
    1069                 /*&& u32ChkSum == u32ChkSumSaved*/)
     1069                && u32ChkSum == u32ChkSumSaved)
    10701070                fHdr1Valid = true;
    10711071        }
     
    10811081            u32ChkSumSaved = pHdr2->u32Checksum;
    10821082            pHdr2->u32Checksum = 0;
    1083             //u32ChkSum = RTCrc32C(pHdr2, RT_OFFSETOF(VhdxHeader, u8Reserved[502]));
     1083            u32ChkSum = RTCrc32C(pHdr2, sizeof(VhdxHeader));
    10841084
    10851085            if (   pHdr2->u32Signature == VHDX_HEADER_SIGNATURE
    1086                 /*&& u32ChkSum == u32ChkSumSaved*/)
     1086                && u32ChkSum == u32ChkSumSaved)
    10871087                fHdr2Valid = true;
    10881088        }
     
    15711571
    15721572            /* Verify the region table integrity. */
    1573             //u32ChkSum = RTCrc32C(pbRegionTbl, VHDX_REGION_TBL_SIZE_MAX);
     1573            u32ChkSum = RTCrc32C(pbRegionTbl, VHDX_REGION_TBL_SIZE_MAX);
    15741574
    15751575            if (RegionTblHdr.u32Signature != VHDX_REGION_TBL_HDR_SIGNATURE)
     
    15771577                               "VHDX: Invalid signature for region table header of image \'%s\'",
    15781578                               pImage->pszFilename);
    1579 #if 0
    15801579            else if (u32ChkSum != RegionTblHdr.u32Checksum)
    15811580                rc = vdIfError(pImage->pIfError, VERR_VD_GEN_INVALID_HEADER, RT_SRC_POS,
    15821581                               "VHDX: CRC32 checksum mismatch for the region table of image \'%s\' (expected %#x got %#x)",
    15831582                               pImage->pszFilename, RegionTblHdr.u32Checksum, u32ChkSum);
    1584 #endif
    15851583            else if (RegionTblHdr.u32EntryCount > VHDX_REGION_TBL_HDR_ENTRY_COUNT_MAX)
    15861584                rc = vdIfError(pImage->pIfError, VERR_VD_GEN_INVALID_HEADER, RT_SRC_POS,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette