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

Side by Side Diff: nss/lib/freebl/ecl/ecp_aff.c

Issue 1843333003: Update NSPR to 4.12 and NSS to 3.23 on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss.git@master
Patch Set: Created 4 years, 8 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
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 #include "ecp.h" 5 #include "ecp.h"
6 #include "mplogic.h" 6 #include "mplogic.h"
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 /* Checks if point P(px, py) is at infinity. Uses affine coordinates. */ 9 /* Checks if point P(px, py) is at infinity. Uses affine coordinates. */
10 mp_err 10 mp_err
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 if ((MP_SIGN(px) == MP_NEG) || (mp_cmp(px, &group->meth->irr) >= 0) || 273 if ((MP_SIGN(px) == MP_NEG) || (mp_cmp(px, &group->meth->irr) >= 0) ||
274 (MP_SIGN(py) == MP_NEG) || (mp_cmp(py, &group->meth->irr) >= 0)) { 274 (MP_SIGN(py) == MP_NEG) || (mp_cmp(py, &group->meth->irr) >= 0)) {
275 res = MP_NO; 275 res = MP_NO;
276 goto CLEANUP; 276 goto CLEANUP;
277 } 277 }
278 /* 3: Verify that publicValue is on the curve. */ 278 /* 3: Verify that publicValue is on the curve. */
279 if (group->meth->field_enc) { 279 if (group->meth->field_enc) {
280 group->meth->field_enc(px, &pxt, group->meth); 280 group->meth->field_enc(px, &pxt, group->meth);
281 group->meth->field_enc(py, &pyt, group->meth); 281 group->meth->field_enc(py, &pyt, group->meth);
282 } else { 282 } else {
283 » » mp_copy(px, &pxt); 283 » » MP_CHECKOK( mp_copy(px, &pxt) );
284 » » mp_copy(py, &pyt); 284 » » MP_CHECKOK( mp_copy(py, &pyt) );
285 } 285 }
286 /* left-hand side: y^2 */ 286 /* left-hand side: y^2 */
287 MP_CHECKOK( group->meth->field_sqr(&pyt, &accl, group->meth) ); 287 MP_CHECKOK( group->meth->field_sqr(&pyt, &accl, group->meth) );
288 /* right-hand side: x^3 + a*x + b = (x^2 + a)*x + b by Horner's rule */ 288 /* right-hand side: x^3 + a*x + b = (x^2 + a)*x + b by Horner's rule */
289 MP_CHECKOK( group->meth->field_sqr(&pxt, &tmp, group->meth) ); 289 MP_CHECKOK( group->meth->field_sqr(&pxt, &tmp, group->meth) );
290 MP_CHECKOK( group->meth->field_add(&tmp, &group->curvea, &tmp, group->me th) ); 290 MP_CHECKOK( group->meth->field_add(&tmp, &group->curvea, &tmp, group->me th) );
291 MP_CHECKOK( group->meth->field_mul(&tmp, &pxt, &accr, group->meth) ); 291 MP_CHECKOK( group->meth->field_mul(&tmp, &pxt, &accr, group->meth) );
292 MP_CHECKOK( group->meth->field_add(&accr, &group->curveb, &accr, group-> meth) ); 292 MP_CHECKOK( group->meth->field_add(&accr, &group->curveb, &accr, group-> meth) );
293 /* check LHS - RHS == 0 */ 293 /* check LHS - RHS == 0 */
294 MP_CHECKOK( group->meth->field_sub(&accl, &accr, &accr, group->meth) ); 294 MP_CHECKOK( group->meth->field_sub(&accl, &accr, &accr, group->meth) );
(...skipping 13 matching lines...) Expand all
308 res = MP_YES; 308 res = MP_YES;
309 309
310 CLEANUP: 310 CLEANUP:
311 mp_clear(&accl); 311 mp_clear(&accl);
312 mp_clear(&accr); 312 mp_clear(&accr);
313 mp_clear(&tmp); 313 mp_clear(&tmp);
314 mp_clear(&pxt); 314 mp_clear(&pxt);
315 mp_clear(&pyt); 315 mp_clear(&pyt);
316 return res; 316 return res;
317 } 317 }
OLDNEW
« no previous file with comments | « nss/lib/freebl/ecl/ecp_256_32.c ('k') | nss/lib/freebl/mpi/mpi.c » ('j') | nss/lib/util/secoid.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698