diff options
author | Richard Levitte <levitte@openssl.org> | 2002-05-30 16:47:45 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2002-05-30 16:47:45 +0000 |
commit | 9cdf87f19431b32a50b12e468cf2a9557cfc3568 (patch) | |
tree | 5aa5e1f88093d6b8013b9e2f1af0b18201b9bef6 /crypto/bn/bn_mul.c | |
parent | a81e9d3dc45f29c1a5fde7fa641a43f796fe92d4 (diff) |
Check the return values where memory allocation failures may happen.
PR: 49
Diffstat (limited to 'crypto/bn/bn_mul.c')
-rw-r--r-- | crypto/bn/bn_mul.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/bn/bn_mul.c b/crypto/bn/bn_mul.c index 7bffc9c16a..fd598b8b3d 100644 --- a/crypto/bn/bn_mul.c +++ b/crypto/bn/bn_mul.c @@ -964,7 +964,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) if ((al == 0) || (bl == 0)) { - BN_zero(r); + if (!BN_zero(r)) goto err; return(1); } top=al+bl; @@ -1044,7 +1044,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) if (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA)) { BIGNUM *tmp_bn = (BIGNUM *)b; - bn_wexpand(tmp_bn,al); + if (bn_wexpand(tmp_bn,al) == NULL) goto err; tmp_bn->d[bl]=0; bl++; i--; @@ -1052,7 +1052,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) else if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA)) { BIGNUM *tmp_bn = (BIGNUM *)a; - bn_wexpand(tmp_bn,bl); + if (bn_wexpand(tmp_bn,bl) == NULL) goto err; tmp_bn->d[al]=0; al++; i++; @@ -1067,14 +1067,14 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) t = BN_CTX_get(ctx); if (al == j) /* exact multiple */ { - bn_wexpand(t,k*2); - bn_wexpand(rr,k*2); + if (bn_wexpand(t,k*2) == NULL) goto err; + if (bn_wexpand(rr,k*2) == NULL) goto err; bn_mul_recursive(rr->d,a->d,b->d,al,t->d); } else { - bn_wexpand(t,k*4); - bn_wexpand(rr,k*4); + if (bn_wexpand(t,k*4) == NULL) goto err; + if (bn_wexpand(rr,k*4) == NULL) goto err; bn_mul_part_recursive(rr->d,a->d,b->d,al-j,j,t->d); } rr->top=top; |