explicit block

This commit is contained in:
Francois Perrad 2015-10-11 19:01:04 +02:00 committed by Steffen Jaeckel
parent 4430c6bc5f
commit 09b8fd9c98
4 changed files with 8 additions and 3 deletions

View File

@ -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));
}

View File

@ -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;

View File

@ -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) {

View File

@ -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;