diff --git a/bn_mp_div.c b/bn_mp_div.c index 336a57b..f50a8d7 100644 --- a/bn_mp_div.c +++ b/bn_mp_div.c @@ -196,8 +196,9 @@ int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); tmp |= ((mp_word) x.dp[i - 1]); tmp /= ((mp_word) y.dp[t]); - if (tmp > (mp_word) MP_MASK) + if (tmp > (mp_word) MP_MASK) { tmp = MP_MASK; + } q.dp[i - t - 1] = (mp_digit) (tmp & (mp_word) (MP_MASK)); } diff --git a/bn_mp_mul.c b/bn_mp_mul.c index 74b5135..d7f0074 100644 --- a/bn_mp_mul.c +++ b/bn_mp_mul.c @@ -49,12 +49,13 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c) res = fast_s_mp_mul_digs (a, b, c, digs); } else #endif + { #ifdef BN_S_MP_MUL_DIGS_C res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */ #else res = MP_VAL; #endif - + } } c->sign = (c->used > 0) ? neg : MP_ZPOS; return res; diff --git a/bn_mp_shrink.c b/bn_mp_shrink.c index 0eaa09e..bbc1208 100644 --- a/bn_mp_shrink.c +++ b/bn_mp_shrink.c @@ -21,8 +21,9 @@ int mp_shrink (mp_int * a) mp_digit *tmp; int used = 1; - if(a->used > 0) + if(a->used > 0) { used = a->used; + } if (a->alloc != used) { if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * used)) == NULL) { diff --git a/bn_mp_sqr.c b/bn_mp_sqr.c index fa5a8a6..5167ce0 100644 --- a/bn_mp_sqr.c +++ b/bn_mp_sqr.c @@ -42,11 +42,13 @@ mp_sqr (mp_int * a, mp_int * b) res = fast_s_mp_sqr (a, b); } else #endif + { #ifdef BN_S_MP_SQR_C res = s_mp_sqr (a, b); #else res = MP_VAL; #endif + } } b->sign = MP_ZPOS; return res;