~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/freebl/mpi/mpprime.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  mpprime.h
 
3
 *
 
4
 *  Utilities for finding and working with prime and pseudo-prime
 
5
 *  integers
 
6
 *
 
7
 * The contents of this file are subject to the Mozilla Public
 
8
 * License Version 1.1 (the "License"); you may not use this file
 
9
 * except in compliance with the License. You may obtain a copy of
 
10
 * the License at http://www.mozilla.org/MPL/
 
11
 *
 
12
 * Software distributed under the License is distributed on an "AS
 
13
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
14
 * implied. See the License for the specific language governing
 
15
 * rights and limitations under the License.
 
16
 *
 
17
 * The Original Code is the MPI Arbitrary Precision Integer Arithmetic
 
18
 * library.
 
19
 *
 
20
 * The Initial Developer of the Original Code is Michael J. Fromberger.
 
21
 * Portions created by Michael J. Fromberger are 
 
22
 * Copyright (C) 1997, 1998, 1999, 2000 Michael J. Fromberger. 
 
23
 * All Rights Reserved.
 
24
 *
 
25
 * Contributor(s):
 
26
 *
 
27
 * Alternatively, the contents of this file may be used under the
 
28
 * terms of the GNU General Public License Version 2 or later (the
 
29
 * "GPL"), in which case the provisions of the GPL are applicable
 
30
 * instead of those above.  If you wish to allow use of your
 
31
 * version of this file only under the terms of the GPL and not to
 
32
 * allow others to use your version of this file under the MPL,
 
33
 * indicate your decision by deleting the provisions above and
 
34
 * replace them with the notice and other provisions required by
 
35
 * the GPL.  If you do not delete the provisions above, a recipient
 
36
 * may use your version of this file under either the MPL or the
 
37
 * GPL.
 
38
 */
 
39
 
 
40
#ifndef _H_MP_PRIME_
 
41
#define _H_MP_PRIME_
 
42
 
 
43
#include "mpi.h"
 
44
 
 
45
extern const int prime_tab_size;   /* number of primes available */
 
46
extern const mp_digit prime_tab[];
 
47
 
 
48
/* Tests for divisibility    */
 
49
mp_err  mpp_divis(mp_int *a, mp_int *b);
 
50
mp_err  mpp_divis_d(mp_int *a, mp_digit d);
 
51
 
 
52
/* Random selection          */
 
53
mp_err  mpp_random(mp_int *a);
 
54
mp_err  mpp_random_size(mp_int *a, mp_size prec);
 
55
 
 
56
/* Pseudo-primality testing  */
 
57
mp_err  mpp_divis_vector(mp_int *a, const mp_digit *vec, int size, int *which);
 
58
mp_err  mpp_divis_primes(mp_int *a, mp_digit *np);
 
59
mp_err  mpp_fermat(mp_int *a, mp_digit w);
 
60
mp_err mpp_fermat_list(mp_int *a, const mp_digit *primes, mp_size nPrimes);
 
61
mp_err  mpp_pprime(mp_int *a, int nt);
 
62
mp_err mpp_sieve(mp_int *trial, const mp_digit *primes, mp_size nPrimes, 
 
63
                 unsigned char *sieve, mp_size nSieve);
 
64
mp_err mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong,
 
65
                      unsigned long * nTries);
 
66
 
 
67
#endif /* end _H_MP_PRIME_ */