Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
0a2efbb1
Commit
0a2efbb1
authored
Oct 15, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Oct 15, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Make some functions used in only one file static.
parent
07b325f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
32 deletions
+24
-32
mpi.c
dlls/rsaenh/mpi.c
+24
-11
tomcrypt.h
dlls/rsaenh/tomcrypt.h
+0
-21
No files found.
dlls/rsaenh/mpi.c
View file @
0a2efbb1
...
@@ -39,13 +39,26 @@
...
@@ -39,13 +39,26 @@
static
const
int
KARATSUBA_MUL_CUTOFF
=
88
,
/* Min. number of digits before Karatsuba multiplication is used. */
static
const
int
KARATSUBA_MUL_CUTOFF
=
88
,
/* Min. number of digits before Karatsuba multiplication is used. */
KARATSUBA_SQR_CUTOFF
=
128
;
/* Min. number of digits before Karatsuba squaring is used. */
KARATSUBA_SQR_CUTOFF
=
128
;
/* Min. number of digits before Karatsuba squaring is used. */
static
void
bn_reverse
(
unsigned
char
*
s
,
int
len
);
static
int
s_mp_add
(
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
);
static
int
s_mp_exptmod
(
const
mp_int
*
G
,
const
mp_int
*
X
,
mp_int
*
P
,
mp_int
*
Y
);
#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
static
int
s_mp_mul_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
);
static
int
s_mp_mul_high_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
);
static
int
s_mp_sqr
(
const
mp_int
*
a
,
mp_int
*
b
);
static
int
s_mp_sub
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
);
static
int
mp_exptmod_fast
(
const
mp_int
*
G
,
const
mp_int
*
X
,
mp_int
*
P
,
mp_int
*
Y
,
int
mode
);
static
int
mp_invmod_slow
(
const
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
);
static
int
mp_karatsuba_mul
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
);
static
int
mp_karatsuba_sqr
(
const
mp_int
*
a
,
mp_int
*
b
);
/* computes the modular inverse via binary extended euclidean algorithm,
/* computes the modular inverse via binary extended euclidean algorithm,
* that is c = 1/a mod b
* that is c = 1/a mod b
*
*
* Based on slow invmod except this is optimized for the case where b is
* Based on slow invmod except this is optimized for the case where b is
* odd as per HAC Note 14.64 on pp. 610
* odd as per HAC Note 14.64 on pp. 610
*/
*/
int
static
int
fast_mp_invmod
(
const
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
)
fast_mp_invmod
(
const
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
)
{
{
mp_int
x
,
y
,
u
,
v
,
B
,
D
;
mp_int
x
,
y
,
u
,
v
,
B
,
D
;
...
@@ -175,7 +188,7 @@ __ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL);
...
@@ -175,7 +188,7 @@ __ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL);
*
*
* Based on Algorithm 14.32 on pp.601 of HAC.
* Based on Algorithm 14.32 on pp.601 of HAC.
*/
*/
int
static
int
fast_mp_montgomery_reduce
(
mp_int
*
x
,
const
mp_int
*
n
,
mp_digit
rho
)
fast_mp_montgomery_reduce
(
mp_int
*
x
,
const
mp_int
*
n
,
mp_digit
rho
)
{
{
int
ix
,
res
,
olduse
;
int
ix
,
res
,
olduse
;
...
@@ -335,7 +348,7 @@ fast_mp_montgomery_reduce (mp_int * x, const mp_int * n, mp_digit rho)
...
@@ -335,7 +348,7 @@ fast_mp_montgomery_reduce (mp_int * x, const mp_int * n, mp_digit rho)
* Based on Algorithm 14.12 on pp.595 of HAC.
* Based on Algorithm 14.12 on pp.595 of HAC.
*
*
*/
*/
int
static
int
fast_s_mp_mul_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
)
fast_s_mp_mul_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
)
{
{
int
olduse
,
res
,
pa
,
ix
,
iz
;
int
olduse
,
res
,
pa
,
ix
,
iz
;
...
@@ -414,7 +427,7 @@ fast_s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
...
@@ -414,7 +427,7 @@ fast_s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
*
*
* Based on Algorithm 14.12 on pp.595 of HAC.
* Based on Algorithm 14.12 on pp.595 of HAC.
*/
*/
int
static
int
fast_s_mp_mul_high_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
)
fast_s_mp_mul_high_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
)
{
{
int
olduse
,
res
,
pa
,
ix
,
iz
;
int
olduse
,
res
,
pa
,
ix
,
iz
;
...
@@ -512,7 +525,7 @@ Remove W2 and don't memset W
...
@@ -512,7 +525,7 @@ Remove W2 and don't memset W
*/
*/
int
fast_s_mp_sqr
(
const
mp_int
*
a
,
mp_int
*
b
)
static
int
fast_s_mp_sqr
(
const
mp_int
*
a
,
mp_int
*
b
)
{
{
int
olduse
,
res
,
pa
,
ix
,
iz
;
int
olduse
,
res
,
pa
,
ix
,
iz
;
mp_digit
W
[
MP_WARRAY
],
*
tmpx
;
mp_digit
W
[
MP_WARRAY
],
*
tmpx
;
...
@@ -3847,7 +3860,7 @@ mp_zero (mp_int * a)
...
@@ -3847,7 +3860,7 @@ mp_zero (mp_int * a)
}
}
/* reverse an array, used for radix code */
/* reverse an array, used for radix code */
void
static
void
bn_reverse
(
unsigned
char
*
s
,
int
len
)
bn_reverse
(
unsigned
char
*
s
,
int
len
)
{
{
int
ix
,
iy
;
int
ix
,
iy
;
...
@@ -3865,7 +3878,7 @@ bn_reverse (unsigned char *s, int len)
...
@@ -3865,7 +3878,7 @@ bn_reverse (unsigned char *s, int len)
}
}
/* low level addition, based on HAC pp.594, Algorithm 14.7 */
/* low level addition, based on HAC pp.594, Algorithm 14.7 */
int
static
int
s_mp_add
(
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
)
s_mp_add
(
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
)
{
{
mp_int
*
x
;
mp_int
*
x
;
...
@@ -3952,7 +3965,7 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c)
...
@@ -3952,7 +3965,7 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c)
return
MP_OKAY
;
return
MP_OKAY
;
}
}
int
s_mp_exptmod
(
const
mp_int
*
G
,
const
mp_int
*
X
,
mp_int
*
P
,
mp_int
*
Y
)
static
int
s_mp_exptmod
(
const
mp_int
*
G
,
const
mp_int
*
X
,
mp_int
*
P
,
mp_int
*
Y
)
{
{
mp_int
M
[
256
],
res
,
mu
;
mp_int
M
[
256
],
res
,
mu
;
mp_digit
buf
;
mp_digit
buf
;
...
@@ -4163,7 +4176,7 @@ __M:
...
@@ -4163,7 +4176,7 @@ __M:
* HAC pp. 595, Algorithm 14.12 Modified so you can control how
* HAC pp. 595, Algorithm 14.12 Modified so you can control how
* many digits of output are created.
* many digits of output are created.
*/
*/
int
static
int
s_mp_mul_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
)
s_mp_mul_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
)
{
{
mp_int
t
;
mp_int
t
;
...
@@ -4232,7 +4245,7 @@ s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
...
@@ -4232,7 +4245,7 @@ s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
/* multiplies |a| * |b| and does not compute the lower digs digits
/* multiplies |a| * |b| and does not compute the lower digs digits
* [meant to get the higher part of the product]
* [meant to get the higher part of the product]
*/
*/
int
static
int
s_mp_mul_high_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
)
s_mp_mul_high_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
)
{
{
mp_int
t
;
mp_int
t
;
...
@@ -4288,7 +4301,7 @@ s_mp_mul_high_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
...
@@ -4288,7 +4301,7 @@ s_mp_mul_high_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs)
}
}
/* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */
/* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */
int
static
int
s_mp_sqr
(
const
mp_int
*
a
,
mp_int
*
b
)
s_mp_sqr
(
const
mp_int
*
a
,
mp_int
*
b
)
{
{
mp_int
t
;
mp_int
t
;
...
...
dlls/rsaenh/tomcrypt.h
View file @
0a2efbb1
...
@@ -574,27 +574,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream);
...
@@ -574,27 +574,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream);
#define mp_todecimal(M, S) mp_toradix((M), (S), 10)
#define mp_todecimal(M, S) mp_toradix((M), (S), 10)
#define mp_tohex(M, S) mp_toradix((M), (S), 16)
#define mp_tohex(M, S) mp_toradix((M), (S), 16)
/* lowlevel functions, do not call! */
int
s_mp_add
(
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
);
int
s_mp_sub
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
);
#define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
int
fast_s_mp_mul_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
);
int
s_mp_mul_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
);
int
fast_s_mp_mul_high_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
);
int
s_mp_mul_high_digs
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
,
int
digs
);
int
fast_s_mp_sqr
(
const
mp_int
*
a
,
mp_int
*
b
);
int
s_mp_sqr
(
const
mp_int
*
a
,
mp_int
*
b
);
int
mp_karatsuba_mul
(
const
mp_int
*
a
,
const
mp_int
*
b
,
mp_int
*
c
);
int
mp_toom_mul
(
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
);
int
mp_karatsuba_sqr
(
const
mp_int
*
a
,
mp_int
*
b
);
int
mp_toom_sqr
(
mp_int
*
a
,
mp_int
*
b
);
int
fast_mp_invmod
(
const
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
);
int
mp_invmod_slow
(
const
mp_int
*
a
,
mp_int
*
b
,
mp_int
*
c
);
int
fast_mp_montgomery_reduce
(
mp_int
*
a
,
const
mp_int
*
m
,
mp_digit
mp
);
int
mp_exptmod_fast
(
const
mp_int
*
G
,
const
mp_int
*
X
,
mp_int
*
P
,
mp_int
*
Y
,
int
mode
);
int
s_mp_exptmod
(
const
mp_int
*
G
,
const
mp_int
*
X
,
mp_int
*
P
,
mp_int
*
Y
);
void
bn_reverse
(
unsigned
char
*
s
,
int
len
);
extern
const
char
*
mp_s_rmap
;
extern
const
char
*
mp_s_rmap
;
#define PK_PRIVATE 0
/* PK private keys */
#define PK_PRIVATE 0
/* PK private keys */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment