summaryrefslogtreecommitdiff
path: root/crypto/bn/bn_gcd.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2001-04-09 09:28:24 +0000
committerBodo Möller <bodo@openssl.org>2001-04-09 09:28:24 +0000
commit1f224bf0298268bdd7790808a632f7fbae4206ba (patch)
tree633cc3aa5e6d3c12403887828a4e6bbe5bd09964 /crypto/bn/bn_gcd.c
parent4d231b4359e4f6013ccccaacac13f3a69bfec613 (diff)
downloadopenssl-new-1f224bf0298268bdd7790808a632f7fbae4206ba.tar.gz
Adjust BN_mod_inverse algorithm selection according to experiments on
Ultra-Sparcs (both 32-bit and 64-bit compilations)
Diffstat (limited to 'crypto/bn/bn_gcd.c')
-rw-r--r--crypto/bn/bn_gcd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/bn/bn_gcd.c b/crypto/bn/bn_gcd.c
index 7496dbc3bd..7649f63fd2 100644
--- a/crypto/bn/bn_gcd.c
+++ b/crypto/bn/bn_gcd.c
@@ -244,11 +244,12 @@ BIGNUM *BN_mod_inverse(BIGNUM *in,
* sign*Y*a == A (mod |n|).
*/
- if (BN_is_odd(n) && (BN_num_bits(n) <= 400))
+ if (BN_is_odd(n) && (BN_num_bits(n) <= (BN_BITS <= 32 ? 450 : 2048)))
{
/* Binary inversion algorithm; requires odd modulus.
* This is faster than the general algorithm if the modulus
- * is sufficiently small. */
+ * is sufficiently small (about 400 .. 500 bits on 32-bit
+ * sytems, but much more on 64-bit systems) */
int shift;
while (!BN_is_zero(B))