3 * $Id: dh.h,v 1.3 2000/02/12 18:21:02 mdw Exp $
5 * Diffie-Hellman and related public-key systems
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 --------------------------------------------------*
33 * Revision 1.3 2000/02/12 18:21:02 mdw
34 * Overhaul of key management (again).
45 /*----- Header files ------------------------------------------------------*/
47 #ifndef CATACOMB_GRAND_H
51 #ifndef CATACOMB_PGEN_H
55 /*----- Data structures ---------------------------------------------------*/
57 typedef struct dh_param
{
62 /*----- Functions provided ------------------------------------------------*/
66 * Arguments: @dh_param *dp@ = pointer to output parameter block
67 * @unsigned ql@ = length of %$q$% in bits, or zero
68 * @unsigned pl@ = length of %$p$% in bits
69 * @unsigned steps@ = number of steps to go
70 * @grand *r@ = random number source
71 * @pgen_proc *event@ = event handler function
72 * @void *ectx@ = argument for the event handler
74 * Returns: @PGEN_DONE@ if it worked, @PGEN_ABORT@ if it didn't.
76 * Use: Generates Diffie-Hellman parameters.
78 * The parameters are a prime %$q$%, relatively small, and a
79 * large prime %$p = kq + 1$% for some %$k$%, together with a
80 * generator %$g$% of the cyclic subgroup of order %$q$%. These
81 * are actually the same as the DSA parameter set, but the
82 * generation algorithm is different. Also, if @ql@ is zero,
83 * this algorithm forces %$k = 2$%, and chooses %$g = 4$%. Make
84 * sure you have something interesting to do if you choose this
88 extern int dh_gen(dh_param */
*dp*/
, unsigned /*ql*/, unsigned /*pl*/,
89 unsigned /*steps*/, grand */
*r*/
, pgen_proc */
*event*/
,
92 /*----- That's all, folks -------------------------------------------------*/