1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/freebl/mpi/mpprime.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +/* 1.5 + * mpprime.h 1.6 + * 1.7 + * Utilities for finding and working with prime and pseudo-prime 1.8 + * integers 1.9 + * 1.10 + * This Source Code Form is subject to the terms of the Mozilla Public 1.11 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.12 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.13 + 1.14 +#ifndef _H_MP_PRIME_ 1.15 +#define _H_MP_PRIME_ 1.16 + 1.17 +#include "mpi.h" 1.18 + 1.19 +extern const int prime_tab_size; /* number of primes available */ 1.20 +extern const mp_digit prime_tab[]; 1.21 + 1.22 +/* Tests for divisibility */ 1.23 +mp_err mpp_divis(mp_int *a, mp_int *b); 1.24 +mp_err mpp_divis_d(mp_int *a, mp_digit d); 1.25 + 1.26 +/* Random selection */ 1.27 +mp_err mpp_random(mp_int *a); 1.28 +mp_err mpp_random_size(mp_int *a, mp_size prec); 1.29 + 1.30 +/* Pseudo-primality testing */ 1.31 +mp_err mpp_divis_vector(mp_int *a, const mp_digit *vec, int size, int *which); 1.32 +mp_err mpp_divis_primes(mp_int *a, mp_digit *np); 1.33 +mp_err mpp_fermat(mp_int *a, mp_digit w); 1.34 +mp_err mpp_fermat_list(mp_int *a, const mp_digit *primes, mp_size nPrimes); 1.35 +mp_err mpp_pprime(mp_int *a, int nt); 1.36 +mp_err mpp_sieve(mp_int *trial, const mp_digit *primes, mp_size nPrimes, 1.37 + unsigned char *sieve, mp_size nSieve); 1.38 +mp_err mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong, 1.39 + unsigned long * nTries); 1.40 + 1.41 +#endif /* end _H_MP_PRIME_ */