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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dmitry Baryshkov
nettle
Commits
af951c2d
Commit
af951c2d
authored
6 years ago
by
Simo Sorce
Committed by
Niels Möller
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Catch bad private keys early on.
parent
3f76113c
Branches
Branches containing commit
Tags
bugzilla-2.16.5
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
rsa-sign.c
+8
-2
8 additions, 2 deletions
rsa-sign.c
with
8 additions
and
2 deletions
rsa-sign.c
+
8
−
2
View file @
af951c2d
...
@@ -70,6 +70,12 @@ rsa_private_key_prepare(struct rsa_private_key *key)
...
@@ -70,6 +70,12 @@ rsa_private_key_prepare(struct rsa_private_key *key)
{
{
mpz_t
n
;
mpz_t
n
;
/* A key is invalid if the sizes of q and c are smaller than
* the size of n, we rely on that property in calculations so
* fail early if that happens. */
if
(
mpz_size
(
key
->
q
)
+
mpz_size
(
key
->
c
)
<
mpz_size
(
key
->
p
))
return
0
;
/* The size of the product is the sum of the sizes of the factors,
/* The size of the product is the sum of the sizes of the factors,
* or sometimes one less. It's possible but tricky to compute the
* or sometimes one less. It's possible but tricky to compute the
* size without computing the full product. */
* size without computing the full product. */
...
...
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