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

Side by Side Diff: nss/lib/freebl/mpi/mpprime.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 /* 1 /*
2 * mpprime.c 2 * mpprime.c
3 * 3 *
4 * Utilities for finding and working with prime and pseudo-prime 4 * Utilities for finding and working with prime and pseudo-prime
5 * integers 5 * integers
6 * 6 *
7 * This Source Code Form is subject to the terms of the Mozilla Public 7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this 8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 9 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
10 10
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 290
291 MP_CHECKOK( mp_init_size(&x, MP_USED(a)) ); 291 MP_CHECKOK( mp_init_size(&x, MP_USED(a)) );
292 MP_CHECKOK( mp_init(&z) ); 292 MP_CHECKOK( mp_init(&z) );
293 MP_CHECKOK( mp_init(&m) ); 293 MP_CHECKOK( mp_init(&m) );
294 MP_CHECKOK( mp_div_2d(&amo, b, &m, 0) ); 294 MP_CHECKOK( mp_div_2d(&amo, b, &m, 0) );
295 295
296 /* Do the test nt times... */ 296 /* Do the test nt times... */
297 for(iter = 0; iter < nt; iter++) { 297 for(iter = 0; iter < nt; iter++) {
298 298
299 /* Choose a random value for 1 < x < a */ 299 /* Choose a random value for 1 < x < a */
300 s_mp_pad(&x, USED(a)); 300 MP_CHECKOK( s_mp_pad(&x, USED(a)) );
301 mpp_random(&x); 301 mpp_random(&x);
302 MP_CHECKOK( mp_mod(&x, a, &x) ); 302 MP_CHECKOK( mp_mod(&x, a, &x) );
303 if(mp_cmp_d(&x, 1) <= 0) { 303 if(mp_cmp_d(&x, 1) <= 0) {
304 iter--; /* don't count this iteration */ 304 iter--; /* don't count this iteration */
305 continue; /* choose a new x */ 305 continue; /* choose a new x */
306 } 306 }
307 307
308 /* Compute z = (x ** m) mod a */ 308 /* Compute z = (x ** m) mod a */
309 MP_CHECKOK( mp_exptmod(&x, &m, a, &z) ); 309 MP_CHECKOK( mp_exptmod(&x, &m, a, &z) );
310 310
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 } 575 }
576 576
577 return MP_NO; 577 return MP_NO;
578 578
579 } /* end s_mpp_divp() */ 579 } /* end s_mpp_divp() */
580 580
581 /* }}} */ 581 /* }}} */
582 582
583 /*------------------------------------------------------------------------*/ 583 /*------------------------------------------------------------------------*/
584 /* HERE THERE BE DRAGONS */ 584 /* HERE THERE BE DRAGONS */
OLDNEW
« no previous file with comments | « nss/lib/freebl/mpi/mpmontg.c ('k') | nss/lib/freebl/poly1305.h » ('j') | nss/lib/util/secoid.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698