X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fbn%2Fbn_gcd.c;h=7649f63fd22ab2562d7cfe384fc39b5e379eeb2b;hb=710e5d5639c8f943d73f49733382c1b787d1abb6;hp=1691877f31079edfce6344a58a5e2cb7a614fb4f;hpb=124d8cf701cb363415746d258fe30f42b989540d;p=oweals%2Fopenssl.git diff --git a/crypto/bn/bn_gcd.c b/crypto/bn/bn_gcd.c index 1691877f31..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)) @@ -330,7 +331,7 @@ BIGNUM *BN_mod_inverse(BIGNUM *in, } else { - /* general inversion algorithm (less efficient than binary inversion) */ + /* general inversion algorithm */ while (!BN_is_zero(B)) {