pub unsafe extern "C" fn mbedtls_mpi_is_prime_ext(
    X: *const mbedtls_mpi,
    rounds: c_int,
    f_rng: Option<unsafe extern "C" fn(arg1: *mut c_void, arg2: *mut c_uchar, arg3: usize) -> c_int>,
    p_rng: *mut c_void
) -> c_int
Expand description

\brief Miller-Rabin primality test.

\warning If \p X is potentially generated by an adversary, for example when validating cryptographic parameters that you didn’t generate yourself and that are supposed to be prime, then \p rounds should be at least the half of the security strength of the cryptographic algorithm. On the other hand, if \p X is chosen uniformly or non-adversarially (as is the case when mbedtls_mpi_gen_prime calls this function), then \p rounds can be much lower.

\param X The MPI to check for primality. This must point to an initialized MPI. \param rounds The number of bases to perform the Miller-Rabin primality test for. The probability of returning 0 on a composite is at most 2-2*\p rounds . \param f_rng The RNG function to use. This must not be \c NULL. \param p_rng The RNG parameter to be passed to \p f_rng. This may be \c NULL if \p f_rng doesn’t use a context parameter.

\return \c 0 if successful, i.e. \p X is probably prime. \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed. \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p X is not prime. \return Another negative error code on other kinds of failure.