BeeCrypt
4.2.1
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
include
beecrypt
mpbarrett.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2003 Bob Deblier
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 _MPBARRETT_H
27
#define _MPBARRETT_H
28
29
#include "
beecrypt/beecrypt.h
"
30
#include "
beecrypt/mpnumber.h
"
31
32
#ifdef __cplusplus
33
# include <iostream>
34
#endif
35
36
#ifdef __cplusplus
37
struct
BEECRYPTAPI
mpbarrett
38
#else
39
struct _mpbarrett
40
#endif
41
{
42
size_t
size
;
43
mpw
*
modl
;
/* (size) words */
44
mpw
*
mu
;
/* (size+1) words */
45
46
#ifdef __cplusplus
47
mpbarrett
();
48
mpbarrett
(
const
mpbarrett
&);
49
~
mpbarrett
();
50
51
const
mpbarrett
& operator=(
const
mpbarrett
&);
52
53
void
wipe();
54
55
size_t
bitlength()
const
;
56
#endif
57
};
58
59
#ifndef __cplusplus
60
typedef
struct
_mpbarrett
mpbarrett
;
61
#else
62
BEECRYPTAPI
63
std::ostream&
operator<<
(std::ostream&,
const
mpbarrett
&);
64
#endif
65
66
#ifdef __cplusplus
67
extern
"C"
{
68
#endif
69
70
BEECRYPTAPI
71
void
mpbzero
(
mpbarrett
*);
72
BEECRYPTAPI
73
void
mpbinit
(
mpbarrett
*,
size_t
);
74
BEECRYPTAPI
75
void
mpbfree
(
mpbarrett
*);
76
BEECRYPTAPI
77
void
mpbcopy
(
mpbarrett
*,
const
mpbarrett
*);
78
BEECRYPTAPI
79
void
mpbwipe
(
mpbarrett
*);
80
81
BEECRYPTAPI
82
void
mpbset
(
mpbarrett
*,
size_t
,
const
mpw
*);
83
84
BEECRYPTAPI
85
int
mpbsetbin
(
mpbarrett
*,
const
byte
*,
size_t
);
86
BEECRYPTAPI
87
int
mpbsethex
(
mpbarrett
*,
const
char
*);
88
89
BEECRYPTAPI
90
void
mpbsubone
(
const
mpbarrett
*,
mpw
*);
91
92
BEECRYPTAPI
93
void
mpbmu_w
(
mpbarrett
*,
mpw
*);
94
95
BEECRYPTAPI
96
void
mpbrnd_w
(
const
mpbarrett
*,
randomGeneratorContext
*,
mpw
*,
mpw
*);
97
BEECRYPTAPI
98
void
mpbrndodd_w
(
const
mpbarrett
*,
randomGeneratorContext
*,
mpw
*,
mpw
*);
99
BEECRYPTAPI
100
void
mpbrndinv_w
(
const
mpbarrett
*,
randomGeneratorContext
*,
mpw
*,
mpw
*,
mpw
*);
101
102
BEECRYPTAPI
103
void
mpbneg_w
(
const
mpbarrett
*,
const
mpw
*,
mpw
*);
104
BEECRYPTAPI
105
void
mpbmod_w
(
const
mpbarrett
*,
const
mpw
*,
mpw
*,
mpw
*);
106
107
BEECRYPTAPI
108
void
mpbaddmod_w
(
const
mpbarrett
*,
size_t
,
const
mpw
*,
size_t
,
const
mpw
*,
mpw
*,
mpw
*);
109
BEECRYPTAPI
110
void
mpbsubmod_w
(
const
mpbarrett
*,
size_t
,
const
mpw
*,
size_t
,
const
mpw
*,
mpw
*,
mpw
*);
111
BEECRYPTAPI
112
void
mpbmulmod_w
(
const
mpbarrett
*,
size_t
,
const
mpw
*,
size_t
,
const
mpw
*,
mpw
*,
mpw
*);
113
BEECRYPTAPI
114
void
mpbsqrmod_w
(
const
mpbarrett
*,
size_t
,
const
mpw
*,
mpw
*,
mpw
*);
115
BEECRYPTAPI
116
void
mpbpowmod_w
(
const
mpbarrett
*,
size_t
,
const
mpw
*,
size_t
,
const
mpw
*,
mpw
*,
mpw
*);
117
BEECRYPTAPI
118
void
mpbpowmodsld_w
(
const
mpbarrett
*,
const
mpw
*,
size_t
,
const
mpw
*,
mpw
*,
mpw
*);
119
BEECRYPTAPI
120
void
mpbtwopowmod_w
(
const
mpbarrett
*,
size_t
,
const
mpw
*,
mpw
*,
mpw
*);
121
122
/* To be added:
123
* simultaneous multiple exponentiation, for use in dsa and elgamal signature verification
124
*/
125
BEECRYPTAPI
126
void
mpbsm2powmod
(
const
mpbarrett
*,
const
mpw
*,
const
mpw
*,
const
mpw
*,
const
mpw
*);
127
BEECRYPTAPI
128
void
mpbsm3powmod
(
const
mpbarrett
*,
const
mpw
*,
const
mpw
*,
const
mpw
*,
const
mpw
*,
const
mpw
*,
const
mpw
*);
129
130
BEECRYPTAPI
131
int
mpbpprime_w
(
const
mpbarrett
*,
randomGeneratorContext
*,
int
,
mpw
*);
132
133
/* the next routines take mpnumbers as parameters */
134
135
BEECRYPTAPI
136
void
mpbnrnd
(
const
mpbarrett
*,
randomGeneratorContext
*,
mpnumber
*);
137
138
BEECRYPTAPI
139
void
mpbnmulmod
(
const
mpbarrett
*,
const
mpnumber
*,
const
mpnumber
*,
mpnumber
*);
140
BEECRYPTAPI
141
void
mpbnsqrmod
(
const
mpbarrett
*,
const
mpnumber
*,
mpnumber
*);
142
143
BEECRYPTAPI
144
void
mpbnpowmod
(
const
mpbarrett
*,
const
mpnumber
*,
const
mpnumber
*,
mpnumber
*);
145
BEECRYPTAPI
146
void
mpbnpowmodsld
(
const
mpbarrett
*,
const
mpw
*,
const
mpnumber
*,
mpnumber
*);
147
148
BEECRYPTAPI
149
size_t
mpbbits
(
const
mpbarrett
*);
150
151
#ifdef __cplusplus
152
}
153
#endif
154
155
#endif
Generated by
1.8.4