avoid side effects on right hand of logical operator

This commit is contained in:
Francois Perrad 2015-10-25 16:25:20 +01:00 committed by Steffen Jaeckel
parent 38f90d1b17
commit 64177349fc
1 changed files with 5 additions and 3 deletions

View File

@ -41,9 +41,11 @@ int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast)
}
/* square */
if (b > 1 && (res = mp_sqr (&g, &g)) != MP_OKAY) {
mp_clear (&g);
return res;
if (b > 1) {
if ((res = mp_sqr (&g, &g)) != MP_OKAY) {
mp_clear (&g);
return res;
}
}
/* shift to next bit */