mbedtls_mpi_mod_residue_setup() function
Setup a residue structure. The residue will be set up with the buffer \p p and modulus \p N. The memory pointed to by \p p will be used by the resulting residue structure. The value at the pointed-to memory will be the initial value of \p r and must hold a value that is less than the modulus. This value will be used as-is and interpreted according to the value of the `N->int_rep` field. The modulus \p N will be the modulus associated with \p r. The residue \p r should only be used in operations where the modulus is \p N.
Arguments
r
The address of the residue to setup.
N
The address of the modulus related to \p r.
p
The address of the limb array containing the value of \p r. The memory pointed to by \p p will be used by \p r and must not be modified in any way until after mbedtls_mpi_mod_residue_release() is called. The data pointed to by \p p must be less than the modulus (the value pointed to by `N->p`) and already in the representation indicated by `N->int_rep`.
p_limbs
The number of limbs of \p p. Must be the same as the number of limbs in the modulus \p N.
Return value
\c 0 if successful. #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p p_limbs is less than the limbs in \p N or if \p p is not less than \p N.