chiark
/
gitweb
/
~mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6e088aa
)
pub/rsa-recover.c: Give up if we run out of prime numbers.
author
Mark Wooding
<mdw@distorted.org.uk>
Fri, 13 Mar 2015 20:36:31 +0000
(20:36 +0000)
committer
Mark Wooding
<mdw@distorted.org.uk>
Fri, 13 Mar 2015 20:36:31 +0000
(20:36 +0000)
We have a 1/2 probability of winning for each prime, and `NPRIME' is at
least 256, so the chances of us giving up on an input which we could, in
fact, factor if we persevered are negligible. We therefore neglect them.
pub/rsa-recover.c
patch
|
blob
|
blame
|
history
diff --git
a/pub/rsa-recover.c
b/pub/rsa-recover.c
index bc3eda22da586c5b1c1894bfa30aec2e627ea84e..055d969a49d5d1ddbfe3ff52abe219ae72bf15f3 100644
(file)
--- a/
pub/rsa-recover.c
+++ b/
pub/rsa-recover.c
@@
-116,6
+116,7
@@
int rsa_recover(rsa_priv *rp)
* is a failure.
*/
* is a failure.
*/
+ if (i > NPRIME) goto out;
aw = primetab[i++];
z = mpmont_mul(&mm, z, &a, mm.r2);
z = mpmont_expr(&mm, z, z, t);
aw = primetab[i++];
z = mpmont_mul(&mm, z, &a, mm.r2);
z = mpmont_expr(&mm, z, z, t);