mbedtls_mpi_mod_add() function
Perform a fixed-size modular addition. Calculate `A + B modulo N`. \p A, \p B and \p X must all be associated with the modulus \p N and must all have the same number of limbs as \p N. \p X may be aliased to \p A or \p B, or even both, but may not overlap either otherwise.
Arguments
X
The address of the result residue. Must be initialized. Must have the same number of limbs as the modulus \p N.
A
The address of the first input residue.
B
The address of the second input residue.
N
The address of the modulus. Used to perform a modulo operation on the result of the addition.
Return value
\c 0 if successful. #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if the given MPIs do not have the correct number of limbs.
Notes
This function does not check that \p A or \p B are in canonical form (that is, are < \p N) - that will have been done by mbedtls_mpi_mod_residue_setup().