Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
3fe1d654
Commit
3fe1d654
authored
9 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Use mpz_powm_sec.
parent
b4115a0a
No related branches found
No related tags found
No related merge requests found
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
bignum.h
+2
-0
2 additions, 0 deletions
bignum.h
configure.ac
+2
-2
2 additions, 2 deletions
configure.ac
dsa-sign.c
+1
-1
1 addition, 1 deletion
dsa-sign.c
rsa-blind.c
+1
-1
1 addition, 1 deletion
rsa-blind.c
rsa-sign-tr.c
+2
-2
2 additions, 2 deletions
rsa-sign-tr.c
rsa-sign.c
+2
-2
2 additions, 2 deletions
rsa-sign.c
with
10 additions
and
8 deletions
bignum.h
+
2
−
0
View file @
3fe1d654
...
...
@@ -53,6 +53,8 @@
# define mpz_combit mpz_combit
# define mpz_import mpz_import
# define mpz_export mpz_export
/* Side-channel silent powm not available in mini-gmp. */
# define mpz_powm_sec mpz_pwm
#else
# include <gmp.h>
#endif
...
...
This diff is collapsed.
Click to expand it.
configure.ac
+
2
−
2
View file @
3fe1d654
...
...
@@ -236,9 +236,9 @@ fi
# Checks for libraries
if test "x$enable_public_key" = "xyes" ; then
if test "x$enable_mini_gmp" = "xno" ; then
AC_CHECK_LIB(gmp, __gmpz_
getlimbn
,,
AC_CHECK_LIB(gmp, __gmpz_
mpz_powm
,,
[AC_MSG_WARN(
[GNU MP not found, or
not 3.1 or up
, see http://gmplib.org/.
[GNU MP not found, or
too old. GMP-5.0 or later is needed
, see http://gmplib.org/.
Support for public key algorithms will be unavailable.])]
enable_public_key=no)
...
...
This diff is collapsed.
Click to expand it.
dsa-sign.c
+
1
−
1
View file @
3fe1d654
...
...
@@ -65,7 +65,7 @@ dsa_sign(const struct dsa_params *params,
mpz_add_ui
(
k
,
k
,
1
);
/* Compute r = (g^k (mod p)) (mod q) */
mpz_powm
(
tmp
,
params
->
g
,
k
,
params
->
p
);
mpz_powm
_sec
(
tmp
,
params
->
g
,
k
,
params
->
p
);
mpz_fdiv_r
(
signature
->
r
,
tmp
,
params
->
q
);
/* Compute hash */
...
...
This diff is collapsed.
Click to expand it.
rsa-blind.c
+
1
−
1
View file @
3fe1d654
...
...
@@ -61,7 +61,7 @@ _rsa_blind (const struct rsa_public_key *pub,
while
(
!
mpz_invert
(
ri
,
r
,
pub
->
n
));
/* c = c*(r^e) mod n */
mpz_powm
(
r
,
r
,
pub
->
e
,
pub
->
n
);
mpz_powm
_sec
(
r
,
r
,
pub
->
e
,
pub
->
n
);
mpz_mul
(
c
,
c
,
r
);
mpz_fdiv_r
(
c
,
c
,
pub
->
n
);
...
...
This diff is collapsed.
Click to expand it.
rsa-sign-tr.c
+
2
−
2
View file @
3fe1d654
...
...
@@ -60,7 +60,7 @@ rsa_blind (const struct rsa_public_key *pub,
while
(
!
mpz_invert
(
ri
,
r
,
pub
->
n
));
/* c = c*(r^e) mod n */
mpz_powm
(
r
,
r
,
pub
->
e
,
pub
->
n
);
mpz_powm
_sec
(
r
,
r
,
pub
->
e
,
pub
->
n
);
mpz_mul
(
c
,
m
,
r
);
mpz_fdiv_r
(
c
,
c
,
pub
->
n
);
...
...
@@ -97,7 +97,7 @@ rsa_compute_root_tr(const struct rsa_public_key *pub,
rsa_compute_root
(
key
,
xb
,
mb
);
mpz_powm
(
t
,
xb
,
pub
->
e
,
pub
->
n
);
mpz_powm
_sec
(
t
,
xb
,
pub
->
e
,
pub
->
n
);
res
=
(
mpz_cmp
(
mb
,
t
)
==
0
);
if
(
res
)
...
...
This diff is collapsed.
Click to expand it.
rsa-sign.c
+
2
−
2
View file @
3fe1d654
...
...
@@ -96,11 +96,11 @@ rsa_compute_root(const struct rsa_private_key *key,
/* Compute xq = m^d % q = (m%q)^b % q */
mpz_fdiv_r
(
xq
,
m
,
key
->
q
);
mpz_powm
(
xq
,
xq
,
key
->
b
,
key
->
q
);
mpz_powm
_sec
(
xq
,
xq
,
key
->
b
,
key
->
q
);
/* Compute xp = m^d % p = (m%p)^a % p */
mpz_fdiv_r
(
xp
,
m
,
key
->
p
);
mpz_powm
(
xp
,
xp
,
key
->
a
,
key
->
p
);
mpz_powm
_sec
(
xp
,
xp
,
key
->
a
,
key
->
p
);
/* Set xp' = (xp - xq) c % p. */
mpz_sub
(
xp
,
xp
,
xq
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment