Skip to main content

mbedtls_mpi_inv_mod

Function mbedtls_mpi_inv_mod 

Source
pub unsafe extern "C" fn mbedtls_mpi_inv_mod(
    X: *mut mbedtls_mpi,
    A: *const mbedtls_mpi,
    N: *const mbedtls_mpi,
) -> c_int
Expand description

\brief Compute the modular inverse: X = A^-1 mod N

\param X The destination MPI. This must point to an initialized MPI. The value returned on success will be between [1, N-1]. \param A The MPI to calculate the modular inverse of. This must point to an initialized MPI. This value can be negative, in which case a positive answer will still be returned in \p X. \param N The base of the modular inversion. This must point to an initialized MPI and be greater than one.

\return \c 0 if successful. \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed. \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p N is less than or equal to one. \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p A has no modular inverse with respect to \p N.