BeeCrypt  4.2.1
dldp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2000, 2001, 2002 X-Way Rights BV
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 
26 #ifndef _DLDP_H
27 #define _DLDP_H
28 
29 #include "beecrypt/mpbarrett.h"
30 
31 /*
32  * Discrete Logarithm Domain Parameters - Prime
33  *
34  * Standard definition where p = qr+1; in case where p=2q+1, r=2
35  *
36  * In IEEE P1363 naming is p = rk+1
37  *
38  * Hence, IEEE prime r = q and cofactor k = r
39  *
40  * Make sure q is large enough to foil Pohlig-Hellman attacks
41  * See: "Handbook of Applied Cryptography", Chapter 3.6.4
42  *
43  * g is either a generator of a subgroup of order q, or a generator of order
44  * n = (p-1)
45  */
46 
53 #ifdef __cplusplus
55 #else
56 struct _dldp_p
57 #endif
58 {
87 #ifdef __cplusplus
88  dldp_p();
89  dldp_p(const dldp_p&);
90  ~dldp_p();
91 #endif
92 };
93 
94 #ifndef __cplusplus
95 typedef struct _dldp_p dldp_p;
96 #endif
97 
98 #ifdef __cplusplus
99 extern "C" {
100 #endif
101 
102 /*
103  * Functions for setting up and copying
104  */
105 
107 int dldp_pInit(dldp_p*);
109 int dldp_pFree(dldp_p*);
111 int dldp_pCopy(dldp_p*, const dldp_p*);
112 
113 /*
114  * Functions for generating keys
115  */
116 
120 int dldp_pPrivate_s(const dldp_p*, randomGeneratorContext*, mpnumber*, size_t);
122 int dldp_pPublic (const dldp_p*, const mpnumber*, mpnumber*);
126 int dldp_pPair_s (const dldp_p*, randomGeneratorContext*, mpnumber* x, mpnumber* y, size_t);
127 
128 /*
129  * Function for comparing domain parameters
130  */
131 
133 int dldp_pEqual (const dldp_p*, const dldp_p*);
134 
135 /*
136  * Functions for generating and validating dldp_pgoq variant domain parameters
137  */
138 
140 int dldp_pgoqMake (dldp_p*, randomGeneratorContext*, size_t, size_t, int);
147 
148 /*
149  * Functions for generating and validating dldp_pgon variant domain parameters
150  */
151 
153 int dldp_pgonMake (dldp_p*, randomGeneratorContext*, size_t, size_t);
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif
Discrete Logarithm Domain Parameters over a prime field.
Definition: dldp.h:54
int dldp_pPrivate_s(const dldp_p *, randomGeneratorContext *, mpnumber *, size_t)
int dldp_pgoqMake(dldp_p *, randomGeneratorContext *, size_t, size_t, int)
Definition: beecrypt.h:235
int dldp_pgonGenerator(dldp_p *, randomGeneratorContext *)
int dldp_pgoqGenerator(dldp_p *, randomGeneratorContext *)
int dldp_pPair(const dldp_p *, randomGeneratorContext *, mpnumber *x, mpnumber *y)
int dldp_pInit(dldp_p *)
Multi-precision integer routines using Barrett modular reduction, headers.
int dldp_pgonMake(dldp_p *, randomGeneratorContext *, size_t, size_t)
mpnumber r
Definition: dldp.h:74
int dldp_pPrivate(const dldp_p *, randomGeneratorContext *, mpnumber *)
int dldp_pgoqMakeSafe(dldp_p *, randomGeneratorContext *, size_t)
int dldp_pPublic(const dldp_p *, const mpnumber *, mpnumber *)
int dldp_pgoqValidate(const dldp_p *, randomGeneratorContext *, int)
int dldp_pCopy(dldp_p *, const dldp_p *)
int dldp_pgonValidate(const dldp_p *, randomGeneratorContext *)
mpbarrett q
The cofactor.
Definition: dldp.h:69
#define BEECRYPTAPI
Definition: api.h:52
Definition: mpnumber.h:36
int dldp_pEqual(const dldp_p *, const dldp_p *)
int dldp_pPair_s(const dldp_p *, randomGeneratorContext *, mpnumber *x, mpnumber *y, size_t)
int dldp_pgonMakeSafe(dldp_p *, randomGeneratorContext *, size_t)
mpnumber g
The generator.
Definition: dldp.h:81
mpbarrett p
The prime.
Definition: dldp.h:63
int dldp_pFree(dldp_p *)
Definition: mpbarrett.h:37
mpbarrett n
Definition: dldp.h:86