summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_div.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/bn/bn_div.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c
index ac1a09615a..f9a095e3b3 100644
--- a/src/lib/libcrypto/bn/bn_div.c
+++ b/src/lib/libcrypto/bn/bn_div.c
@@ -200,10 +200,10 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
200 200
201 /* First we normalise the numbers */ 201 /* First we normalise the numbers */
202 norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); 202 norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2);
203 BN_lshift(sdiv,divisor,norm_shift); 203 if (!(BN_lshift(sdiv,divisor,norm_shift))) goto err;
204 sdiv->neg=0; 204 sdiv->neg=0;
205 norm_shift+=BN_BITS2; 205 norm_shift+=BN_BITS2;
206 BN_lshift(snum,num,norm_shift); 206 if (!(BN_lshift(snum,num,norm_shift))) goto err;
207 snum->neg=0; 207 snum->neg=0;
208 div_n=sdiv->top; 208 div_n=sdiv->top;
209 num_n=snum->top; 209 num_n=snum->top;
@@ -327,7 +327,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
327 tmp->top=j; 327 tmp->top=j;
328 328
329 j=wnum.top; 329 j=wnum.top;
330 BN_sub(&wnum,&wnum,tmp); 330 if (!BN_sub(&wnum,&wnum,tmp)) goto err;
331 331
332 snum->top=snum->top+wnum.top-j; 332 snum->top=snum->top+wnum.top-j;
333 333
@@ -335,7 +335,7 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
335 { 335 {
336 q--; 336 q--;
337 j=wnum.top; 337 j=wnum.top;
338 BN_add(&wnum,&wnum,sdiv); 338 if (!BN_add(&wnum,&wnum,sdiv)) goto err;
339 snum->top+=wnum.top-j; 339 snum->top+=wnum.top-j;
340 } 340 }
341 *(resp--)=q; 341 *(resp--)=q;