BeeCrypt
4.2.1
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
include
beecrypt
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
54
struct
BEECRYPTAPI
dldp_p
55
#else
56
struct _dldp_p
57
#endif
58
{
63
mpbarrett
p
;
69
mpbarrett
q
;
74
mpnumber
r
;
81
mpnumber
g
;
86
mpbarrett
n
;
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
106
BEECRYPTAPI
107
int
dldp_pInit
(
dldp_p
*);
108
BEECRYPTAPI
109
int
dldp_pFree
(
dldp_p
*);
110
BEECRYPTAPI
111
int
dldp_pCopy
(
dldp_p
*,
const
dldp_p
*);
112
113
/*
114
* Functions for generating keys
115
*/
116
117
BEECRYPTAPI
118
int
dldp_pPrivate
(
const
dldp_p
*,
randomGeneratorContext
*,
mpnumber
*);
119
BEECRYPTAPI
120
int
dldp_pPrivate_s
(
const
dldp_p
*,
randomGeneratorContext
*,
mpnumber
*,
size_t
);
121
BEECRYPTAPI
122
int
dldp_pPublic
(
const
dldp_p
*,
const
mpnumber
*,
mpnumber
*);
123
BEECRYPTAPI
124
int
dldp_pPair
(
const
dldp_p
*,
randomGeneratorContext
*,
mpnumber
* x,
mpnumber
* y);
125
BEECRYPTAPI
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
132
BEECRYPTAPI
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
139
BEECRYPTAPI
140
int
dldp_pgoqMake
(
dldp_p
*,
randomGeneratorContext
*,
size_t
,
size_t
,
int
);
141
BEECRYPTAPI
142
int
dldp_pgoqMakeSafe
(
dldp_p
*,
randomGeneratorContext
*,
size_t
);
143
BEECRYPTAPI
144
int
dldp_pgoqGenerator
(
dldp_p
*,
randomGeneratorContext
*);
145
BEECRYPTAPI
146
int
dldp_pgoqValidate
(
const
dldp_p
*,
randomGeneratorContext
*,
int
);
147
148
/*
149
* Functions for generating and validating dldp_pgon variant domain parameters
150
*/
151
152
BEECRYPTAPI
153
int
dldp_pgonMake
(
dldp_p
*,
randomGeneratorContext
*,
size_t
,
size_t
);
154
BEECRYPTAPI
155
int
dldp_pgonMakeSafe
(
dldp_p
*,
randomGeneratorContext
*,
size_t
);
156
BEECRYPTAPI
157
int
dldp_pgonGenerator
(
dldp_p
*,
randomGeneratorContext
*);
158
BEECRYPTAPI
159
int
dldp_pgonValidate
(
const
dldp_p
*,
randomGeneratorContext
*);
160
161
#ifdef __cplusplus
162
}
163
#endif
164
165
#endif
Generated by
1.8.4