mbedtls_mpi_mod_sub() function
Perform a fixed-size modular subtraction. Calculate `A - B modulo N`. \p A, \p B and \p X 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 MPI. Must be initialized. Must have the same number of limbs as the modulus \p N.
A
The address of the first MPI.
B
The address of the second MPI.
N
The address of the modulus. Used to perform a modulo operation on the result of the subtraction.
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().