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&);
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 
111 int dldp_pCopy(dldp_p*, const dldp_p*);
112 
113 /*
114  * Functions for generating keys
115  */
116 
122 int dldp_pPublic (const dldp_p*, const mpnumber*, mpnumber*);
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
dldp_pgoqMakeSafe
int dldp_pgoqMakeSafe(dldp_p *, randomGeneratorContext *, size_t)
dldp_pgoqValidate
int dldp_pgoqValidate(const dldp_p *, randomGeneratorContext *, int)
dldp_pPair_s
int dldp_pPair_s(const dldp_p *, randomGeneratorContext *, mpnumber *x, mpnumber *y, size_t)
dldp_p::g
mpnumber g
The generator.
Definition: dldp.h:81
dldp_p
Discrete Logarithm Domain Parameters over a prime field.
Definition: dldp.h:58
dldp_p::n
mpbarrett n
Definition: dldp.h:86
BEECRYPTAPI
#define BEECRYPTAPI
Definition: api.h:52
dldp_pgoqMake
int dldp_pgoqMake(dldp_p *, randomGeneratorContext *, size_t, size_t, int)
dldp_pgonValidate
int dldp_pgonValidate(const dldp_p *, randomGeneratorContext *)
dldp_pCopy
int dldp_pCopy(dldp_p *, const dldp_p *)
dldp_p::q
mpbarrett q
The cofactor.
Definition: dldp.h:69
dldp_pEqual
int dldp_pEqual(const dldp_p *, const dldp_p *)
dldp_pFree
int dldp_pFree(dldp_p *)
dldp_pPublic
int dldp_pPublic(const dldp_p *, const mpnumber *, mpnumber *)
dldp_p::p
mpbarrett p
The prime.
Definition: dldp.h:63
dldp_p::dldp_p
dldp_p()
dldp_pPair
int dldp_pPair(const dldp_p *, randomGeneratorContext *, mpnumber *x, mpnumber *y)
dldp_pgonMakeSafe
int dldp_pgonMakeSafe(dldp_p *, randomGeneratorContext *, size_t)
dldp_p::r
mpnumber r
Definition: dldp.h:74
dldp_pgonMake
int dldp_pgonMake(dldp_p *, randomGeneratorContext *, size_t, size_t)
dldp_pgonGenerator
int dldp_pgonGenerator(dldp_p *, randomGeneratorContext *)
dldp_p::dldp_p
dldp_p(const dldp_p &)
mpbarrett.h
Multi-precision integer routines using Barrett modular reduction, headers.
dldp_pgoqGenerator
int dldp_pgoqGenerator(dldp_p *, randomGeneratorContext *)
mpnumber
Definition: mpnumber.h:40
mpbarrett
Definition: mpbarrett.h:41
dldp_pPrivate_s
int dldp_pPrivate_s(const dldp_p *, randomGeneratorContext *, mpnumber *, size_t)
dldp_pInit
int dldp_pInit(dldp_p *)
dldp_p::~dldp_p
~dldp_p()
randomGeneratorContext
Definition: beecrypt.h:239
dldp_pPrivate
int dldp_pPrivate(const dldp_p *, randomGeneratorContext *, mpnumber *)