Merge pull request #578 from PX4/fix_mp_prime_strong_lucas_lefridge_compilation
[libtommath.git] / mp_addmod.c
blob91e2087e5cf5d910461ee78c8bd3a609fd3f31cd
1 #include "tommath_private.h"
2 #ifdef MP_ADDMOD_C
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
6 /* d = a + b (mod c) */
7 mp_err mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d)
9 mp_err err;
10 if ((err = mp_add(a, b, d)) != MP_OKAY) {
11 return err;
13 return mp_mod(d, c, d);
15 #endif