bn_fast_mp_invmod fix related to #118

This commit is contained in:
Karel Miko 2018-06-30 15:48:40 +02:00 committed by Steffen Jaeckel
parent a829b87b00
commit f1b9bbf593
1 changed files with 8 additions and 0 deletions

View File

@ -138,6 +138,14 @@ top:
goto LBL_ERR;
}
}
/* too big */
while (mp_cmp_mag(&D, b) != MP_LT) {
if ((res = mp_sub(&D, b, &D)) != MP_OKAY) {
goto LBL_ERR;
}
}
mp_exch(&D, c);
c->sign = neg;
res = MP_OKAY;