Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(723)

Side by Side Diff: mozilla/security/nss/lib/freebl/md5.c

Issue 12207073: Update to NSS 3.14.3 Beta 1 for the TLS CBC constant-time (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* This Source Code Form is subject to the terms of the Mozilla Public 1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 4
5 #ifdef FREEBL_NO_DEPEND 5 #ifdef FREEBL_NO_DEPEND
6 #include "stubs.h" 6 #include "stubs.h"
7 #endif 7 #endif
8 8
9 #include "prerr.h" 9 #include "prerr.h"
10 #include "secerr.h" 10 #include "secerr.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 cx->u.w[14] = lendian(lowInput); 516 cx->u.w[14] = lendian(lowInput);
517 cx->u.w[15] = lendian(highInput); 517 cx->u.w[15] = lendian(highInput);
518 518
519 /* Final call to compress. */ 519 /* Final call to compress. */
520 #ifndef IS_LITTLE_ENDIAN 520 #ifndef IS_LITTLE_ENDIAN
521 md5_prep_state_le(cx); 521 md5_prep_state_le(cx);
522 #endif 522 #endif
523 md5_compress(cx, cx->u.w); 523 md5_compress(cx, cx->u.w);
524 524
525 /* Copy the resulting values out of the chain variables into return buf. */ 525 /* Copy the resulting values out of the chain variables into return buf. */
526 » *digestLen = MD5_HASH_LEN; 526 » if (digestLen)
527 » » *digestLen = MD5_HASH_LEN;
527 #ifndef IS_LITTLE_ENDIAN 528 #ifndef IS_LITTLE_ENDIAN
528 cx->cv[0] = lendian(cx->cv[0]); 529 cx->cv[0] = lendian(cx->cv[0]);
529 cx->cv[1] = lendian(cx->cv[1]); 530 cx->cv[1] = lendian(cx->cv[1]);
530 cx->cv[2] = lendian(cx->cv[2]); 531 cx->cv[2] = lendian(cx->cv[2]);
531 cx->cv[3] = lendian(cx->cv[3]); 532 cx->cv[3] = lendian(cx->cv[3]);
532 #endif 533 #endif
533 memcpy(digest, cx->cv, MD5_HASH_LEN); 534 memcpy(digest, cx->cv, MD5_HASH_LEN);
534 } 535 }
535 536
537 void
538 MD5_EndRaw(MD5Context *cx, unsigned char *digest,
539 unsigned int *digestLen, unsigned int maxDigestLen)
540 {
541 #ifndef IS_LITTLE_ENDIAN
542 PRUint32 tmp;
543 #endif
544 PRUint32 cv[4];
545
546 if (maxDigestLen < MD5_HASH_LEN) {
547 PORT_SetError(SEC_ERROR_INVALID_ARGS);
548 return;
549 }
550
551 memcpy(cv, cx->cv, sizeof(cv));
wtc 2013/02/08 02:17:52 Why do the <Hash>_EndRaw functions need to copy th
agl 2013/02/08 02:26:03 (Late - brain may not be working.) The EndRaw fun
552 #ifndef IS_LITTLE_ENDIAN
553 cv[0] = lendian(cv[0]);
554 cv[1] = lendian(cv[1]);
555 cv[2] = lendian(cv[2]);
556 cv[3] = lendian(cv[3]);
557 #endif
558 memcpy(digest, cv, MD5_HASH_LEN);
559 if (digestLen)
560 *digestLen = MD5_HASH_LEN;
561 }
562
536 unsigned int 563 unsigned int
537 MD5_FlattenSize(MD5Context *cx) 564 MD5_FlattenSize(MD5Context *cx)
538 { 565 {
539 return sizeof(*cx); 566 return sizeof(*cx);
540 } 567 }
541 568
542 SECStatus 569 SECStatus
543 MD5_Flatten(MD5Context *cx, unsigned char *space) 570 MD5_Flatten(MD5Context *cx, unsigned char *space)
544 { 571 {
545 memcpy(space, cx, sizeof(*cx)); 572 memcpy(space, cx, sizeof(*cx));
(...skipping 12 matching lines...) Expand all
558 void MD5_Clone(MD5Context *dest, MD5Context *src) 585 void MD5_Clone(MD5Context *dest, MD5Context *src)
559 { 586 {
560 memcpy(dest, src, sizeof *dest); 587 memcpy(dest, src, sizeof *dest);
561 } 588 }
562 589
563 void 590 void
564 MD5_TraceState(MD5Context *cx) 591 MD5_TraceState(MD5Context *cx)
565 { 592 {
566 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); 593 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
567 } 594 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698