diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2002-05-10 22:18:13 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2002-05-10 22:18:13 +0000 |
commit | dc014d43af330e2c492b80db0ce0abaa351e17dc (patch) | |
tree | c19af19fa71c422b4d5b05271dae005fcec49c3a /crypto/bn/bn_mul.c | |
parent | 2f9cf160e416b2a032ebafdf70063a16775cf904 (diff) | |
download | openssl-new-dc014d43af330e2c492b80db0ce0abaa351e17dc.tar.gz |
Fallback to normal multiply if n2 == 8 and dna or dnb is not zero
in bn_mul_recursive.
This is (hopefully) what was triggering bignum errors on 64 bit
platforms and causing the BN_mod_mul test to fail.
Diffstat (limited to 'crypto/bn/bn_mul.c')
-rw-r--r-- | crypto/bn/bn_mul.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crypto/bn/bn_mul.c b/crypto/bn/bn_mul.c index 41ea925b8d..7bffc9c16a 100644 --- a/crypto/bn/bn_mul.c +++ b/crypto/bn/bn_mul.c @@ -408,16 +408,22 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, return; } # endif - if (n2 == 8) + /* Only call bn_mul_comba 8 if n2 == 8 and the + * two arrays are complete [steve] + */ + if (n2 == 8 && dna == 0 && dnb == 0) { bn_mul_comba8(r,a,b); return; } # endif /* BN_MUL_COMBA */ + /* Else do normal multiply */ if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) { - /* This should not happen */ - bn_mul_normal(r,a,n2,b,n2); + bn_mul_normal(r,a,n2+dna,b,n2+dnb); + if ((dna + dnb) < 0) + memset(&r[2*n2 + dna + dnb], 0, + sizeof(BN_ULONG) * -(dna + dnb)); return; } /* r=(a[0]-a[1])*(b[1]-b[0]) */ |