提交 765e5311 编写于 作者: R Richard Levitte

In bn_mul_recursive(), make sure the comba routines are only called

when both a and b are of the exact right size.  This may change to
something better later.
上级 de282fe3
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
#include "cryptlib.h" #include "cryptlib.h"
#include "bn_lcl.h" #include "bn_lcl.h"
#if defined(NO_ASM) || !defined(i386) #if defined(NO_ASM)
/* Here follows specialised variants of bn_add_words() and /* Here follows specialised variants of bn_add_words() and
bn_sub_words(). They have the property performing operations on bn_sub_words(). They have the property performing operations on
arrays of different sizes. The sizes of those arrays is expressed through arrays of different sizes. The sizes of those arrays is expressed through
...@@ -458,7 +458,8 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, ...@@ -458,7 +458,8 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
} }
# ifdef BN_MUL_COMBA # ifdef BN_MUL_COMBA
if (n == 4) if (n == 4 && dna == 0 && dnb == 0) /* XXX: bn_mul_comba4 could take
extra args to do this well */
{ {
if (!zero) if (!zero)
bn_mul_comba4(&(t[n2]),t,&(t[n])); bn_mul_comba4(&(t[n2]),t,&(t[n]));
...@@ -468,7 +469,9 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, ...@@ -468,7 +469,9 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
bn_mul_comba4(r,a,b); bn_mul_comba4(r,a,b);
bn_mul_comba4(&(r[n2]),&(a[n]),&(b[n])); bn_mul_comba4(&(r[n2]),&(a[n]),&(b[n]));
} }
else if (n == 8) else if (n == 8 && dna == 0 && dnb == 0) /* XXX: bn_mul_comba8 could
take extra args to do this
well */
{ {
if (!zero) if (!zero)
bn_mul_comba8(&(t[n2]),t,&(t[n])); bn_mul_comba8(&(t[n2]),t,&(t[n]));
...@@ -938,7 +941,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) ...@@ -938,7 +941,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
int i; int i;
#endif #endif
#ifdef BN_RECURSION #ifdef BN_RECURSION
BIGNUM *t; BIGNUM *t=NULL;
int j=0,k; int j=0,k;
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册