Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dmitry Baryshkov
nettle
Commits
544b4047
Commit
544b4047
authored
Aug 04, 2016
by
Niels Möller
Browse files
Check for invalid keys, with even p, in dsa_sign.
parent
52b92231
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
544b4047
2016-08-04 Niels Möller <nisse@lysator.liu.se>
* dsa-sign.c (dsa_sign): Return failure if p is even, so that an
invalid key doesn't result in a crash inside mpz_powm_sec.
* rsa-sign-tr.c (rsa_compute_root_tr): Return failure if any of p,
q or n is even, to avoid crashing inside mpz_powm_sec. Invalid
keys with even modulo are rejected by rsa_public_key_prepare and
...
...
dsa-sign.c
View file @
544b4047
...
...
@@ -56,6 +56,11 @@ dsa_sign(const struct dsa_params *params,
mpz_t
tmp
;
int
res
;
/* Check that p is odd, so that invalid keys don't result in a crash
inside mpz_powm_sec. */
if
(
mpz_even_p
(
params
->
p
))
return
0
;
/* Select k, 0<k<q, randomly */
mpz_init_set
(
tmp
,
params
->
q
);
mpz_sub_ui
(
tmp
,
tmp
,
1
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment