1 #include "tommath_private.h"
2 #ifdef BN_MP_REDUCE_SETUP_C
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
6 /* pre-calculate the value required for Barrett reduction
7 * For a given modulus "b" it calulates the value required in "a"
9 mp_err mp_reduce_setup(mp_int *a, const mp_int *b)
12 if ((err = mp_2expt(a, b->used * 2 * MP_DIGIT_BIT)) != MP_OKAY) {
15 return mp_div(a, b, a, NULL);