Changeset 46980 in vbox for trunk/src/VBox/Runtime/common/checksum
- Timestamp:
- Jul 4, 2013 11:38:28 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86988
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/checksum/manifest.cpp
r46972 r46980 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Manifest file handling .3 * IPRT - Manifest file handling, old style - deprecated. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2009-201 2Oracle Corporation7 * Copyright (C) 2009-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 67 67 typedef RTMANIFESTCALLBACKDATA* PRTMANIFESTCALLBACKDATA; 68 68 69 69 70 /******************************************************************************* 70 71 * Private functions … … 96 97 pData->pvUser); 97 98 } 99 98 100 99 101 /******************************************************************************* … … 269 271 270 272 271 RTR3DECL(int) RTManifestVerifyDigestType(void *pvBuf, size_t cbSize, RTDIGESTTYPE &digestType)273 RTR3DECL(int) RTManifestVerifyDigestType(void *pvBuf, size_t cbSize, RTDIGESTTYPE *penmDigestType) 272 274 { 273 275 /* Validate input */ 274 276 AssertPtrReturn(pvBuf, VERR_INVALID_POINTER); 275 277 AssertReturn(cbSize > 0, VERR_INVALID_PARAMETER); 278 AssertPtrRetrn(penmDigestType, VERR_INVALID_POINTER) 276 279 277 280 int rc = VINF_SUCCESS; 278 281 279 char *pcBuf = (char*)pvBuf;282 char const *pcBuf = (char *)pvBuf; 280 283 size_t cbRead = 0; 281 284 /* Parse the manifest file line by line */ … … 283 286 { 284 287 if (cbRead >= cbSize) 285 { 286 digestType = RTDIGESTTYPE_UNKNOWN; 287 rc = VERR_MANIFEST_UNSUPPORTED_DIGEST_TYPE; 288 break; 289 } 288 return VERR_MANIFEST_UNSUPPORTED_DIGEST_TYPE; 290 289 291 290 size_t cch = rtManifestIndexOfCharInBuf(pcBuf, cbSize - cbRead, '\n') + 1; … … 303 302 } 304 303 304 /** @todo r=bird: Missing space check here. */ 305 305 /* Check for the digest algorithm */ 306 if ( pcBuf[0] == 'S'307 308 309 310 { 311 digestType = RTDIGESTTYPE_SHA1;312 break; 313 } 314 else if (pcBuf[0] == 'S'315 316 317 318 319 320 { 321 digestType = RTDIGESTTYPE_SHA256;306 if ( pcBuf[0] == 'S' 307 && pcBuf[1] == 'H' 308 && pcBuf[2] == 'A' 309 && pcBuf[3] == '1') 310 { 311 *penmDigestType = RTDIGESTTYPE_SHA1; 312 break; 313 } 314 if ( pcBuf[0] == 'S' 315 && pcBuf[1] == 'H' 316 && pcBuf[2] == 'A' 317 && pcBuf[3] == '2' 318 && pcBuf[4] == '5' 319 && pcBuf[5] == '6') 320 { 321 *penmDigestType = RTDIGESTTYPE_SHA256; 322 322 break; 323 323 } … … 329 329 return rc; 330 330 } 331 331 332 332 333 RTR3DECL(int) RTManifestVerifyFilesBuf(void *pvBuf, size_t cbSize, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed) … … 373 374 /** @todo r=bird: 374 375 * -# Better deal with this EOF line platform dependency 375 * -# The SHA1 testshould probably include a blank space check.376 * -# The SHA1 and SHA256 tests should probably include a blank space check. 376 377 * -# If there is a specific order to the elements in the string, it would be 377 378 * good if the delimiter searching checked for it. … … 380 381 381 382 /* Check for the digest algorithm */ 382 if ( cch < 4 ||383 (!( pcBuf[0] == 'S'384 && pcBuf[1] == 'H'385 && pcBuf[2] == 'A'386 && pcBuf[3] == '1')387 388 !( pcBuf[0] == 'S'389 && pcBuf[1] == 'H'390 && pcBuf[2] == 'A'391 && pcBuf[3] == '2'392 && pcBuf[4] == '5'393 && pcBuf[5] == '6'))383 if ( cch < 4 384 || ( !( pcBuf[0] == 'S' 385 && pcBuf[1] == 'H' 386 && pcBuf[2] == 'A' 387 && pcBuf[3] == '1') 388 && 389 !( pcBuf[0] == 'S' 390 && pcBuf[1] == 'H' 391 && pcBuf[2] == 'A' 392 && pcBuf[3] == '2' 393 && pcBuf[4] == '5' 394 && pcBuf[5] == '6') 394 395 ) 396 ) 395 397 { 396 398 /* Digest unsupported */ … … 455 457 for (size_t i = 0; i < cTests; ++i) 456 458 { 459 /** @todo r=bird: Using RTStrStr here looks bogus. */ 457 460 if (RTStrStr(paFiles[i].pTestPattern->pszTestFile, RTStrStrip(pszName)) != NULL) 458 461 { … … 578 581 } 579 582 583
Note:
See TracChangeset
for help on using the changeset viewer.