4272N/A/*
4272N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
4272N/A * Use is subject to license terms.
1674N/A *
4272N/A * This library is free software; you can redistribute it and/or
4272N/A * modify it under the terms of the GNU Lesser General Public
4272N/A * License as published by the Free Software Foundation; either
4272N/A * version 2.1 of the License, or (at your option) any later version.
1674N/A *
4272N/A * This library is distributed in the hope that it will be useful,
4272N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
4272N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4272N/A * Lesser General Public License for more details.
1674N/A *
4272N/A * You should have received a copy of the GNU Lesser General Public License
4272N/A * along with this library; if not, write to the Free Software Foundation,
4272N/A * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1674N/A *
4272N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4272N/A * or visit www.oracle.com if you need additional information or have any
4272N/A * questions.
4272N/A */
4272N/A
4272N/A/* *********************************************************************
1674N/A *
1674N/A * The Original Code is the MPI Arbitrary Precision Integer Arithmetic library.
1674N/A *
1674N/A * The Initial Developer of the Original Code is
1674N/A * Michael J. Fromberger.
1674N/A * Portions created by the Initial Developer are Copyright (C) 1997
1674N/A * the Initial Developer. All Rights Reserved.
1674N/A *
1674N/A * Contributor(s):
1674N/A *
1674N/A *********************************************************************** */
4272N/A
4272N/A/* Utilities for finding and working with prime and pseudo-prime integers */
1674N/A
1674N/A#ifndef _MP_PRIME_H
1674N/A#define _MP_PRIME_H
1674N/A
1674N/A#include "mpi.h"
1674N/A
1674N/Aextern const int prime_tab_size; /* number of primes available */
1674N/Aextern const mp_digit prime_tab[];
1674N/A
1674N/A/* Tests for divisibility */
1674N/Amp_err mpp_divis(mp_int *a, mp_int *b);
1674N/Amp_err mpp_divis_d(mp_int *a, mp_digit d);
1674N/A
1674N/A/* Random selection */
1674N/Amp_err mpp_random(mp_int *a);
1674N/Amp_err mpp_random_size(mp_int *a, mp_size prec);
1674N/A
1674N/A/* Pseudo-primality testing */
1674N/Amp_err mpp_divis_vector(mp_int *a, const mp_digit *vec, int size, int *which);
1674N/Amp_err mpp_divis_primes(mp_int *a, mp_digit *np);
1674N/Amp_err mpp_fermat(mp_int *a, mp_digit w);
1674N/Amp_err mpp_fermat_list(mp_int *a, const mp_digit *primes, mp_size nPrimes);
1674N/Amp_err mpp_pprime(mp_int *a, int nt);
1674N/Amp_err mpp_sieve(mp_int *trial, const mp_digit *primes, mp_size nPrimes,
1674N/A unsigned char *sieve, mp_size nSieve);
1674N/Amp_err mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong,
1674N/A unsigned long * nTries);
1674N/A
1674N/A#endif /* _MP_PRIME_H */