summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_mul.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/bn/bn_mul.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c
index 7bffc9c16a..fd598b8b3d 100644
--- a/src/lib/libcrypto/bn/bn_mul.c
+++ b/src/lib/libcrypto/bn/bn_mul.c
@@ -964,7 +964,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
964 964
965 if ((al == 0) || (bl == 0)) 965 if ((al == 0) || (bl == 0))
966 { 966 {
967 BN_zero(r); 967 if (!BN_zero(r)) goto err;
968 return(1); 968 return(1);
969 } 969 }
970 top=al+bl; 970 top=al+bl;
@@ -1044,7 +1044,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1044 if (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA)) 1044 if (i == 1 && !BN_get_flags(b,BN_FLG_STATIC_DATA))
1045 { 1045 {
1046 BIGNUM *tmp_bn = (BIGNUM *)b; 1046 BIGNUM *tmp_bn = (BIGNUM *)b;
1047 bn_wexpand(tmp_bn,al); 1047 if (bn_wexpand(tmp_bn,al) == NULL) goto err;
1048 tmp_bn->d[bl]=0; 1048 tmp_bn->d[bl]=0;
1049 bl++; 1049 bl++;
1050 i--; 1050 i--;
@@ -1052,7 +1052,7 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1052 else if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA)) 1052 else if (i == -1 && !BN_get_flags(a,BN_FLG_STATIC_DATA))
1053 { 1053 {
1054 BIGNUM *tmp_bn = (BIGNUM *)a; 1054 BIGNUM *tmp_bn = (BIGNUM *)a;
1055 bn_wexpand(tmp_bn,bl); 1055 if (bn_wexpand(tmp_bn,bl) == NULL) goto err;
1056 tmp_bn->d[al]=0; 1056 tmp_bn->d[al]=0;
1057 al++; 1057 al++;
1058 i++; 1058 i++;
@@ -1067,14 +1067,14 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1067 t = BN_CTX_get(ctx); 1067 t = BN_CTX_get(ctx);
1068 if (al == j) /* exact multiple */ 1068 if (al == j) /* exact multiple */
1069 { 1069 {
1070 bn_wexpand(t,k*2); 1070 if (bn_wexpand(t,k*2) == NULL) goto err;
1071 bn_wexpand(rr,k*2); 1071 if (bn_wexpand(rr,k*2) == NULL) goto err;
1072 bn_mul_recursive(rr->d,a->d,b->d,al,t->d); 1072 bn_mul_recursive(rr->d,a->d,b->d,al,t->d);
1073 } 1073 }
1074 else 1074 else
1075 { 1075 {
1076 bn_wexpand(t,k*4); 1076 if (bn_wexpand(t,k*4) == NULL) goto err;
1077 bn_wexpand(rr,k*4); 1077 if (bn_wexpand(rr,k*4) == NULL) goto err;
1078 bn_mul_part_recursive(rr->d,a->d,b->d,al-j,j,t->d); 1078 bn_mul_part_recursive(rr->d,a->d,b->d,al-j,j,t->d);
1079 } 1079 }
1080 rr->top=top; 1080 rr->top=top;