3 * $Id: strongprime.h,v 1.2 2000/02/12 18:21:03 mdw Exp $
5 * Generate `strong' prime numbers
7 * (c) 1999 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of Catacomb.
14 * Catacomb is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
19 * Catacomb is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with Catacomb; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
30 /*----- Revision history --------------------------------------------------*
32 * $Log: strongprime.h,v $
33 * Revision 1.2 2000/02/12 18:21:03 mdw
34 * Overhaul of key management (again).
36 * Revision 1.1 1999/12/22 15:51:22 mdw
37 * Find `strong' RSA primes using Gordon's algorithm.
41 #ifndef CATACOMB_STRONGPRIME_H
42 #define CATACOMB_STRONGPRIME_H
48 /*----- Header files ------------------------------------------------------*/
50 #ifndef CATACOMB_GRAND_H
54 #ifndef CATACOMB_PGEN_H
58 /*----- Functions provided ------------------------------------------------*/
60 /* --- @strongprime_setup@ --- *
62 * Arguments: @const char *name@ = pointer to name root
63 * @mp *d@ = destination for search start point
64 * @pfilt *f@ = where to store filter jump context
65 * @unsigned nbits@ = number of bits wanted
66 * @grand *r@ = random number source
67 * @unsigned n@ = number of attempts to make
68 * @pgen_proc *event@ = event handler function
69 * @void *ectx@ = argument for the event handler
71 * Returns: A starting point for a `strong' prime search, or zero.
73 * Use: Sets up for a strong prime search, so that primes with
74 * particular properties can be found. It's probably important
75 * to note that the number left in the filter context @f@ is
76 * congruent to 2 (mod 4).
79 extern mp
*strongprime_setup(const char */
*name*/
, mp */
*d*/
, pfilt */
*f*/
,
80 unsigned /*nbits*/, grand */
*r*/
,
81 unsigned /*n*/, pgen_proc */
*event*/
,
84 /* --- @strongprime@ --- *
86 * Arguments: @const char *name@ = pointer to name root
87 * @mp *d@ = destination integer
88 * @unsigned nbits@ = number of bits wanted
89 * @grand *r@ = random number source
90 * @unsigned n@ = number of attempts to make
91 * @pgen_proc *event@ = event handler function
92 * @void *ectx@ = argument for the event handler
94 * Returns: A `strong' prime, or zero.
96 * Use: Finds `strong' primes. A strong prime %$p$% is such that
98 * * %$p - 1$% has a large prime factor %$r$%,
99 * * %$p + 1$% has a large prime factor %$s$%, and
100 * * %$r - 1$% has a large prime factor %$t$%.
102 * The numbers produced may be slightly larger than requested,
106 extern mp
*strongprime(const char */
*name*/
, mp */
*d*/
, unsigned /*nbits*/,
107 grand */
*r*/
, unsigned /*n*/,
108 pgen_proc */
*event*/
, void */
*ectx*/
);
110 /*----- That's all, folks -------------------------------------------------*/