From: Mark Wooding Date: Fri, 13 Mar 2015 20:36:31 +0000 (+0000) Subject: pub/rsa-recover.c: Give up if we run out of prime numbers. X-Git-Tag: 2.2.0~13 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb/commitdiff_plain/ff46b6b6cf43351b759b87c4c85de3364e7fab8a pub/rsa-recover.c: Give up if we run out of prime numbers. 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. --- diff --git a/pub/rsa-recover.c b/pub/rsa-recover.c index bc3eda22..055d969a 100644 --- a/pub/rsa-recover.c +++ b/pub/rsa-recover.c @@ -116,6 +116,7 @@ int rsa_recover(rsa_priv *rp) * 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);