diff options
Diffstat (limited to 'src/lib/libcrypto/bn/bn_div.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_div.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/bn_div.c b/src/lib/libcrypto/bn/bn_div.c index d6ddc9cbe3..802a43d642 100644 --- a/src/lib/libcrypto/bn/bn_div.c +++ b/src/lib/libcrypto/bn/bn_div.c | |||
@@ -229,7 +229,8 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, | |||
229 | if (dv == NULL) | 229 | if (dv == NULL) |
230 | res=BN_CTX_get(ctx); | 230 | res=BN_CTX_get(ctx); |
231 | else res=dv; | 231 | else res=dv; |
232 | if (sdiv == NULL || res == NULL) goto err; | 232 | if (sdiv == NULL || res == NULL || tmp == NULL || snum == NULL) |
233 | goto err; | ||
233 | 234 | ||
234 | /* First we normalise the numbers */ | 235 | /* First we normalise the numbers */ |
235 | norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); | 236 | norm_shift=BN_BITS2-((BN_num_bits(divisor))%BN_BITS2); |
@@ -336,7 +337,7 @@ X) -> 0x%08X\n", | |||
336 | t2 -= d1; | 337 | t2 -= d1; |
337 | } | 338 | } |
338 | #else /* !BN_LLONG */ | 339 | #else /* !BN_LLONG */ |
339 | BN_ULONG t2l,t2h,ql,qh; | 340 | BN_ULONG t2l,t2h; |
340 | 341 | ||
341 | q=bn_div_words(n0,n1,d0); | 342 | q=bn_div_words(n0,n1,d0); |
342 | #ifdef BN_DEBUG_LEVITTE | 343 | #ifdef BN_DEBUG_LEVITTE |
@@ -354,9 +355,12 @@ X) -> 0x%08X\n", | |||
354 | t2l = d1 * q; | 355 | t2l = d1 * q; |
355 | t2h = BN_UMULT_HIGH(d1,q); | 356 | t2h = BN_UMULT_HIGH(d1,q); |
356 | #else | 357 | #else |
358 | { | ||
359 | BN_ULONG ql, qh; | ||
357 | t2l=LBITS(d1); t2h=HBITS(d1); | 360 | t2l=LBITS(d1); t2h=HBITS(d1); |
358 | ql =LBITS(q); qh =HBITS(q); | 361 | ql =LBITS(q); qh =HBITS(q); |
359 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ | 362 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ |
363 | } | ||
360 | #endif | 364 | #endif |
361 | 365 | ||
362 | for (;;) | 366 | for (;;) |
@@ -560,7 +564,7 @@ X) -> 0x%08X\n", | |||
560 | t2 -= d1; | 564 | t2 -= d1; |
561 | } | 565 | } |
562 | #else /* !BN_LLONG */ | 566 | #else /* !BN_LLONG */ |
563 | BN_ULONG t2l,t2h,ql,qh; | 567 | BN_ULONG t2l,t2h; |
564 | 568 | ||
565 | q=bn_div_words(n0,n1,d0); | 569 | q=bn_div_words(n0,n1,d0); |
566 | #ifdef BN_DEBUG_LEVITTE | 570 | #ifdef BN_DEBUG_LEVITTE |
@@ -578,9 +582,12 @@ X) -> 0x%08X\n", | |||
578 | t2l = d1 * q; | 582 | t2l = d1 * q; |
579 | t2h = BN_UMULT_HIGH(d1,q); | 583 | t2h = BN_UMULT_HIGH(d1,q); |
580 | #else | 584 | #else |
585 | { | ||
586 | BN_ULONG ql, qh; | ||
581 | t2l=LBITS(d1); t2h=HBITS(d1); | 587 | t2l=LBITS(d1); t2h=HBITS(d1); |
582 | ql =LBITS(q); qh =HBITS(q); | 588 | ql =LBITS(q); qh =HBITS(q); |
583 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ | 589 | mul64(t2l,t2h,ql,qh); /* t2=(BN_ULLONG)d1*q; */ |
590 | } | ||
584 | #endif | 591 | #endif |
585 | 592 | ||
586 | for (;;) | 593 | for (;;) |