Check the error return from fp_mod in fp_gcd

Error can occur when using small stack and memory allocation fails.
This commit is contained in:
Sean Parkinson
2020-08-19 08:50:27 +10:00
parent 028bddd7ab
commit 3a7ad4f03b

View File

@ -5157,7 +5157,10 @@ int fp_gcd(fp_int *a, fp_int *b, fp_int *c)
fp_init(r);
while (fp_iszero(v) == FP_NO) {
fp_mod(u, v, r);
int err = fp_mod(u, v, r);
if (err != MP_OKAY) {
return err;
}
fp_copy(v, u);
fp_copy(r, v);
}