summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_prime.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-11-04 22:54:49 +0000
committerGeoff Thorpe <geoff@openssl.org>2003-11-04 22:54:49 +0000
commitd870740cd75dd4f0cb66fb8c32653a7d47369706 (patch)
tree0c6cb1ce0b1083c96419c432d1f05c3dff51320d /crypto/bn/bn_prime.c
parentd8ec0dcf457f4dec39f137657b702fcbeaf5cc04 (diff)
Put the first stage of my bignum debugging adventures into CVS. This code
is itself experimental, and in addition may cause execution to break on existing openssl "bugs" that previously were harmless or at least invisible.
Diffstat (limited to 'crypto/bn/bn_prime.c')
-rw-r--r--crypto/bn/bn_prime.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c
index fd863933e5..4430e90df5 100644
--- a/crypto/bn/bn_prime.c
+++ b/crypto/bn/bn_prime.c
@@ -226,6 +226,7 @@ loop:
err:
BN_free(&t);
if (ctx != NULL) BN_CTX_free(ctx);
+ bn_check_top(ret);
return found;
}
@@ -363,6 +364,7 @@ static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
}
/* If we get here, 'w' is the (a-1)/2-th power of the original 'w',
* and it is neither -1 nor +1 -- so 'a' cannot be prime */
+ bn_check_top(w);
return 1;
}
@@ -394,6 +396,7 @@ again:
}
}
if (!BN_add_word(rnd,delta)) return(0);
+ bn_check_top(rnd);
return(1);
}
@@ -431,6 +434,7 @@ static int probable_prime_dh(BIGNUM *rnd, int bits,
ret=1;
err:
BN_CTX_end(ctx);
+ bn_check_top(rnd);
return(ret);
}
@@ -482,5 +486,6 @@ static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd,
ret=1;
err:
BN_CTX_end(ctx);
+ bn_check_top(p);
return(ret);
}