OLD | NEW |
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 return MP_OKAY; | 387 return MP_OKAY; |
388 } | 388 } |
389 | 389 |
390 #define SIEVE_SIZE 32*1024 | 390 #define SIEVE_SIZE 32*1024 |
391 | 391 |
392 mp_err mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong, | 392 mp_err mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong, |
393 unsigned long * nTries) | 393 unsigned long * nTries) |
394 { | 394 { |
395 mp_digit np; | 395 mp_digit np; |
396 mp_err res; | 396 mp_err res; |
397 int i» = 0; | 397 unsigned int i = 0; |
398 mp_int trial; | 398 mp_int trial; |
399 mp_int q; | 399 mp_int q; |
400 mp_size num_tests; | 400 mp_size num_tests; |
401 unsigned char *sieve; | 401 unsigned char *sieve; |
402 | 402 |
403 ARGCHK(start != 0, MP_BADARG); | 403 ARGCHK(start != 0, MP_BADARG); |
404 ARGCHK(nBits > 16, MP_RANGE); | 404 ARGCHK(nBits > 16, MP_RANGE); |
405 | 405 |
406 sieve = malloc(SIEVE_SIZE); | 406 sieve = malloc(SIEVE_SIZE); |
407 ARGCHK(sieve != NULL, MP_MEM); | 407 ARGCHK(sieve != NULL, MP_MEM); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 */ |
OLD | NEW |