From a53cdc5b0834dd23072ea20e546d55ca4f43a0c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bodo=20M=C3=B6ller?= Date: Mon, 18 Sep 2006 14:00:49 +0000 Subject: [PATCH] Ensure that the addition mods[i]+delta cannot overflow in probable_prime(). [Problem pointed out by Adam Young ] --- crypto/bn/bn_prime.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c index d57f658211..5bab019553 100644 --- a/crypto/bn/bn_prime.c +++ b/crypto/bn/bn_prime.c @@ -378,13 +378,14 @@ static int probable_prime(BIGNUM *rnd, int bits) { int i; BN_ULONG mods[NUMPRIMES]; - BN_ULONG delta,d; + BN_ULONG delta,maxdelta; again: if (!BN_rand(rnd,bits,1,1)) return(0); /* we now have a random number 'rand' to test. */ for (i=1; i maxdelta) goto again; goto loop; } } -- GitLab