mbedtls_mpi_mod_read() function
Read a residue from a byte buffer. The residue will be automatically converted to the internal representation based on 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 or a modulus equivalent to \p N (in the sense that all their fields or memory pointed by their fields hold the same value).
Arguments
r
The address of the residue. It must have exactly the same number of limbs as the modulus \p N.
N
The address of the modulus.
buf
The input buffer to import from.
buflen
The length in bytes of \p buf.
ext_rep
The endianness of the number in the input buffer.
Return value
\c 0 if successful. #MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL if \p r isn't large enough to hold the value in \p buf. #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p ext_rep is invalid or the value in the buffer is not less than \p N.