44c240ee |
1 | /* -*-c-*- |
2 | * |
b3f05084 |
3 | * $Id: dh.h,v 1.2 1999/12/10 23:29:48 mdw Exp $ |
44c240ee |
4 | * |
5 | * [Diffie-Hellman key negotiation * |
6 | * (c) 1999 Straylight/Edgeware |
7 | */ |
8 | |
9 | /*----- Licensing notice --------------------------------------------------* |
10 | * |
11 | * This file is part of Catacomb. |
12 | * |
13 | * Catacomb is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU Library General Public License as |
15 | * published by the Free Software Foundation; either version 2 of the |
16 | * License, or (at your option) any later version. |
17 | * |
18 | * Catacomb is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | * GNU Library General Public License for more details. |
22 | * |
23 | * You should have received a copy of the GNU Library General Public |
24 | * License along with Catacomb; if not, write to the Free |
25 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
26 | * MA 02111-1307, USA. |
27 | */ |
28 | |
29 | /*----- Revision history --------------------------------------------------* |
30 | * |
31 | * $Log: dh.h,v $ |
b3f05084 |
32 | * Revision 1.2 1999/12/10 23:29:48 mdw |
33 | * Change header file guard names. |
34 | * |
44c240ee |
35 | * Revision 1.1 1999/11/20 22:24:44 mdw |
36 | * Add Diffie-Hellman support. |
37 | * |
38 | */ |
39 | |
b3f05084 |
40 | #ifndef CATACOMB_DH_H |
41 | #define CATACOMB_DH_H |
44c240ee |
42 | |
43 | #ifdef __cplusplus |
44 | extern "C" { |
45 | #endif |
46 | |
47 | /*----- Header files ------------------------------------------------------*/ |
48 | |
b3f05084 |
49 | #ifndef CATACOMB_MP_H |
44c240ee |
50 | # include "mp.h" |
51 | #endif |
52 | |
53 | /*----- Event codes -------------------------------------------------------*/ |
54 | |
55 | enum { |
56 | DHEV_OK, |
57 | |
58 | DHEV_FAIL, |
59 | DHEV_PASS |
60 | }; |
61 | |
62 | /*----- Functions provided ------------------------------------------------*/ |
63 | |
64 | /* --- @dh_prime@ --- * |
65 | * |
66 | * Arguments: @mp *s@ = start point for search (must be odd) |
67 | * @size_t n@ = number of concerted attempts to make, or zero |
68 | * @void (*proc)(int ev, void *p)@ = event handler |
69 | * @void *p@ = argument for event handler |
70 | * |
71 | * Returns: A prime number %$p$% where %$p = 2q + 1$% for prime %$q$%. |
72 | * |
73 | * Use: Finds a safe prime by sequential search from a given starting |
74 | * point. If it fails, a null pointer is returned. |
75 | * |
76 | * The event handler is informed of the progress of the search. |
77 | * It may abort the search at any time by returning a nonzero |
78 | * value. |
79 | */ |
80 | |
81 | extern mp *dh_prime(mp */*s*/, size_t /*n*/, |
82 | int (*proc)(int /*ev*/, void */*p*/), void */*p*/); |
83 | |
84 | /*----- That's all, folks -------------------------------------------------*/ |
85 | |
86 | #ifdef __cplusplus |
87 | } |
88 | #endif |
89 | |
90 | #endif |