Changeset 50526 in vbox
- Timestamp:
- Feb 20, 2014 5:01:32 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
-
include/iprt/crc.h (modified) (1 diff)
-
include/iprt/mangling.h (modified) (1 diff)
-
src/VBox/Runtime/Makefile.kmk (modified) (1 diff)
-
src/VBox/Runtime/common/checksum/crc32c.cpp (added)
-
src/VBox/Storage/VHDX.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/crc.h
r44528 r50526 153 153 /** @} */ 154 154 155 156 /** @defgroup grp_rt_crc32c CRC-32C 157 * @{ */ 158 /** 159 * Calculate CRC-32C for a memory block. 160 * 161 * @returns CRC-32C for the memory block. 162 * @param pv Pointer to the memory block. 163 * @param cb Size of the memory block in bytes. 164 */ 165 RTDECL(uint32_t) RTCrc32C(const void *pv, size_t cb); 166 167 /** 168 * Start a multiblock CRC-32 calculation. 169 * 170 * @returns Start CRC-32. 171 */ 172 RTDECL(uint32_t) RTCrc32CStart(void); 173 174 /** 175 * Processes a multiblock of a CRC-32C calculation. 176 * 177 * @returns Intermediate CRC-32C value. 178 * @param uCRC32C Current CRC-32C intermediate value. 179 * @param pv The data block to process. 180 * @param cb The size of the data block in bytes. 181 */ 182 RTDECL(uint32_t) RTCrc32CProcess(uint32_t uCRC32C, const void *pv, size_t cb); 183 184 /** 185 * Complete a multiblock CRC-32 calculation. 186 * 187 * @returns CRC-32 value. 188 * @param uCRC32 Current CRC-32 intermediate value. 189 */ 190 RTDECL(uint32_t) RTCrc32CFinish(uint32_t uCRC32); 191 192 /** @} */ 193 155 194 /** @} */ 156 195 -
trunk/include/iprt/mangling.h
r50456 r50526 319 319 # define RTCrc32Process RT_MANGLER(RTCrc32Process) 320 320 # define RTCrc32Start RT_MANGLER(RTCrc32Start) 321 # define RTCrc32C RT_MANGLER(RTCrc32C) 322 # define RTCrc32CFinish RT_MANGLER(RTCrc32CFinish) 323 # define RTCrc32CProcess RT_MANGLER(RTCrc32CProcess) 324 # define RTCrc32CStart RT_MANGLER(RTCrc32CStart) 321 325 # define RTCrc64 RT_MANGLER(RTCrc64) 322 326 # define RTCrc64Finish RT_MANGLER(RTCrc64Finish) -
trunk/src/VBox/Runtime/Makefile.kmk
r50458 r50526 264 264 common/checksum/adler32.cpp \ 265 265 common/checksum/crc32.cpp \ 266 common/checksum/crc32c.cpp \ 266 267 common/checksum/crc64.cpp \ 267 268 common/checksum/md5.cpp \ -
trunk/src/VBox/Storage/VHDX.cpp
r48861 r50526 1064 1064 u32ChkSumSaved = pHdr1->u32Checksum; 1065 1065 pHdr1->u32Checksum = 0; 1066 //u32ChkSum = RTCrc32C(pHdr1, RT_OFFSETOF(VhdxHeader, u8Reserved[502]));1066 u32ChkSum = RTCrc32C(pHdr1, sizeof(VhdxHeader)); 1067 1067 1068 1068 if ( pHdr1->u32Signature == VHDX_HEADER_SIGNATURE 1069 /*&& u32ChkSum == u32ChkSumSaved*/)1069 && u32ChkSum == u32ChkSumSaved) 1070 1070 fHdr1Valid = true; 1071 1071 } … … 1081 1081 u32ChkSumSaved = pHdr2->u32Checksum; 1082 1082 pHdr2->u32Checksum = 0; 1083 //u32ChkSum = RTCrc32C(pHdr2, RT_OFFSETOF(VhdxHeader, u8Reserved[502]));1083 u32ChkSum = RTCrc32C(pHdr2, sizeof(VhdxHeader)); 1084 1084 1085 1085 if ( pHdr2->u32Signature == VHDX_HEADER_SIGNATURE 1086 /*&& u32ChkSum == u32ChkSumSaved*/)1086 && u32ChkSum == u32ChkSumSaved) 1087 1087 fHdr2Valid = true; 1088 1088 } … … 1571 1571 1572 1572 /* Verify the region table integrity. */ 1573 //u32ChkSum = RTCrc32C(pbRegionTbl, VHDX_REGION_TBL_SIZE_MAX);1573 u32ChkSum = RTCrc32C(pbRegionTbl, VHDX_REGION_TBL_SIZE_MAX); 1574 1574 1575 1575 if (RegionTblHdr.u32Signature != VHDX_REGION_TBL_HDR_SIGNATURE) … … 1577 1577 "VHDX: Invalid signature for region table header of image \'%s\'", 1578 1578 pImage->pszFilename); 1579 #if 01580 1579 else if (u32ChkSum != RegionTblHdr.u32Checksum) 1581 1580 rc = vdIfError(pImage->pIfError, VERR_VD_GEN_INVALID_HEADER, RT_SRC_POS, 1582 1581 "VHDX: CRC32 checksum mismatch for the region table of image \'%s\' (expected %#x got %#x)", 1583 1582 pImage->pszFilename, RegionTblHdr.u32Checksum, u32ChkSum); 1584 #endif1585 1583 else if (RegionTblHdr.u32EntryCount > VHDX_REGION_TBL_HDR_ENTRY_COUNT_MAX) 1586 1584 rc = vdIfError(pImage->pIfError, VERR_VD_GEN_INVALID_HEADER, RT_SRC_POS,
Note:
See TracChangeset
for help on using the changeset viewer.

