aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_gf2m.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-08-07 07:53:47 +0000
committerBodo Möller <bodo@openssl.org>2002-08-07 07:53:47 +0000
commit7a8645d1716d7f84435b0f3d8d2fd122d6f75113 (patch)
treebc791675767d9c6ffae3e35d27e8c8c2d9953ddc /crypto/bn/bn_gf2m.c
parent5bf738737da9c9c09a73686f945c22d5eb2e1a74 (diff)
downloadopenssl-7a8645d1716d7f84435b0f3d8d2fd122d6f75113.tar.gz
avoid SIGSEGV
Submitted by: Nils Larsch, Douglas Stebila
Diffstat (limited to 'crypto/bn/bn_gf2m.c')
-rw-r--r--crypto/bn/bn_gf2m.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/bn/bn_gf2m.c b/crypto/bn/bn_gf2m.c
index c969685c87..8bd17e0e7c 100644
--- a/crypto/bn/bn_gf2m.c
+++ b/crypto/bn/bn_gf2m.c
@@ -316,10 +316,10 @@ int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[])
int n, dN, d0, d1;
BN_ULONG zz, *z;
- /* Since the algorithm does reduction in place, if a == r, copy the
+ /* Since the algorithm does reduction in the r value, if a != r, copy the
* contents of a into r so we can do reduction in r.
*/
- if ((a != NULL) && (a->d != r->d))
+ if (a != r)
{
if (!bn_wexpand(r, a->top)) return 0;
for (j = 0; j < a->top; j++)
@@ -427,7 +427,7 @@ int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const unsig
BN_CTX_start(ctx);
if ((s = BN_CTX_get(ctx)) == NULL) goto err;
- zlen = a->top + b->top;
+ zlen = a->top + b->top + 4;
if (!bn_wexpand(s, zlen)) goto err;
s->top = zlen;