- Timestamp:
- Jul 3, 2014 10:56:18 PM (11 years ago)
- Location:
- trunk/src/VBox/Runtime/common/checksum
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/checksum/alt-md2.cpp
r51851 r51861 256 256 memcpy(pabDigest, pCtx->AltPrivate.abStateX, RTMD2_HASH_SIZE); 257 257 258 RT_ZERO(pCtx->AltPrivate); 258 259 pCtx->AltPrivate.cbBuffer = UINT8_MAX; 259 260 } -
trunk/src/VBox/Runtime/common/checksum/alt-sha1.cpp
r51851 r51861 53 53 /** The message length (in bytes). */ 54 54 uint64_t cbMessage; 55 /** @name The 5 hash values. 56 * @{ */ 57 uint32_t uH0; 58 uint32_t uH1; 59 uint32_t uH2; 60 uint32_t uH3; 61 uint32_t uH4; 62 /** @} */ 55 56 /** The 5 hash values. */ 57 uint32_t auH[5]; 63 58 } RTSHA1ALTPRIVATECTX; 64 59 … … 68 63 69 64 AssertCompile(RT_SIZEOFMEMB(RTSHA1CONTEXT, abPadding) >= RT_SIZEOFMEMB(RTSHA1CONTEXT, AltPrivate)); 70 AssertCompileMemberSize(RTSHA1ALTPRIVATECTX, uH0, sizeof(uint32_t)); AssertCompileAdjacentMembers(RTSHA1ALTPRIVATECTX, uH0, uH1); 71 AssertCompileMemberSize(RTSHA1ALTPRIVATECTX, uH1, sizeof(uint32_t)); AssertCompileAdjacentMembers(RTSHA1ALTPRIVATECTX, uH1, uH2); 72 AssertCompileMemberSize(RTSHA1ALTPRIVATECTX, uH2, sizeof(uint32_t)); AssertCompileAdjacentMembers(RTSHA1ALTPRIVATECTX, uH2, uH3); 73 AssertCompileMemberSize(RTSHA1ALTPRIVATECTX, uH3, sizeof(uint32_t)); AssertCompileAdjacentMembers(RTSHA1ALTPRIVATECTX, uH3, uH4); 74 AssertCompileMemberSize(RTSHA1ALTPRIVATECTX, uH4, sizeof(uint32_t)); AssertCompile(sizeof(uint32_t) * 5 == RTSHA1_HASH_SIZE); 65 AssertCompileMemberSize(RTSHA1ALTPRIVATECTX, auH, RTSHA1_HASH_SIZE); 75 66 76 67 … … 80 71 { 81 72 pCtx->AltPrivate.cbMessage = 0; 82 pCtx->AltPrivate. uH0= UINT32_C(0x67452301);83 pCtx->AltPrivate. uH1= UINT32_C(0xefcdab89);84 pCtx->AltPrivate. uH2= UINT32_C(0x98badcfe);85 pCtx->AltPrivate. uH3= UINT32_C(0x10325476);86 pCtx->AltPrivate. uH4= UINT32_C(0xc3d2e1f0);73 pCtx->AltPrivate.auH[0] = UINT32_C(0x67452301); 74 pCtx->AltPrivate.auH[1] = UINT32_C(0xefcdab89); 75 pCtx->AltPrivate.auH[2] = UINT32_C(0x98badcfe); 76 pCtx->AltPrivate.auH[3] = UINT32_C(0x10325476); 77 pCtx->AltPrivate.auH[4] = UINT32_C(0xc3d2e1f0); 87 78 } 88 79 RT_EXPORT_SYMBOL(RTSha1Init); … … 146 137 static void rtSha1BlockProcess(PRTSHA1CONTEXT pCtx) 147 138 { 148 uint32_t uA = pCtx->AltPrivate. uH0;149 uint32_t uB = pCtx->AltPrivate. uH1;150 uint32_t uC = pCtx->AltPrivate. uH2;151 uint32_t uD = pCtx->AltPrivate. uH3;152 uint32_t uE = pCtx->AltPrivate. uH4;139 uint32_t uA = pCtx->AltPrivate.auH[0]; 140 uint32_t uB = pCtx->AltPrivate.auH[1]; 141 uint32_t uC = pCtx->AltPrivate.auH[2]; 142 uint32_t uD = pCtx->AltPrivate.auH[3]; 143 uint32_t uE = pCtx->AltPrivate.auH[4]; 153 144 154 145 #if 1 … … 208 199 #endif 209 200 210 pCtx->AltPrivate. uH0+= uA;211 pCtx->AltPrivate. uH1+= uB;212 pCtx->AltPrivate. uH2+= uC;213 pCtx->AltPrivate. uH3+= uD;214 pCtx->AltPrivate. uH4+= uE;201 pCtx->AltPrivate.auH[0] += uA; 202 pCtx->AltPrivate.auH[1] += uB; 203 pCtx->AltPrivate.auH[2] += uC; 204 pCtx->AltPrivate.auH[3] += uD; 205 pCtx->AltPrivate.auH[4] += uE; 215 206 } 216 207 … … 324 315 * Convert the byte order of the hash words and we're done. 325 316 */ 326 pCtx->AltPrivate.uH0 = RT_H2BE_U32(pCtx->AltPrivate.uH0); 327 pCtx->AltPrivate.uH1 = RT_H2BE_U32(pCtx->AltPrivate.uH1); 328 pCtx->AltPrivate.uH2 = RT_H2BE_U32(pCtx->AltPrivate.uH2); 329 pCtx->AltPrivate.uH3 = RT_H2BE_U32(pCtx->AltPrivate.uH3); 330 pCtx->AltPrivate.uH4 = RT_H2BE_U32(pCtx->AltPrivate.uH4); 331 332 memcpy(pabDigest, &pCtx->AltPrivate.uH0, RTSHA1_HASH_SIZE); 333 317 pCtx->AltPrivate.auH[0] = RT_H2BE_U32(pCtx->AltPrivate.auH[0]); 318 pCtx->AltPrivate.auH[1] = RT_H2BE_U32(pCtx->AltPrivate.auH[1]); 319 pCtx->AltPrivate.auH[2] = RT_H2BE_U32(pCtx->AltPrivate.auH[2]); 320 pCtx->AltPrivate.auH[3] = RT_H2BE_U32(pCtx->AltPrivate.auH[3]); 321 pCtx->AltPrivate.auH[4] = RT_H2BE_U32(pCtx->AltPrivate.auH[4]); 322 323 memcpy(pabDigest, &pCtx->AltPrivate.auH[0], RTSHA1_HASH_SIZE); 324 325 RT_ZERO(pCtx->AltPrivate); 334 326 pCtx->AltPrivate.cbMessage = UINT64_MAX; 335 327 } -
trunk/src/VBox/Runtime/common/checksum/alt-sha256.cpp
r51851 r51861 394 394 pCtx->AltPrivate.auH[7] = RT_H2BE_U32(pCtx->AltPrivate.auH[7]); 395 395 396 RT_ZERO(pCtx->AltPrivate.auW); 396 397 pCtx->AltPrivate.cbMessage = UINT64_MAX; 397 398 } … … 403 404 rtSha256FinalInternal(pCtx); 404 405 memcpy(pabDigest, &pCtx->AltPrivate.auH[0], RTSHA256_HASH_SIZE); 406 RT_ZERO(pCtx->AltPrivate.auH); 405 407 } 406 408 RT_EXPORT_SYMBOL(RTSha256Final); … … 448 450 rtSha256FinalInternal(pCtx); 449 451 memcpy(pabDigest, &pCtx->AltPrivate.auH[0], RTSHA224_HASH_SIZE); 452 RT_ZERO(pCtx->AltPrivate.auH); 450 453 } 451 454 RT_EXPORT_SYMBOL(RTSha224Final); -
trunk/src/VBox/Runtime/common/checksum/alt-sha512.cpp
r51851 r51861 412 412 pCtx->AltPrivate.auH[7] = RT_H2BE_U64(pCtx->AltPrivate.auH[7]); 413 413 414 RT_ZERO(pCtx->AltPrivate.auW); 414 415 pCtx->AltPrivate.cbMessage.s.Lo = UINT64_MAX; 415 416 pCtx->AltPrivate.cbMessage.s.Hi = UINT64_MAX; … … 422 423 rtSha512FinalInternal(pCtx); 423 424 memcpy(pabDigest, &pCtx->AltPrivate.auH[0], RTSHA512_HASH_SIZE); 425 RT_ZERO(pCtx->AltPrivate.auH); 424 426 } 425 427 RT_EXPORT_SYMBOL(RTSha512Final); … … 468 470 rtSha512FinalInternal(pCtx); 469 471 memcpy(pabDigest, &pCtx->AltPrivate.auH[0], RTSHA384_HASH_SIZE); 472 RT_ZERO(pCtx->AltPrivate.auH); 470 473 } 471 474 RT_EXPORT_SYMBOL(RTSha384Final); … … 513 516 rtSha512FinalInternal(pCtx); 514 517 memcpy(pabDigest, &pCtx->AltPrivate.auH[0], RTSHA512T224_HASH_SIZE); 518 RT_ZERO(pCtx->AltPrivate.auH); 515 519 } 516 520 RT_EXPORT_SYMBOL(RTSha512t224Final); … … 558 562 rtSha512FinalInternal(pCtx); 559 563 memcpy(pabDigest, &pCtx->AltPrivate.auH[0], RTSHA512T256_HASH_SIZE); 564 RT_ZERO(pCtx->AltPrivate.auH); 560 565 } 561 566 RT_EXPORT_SYMBOL(RTSha512t256Final);
Note:
See TracChangeset
for help on using the changeset viewer.