| 1 | /* -*-c-*- |
| 2 | * |
| 3 | * $Id: strongprime.h,v 1.1 1999/12/22 15:51:22 mdw Exp $ |
| 4 | * |
| 5 | * Generate `strong' prime numbers |
| 6 | * |
| 7 | * (c) 1999 Straylight/Edgeware |
| 8 | */ |
| 9 | |
| 10 | /*----- Licensing notice --------------------------------------------------* |
| 11 | * |
| 12 | * This file is part of Catacomb. |
| 13 | * |
| 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. |
| 18 | * |
| 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. |
| 23 | * |
| 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, |
| 27 | * MA 02111-1307, USA. |
| 28 | */ |
| 29 | |
| 30 | /*----- Revision history --------------------------------------------------* |
| 31 | * |
| 32 | * $Log: strongprime.h,v $ |
| 33 | * Revision 1.1 1999/12/22 15:51:22 mdw |
| 34 | * Find `strong' RSA primes using Gordon's algorithm. |
| 35 | * |
| 36 | */ |
| 37 | |
| 38 | #ifndef CATACOMB_STRONGPRIME_H |
| 39 | #define CATACOMB_STRONGPRIME_H |
| 40 | |
| 41 | #ifdef __cplusplus |
| 42 | extern "C" { |
| 43 | #endif |
| 44 | |
| 45 | /*----- Header files ------------------------------------------------------*/ |
| 46 | |
| 47 | #ifndef CATACOMB_GRAND_H |
| 48 | # include "grand.h" |
| 49 | #endif |
| 50 | |
| 51 | #ifndef CATACOMB_PGEN_H |
| 52 | # include "pgen.h" |
| 53 | #endif |
| 54 | |
| 55 | /*----- Functions provided ------------------------------------------------*/ |
| 56 | |
| 57 | /* --- @strongprime@ --- * |
| 58 | * |
| 59 | * Arguments: @const char *name@ = pointer to name root |
| 60 | * @mp *d@ = destination integer |
| 61 | * @unsigned nbits@ = number of bits wanted |
| 62 | * @grand *r@ = random number source |
| 63 | * @unsigned n@ = number of attempts to make |
| 64 | * @pgen_proc *event@ = event handler function |
| 65 | * @void *ectx@ = argument for the event handler |
| 66 | * |
| 67 | * Returns: A `strong' prime, or zero. |
| 68 | * |
| 69 | * Use: Finds `strong' primes. A strong prime %$p$% is such that |
| 70 | * |
| 71 | * * %$p - 1$% has a large prime factor %$r$%, |
| 72 | * * %$p + 1$% has a large prime factor %$s$%, and |
| 73 | * * %$r - 1$% has a large prime factor %$t$%. |
| 74 | * |
| 75 | * The numbers produced may be slightly larger than requested, |
| 76 | * by a few bits. |
| 77 | */ |
| 78 | |
| 79 | extern mp *strongprime(const char */*name*/, mp */*d*/, unsigned /*nbits*/, |
| 80 | grand */*r*/, unsigned /*n*/, |
| 81 | pgen_proc */*event*/, void */*ectx*/); |
| 82 | |
| 83 | /*----- That's all, folks -------------------------------------------------*/ |
| 84 | |
| 85 | #ifdef __cplusplus |
| 86 | } |
| 87 | #endif |
| 88 | |
| 89 | #endif |