summaryrefslogtreecommitdiff
path: root/src/libbiguint/bu_invmod.c
blob: 7bd8feeea64968dd7267794137bb19e6ad23568b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* ISC license. */

#include <stdint.h>
#include <skalibs/biguint.h>

/* x^-1 mod m. */

int bu_invmod (uint32_t *x, unsigned int xn, uint32_t const *m, unsigned int mn)
{
  uint32_t const one = 1 ;
  return bu_divmod(x, xn, &one, 1, x, xn, m, mn) ;
}