Skip to content

Commit

Permalink
Fix corner case.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed Oct 9, 2024
1 parent ac2aac6 commit f12f285
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bn/relic_bn_inv.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ void bn_mod_inv(bn_t c, const bn_t a, const bn_t b) {
bn_new(t);
bn_new(u);

bn_mod(t, a, b);
bn_copy(u, b);
bn_gcd_ext(t, c, NULL, a, b);
bn_gcd_ext(t, c, NULL, t, b);

if (bn_sign(c) == RLC_NEG) {
bn_add(c, c, u);
Expand Down

0 comments on commit f12f285

Please sign in to comment.