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

Side by Side Diff: nss/lib/freebl/ec.c

Issue 1504923011: Update NSS to 3.21 RTM and NSPR to 4.11 RTM (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/nss
Patch Set: Created 5 years 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 9
10 #include "blapi.h" 10 #include "blapi.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 #if EC_DEBUG 536 #if EC_DEBUG
537 int i; 537 int i;
538 #endif 538 #endif
539 539
540 if (!publicValue || !ecParams || !privateValue || 540 if (!publicValue || !ecParams || !privateValue ||
541 !derivedSecret) { 541 !derivedSecret) {
542 PORT_SetError(SEC_ERROR_INVALID_ARGS); 542 PORT_SetError(SEC_ERROR_INVALID_ARGS);
543 return SECFailure; 543 return SECFailure;
544 } 544 }
545 545
546 /*
547 * We fail if the public value is the point at infinity, since
548 * this produces predictable results.
549 */
550 if (ec_point_at_infinity(publicValue)) {
Ryan Sleevi 2015/12/11 01:26:14 Of interest
davidben 2015/12/11 22:10:58 Pretty sure this was a no-op since then pointQ wou
551 PORT_SetError(SEC_ERROR_BAD_KEY);
552 return SECFailure;
553 }
554
546 MP_DIGITS(&k) = 0; 555 MP_DIGITS(&k) = 0;
547 memset(derivedSecret, 0, sizeof *derivedSecret); 556 memset(derivedSecret, 0, sizeof *derivedSecret);
548 len = (ecParams->fieldID.size + 7) >> 3; 557 len = (ecParams->fieldID.size + 7) >> 3;
549 pointQ.len = 2*len + 1; 558 pointQ.len = 2*len + 1;
550 if ((pointQ.data = PORT_Alloc(2*len + 1)) == NULL) goto cleanup; 559 if ((pointQ.data = PORT_Alloc(2*len + 1)) == NULL) goto cleanup;
551 560
552 CHECK_MPI_OK( mp_init(&k) ); 561 CHECK_MPI_OK( mp_init(&k) );
553 CHECK_MPI_OK( mp_read_unsigned_octets(&k, privateValue->data, 562 CHECK_MPI_OK( mp_read_unsigned_octets(&k, privateValue->data,
554 (mp_size) privateValue->len) ); 563 (mp_size) privateValue->len) );
555 564
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 printf("ECDSA verification %s\n", 1085 printf("ECDSA verification %s\n",
1077 (rv == SECSuccess) ? "succeeded" : "failed"); 1086 (rv == SECSuccess) ? "succeeded" : "failed");
1078 #endif 1087 #endif
1079 #else 1088 #else
1080 PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG); 1089 PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
1081 #endif /* NSS_DISABLE_ECC */ 1090 #endif /* NSS_DISABLE_ECC */
1082 1091
1083 return rv; 1092 return rv;
1084 } 1093 }
1085 1094
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698