Function esp_idf_sys::mbedtls_mpi_gen_prime

source ·
pub unsafe extern "C" fn mbedtls_mpi_gen_prime(
    X: *mut mbedtls_mpi,
    nbits: usize,
    flags: 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 Generate a prime number.

\param X The destination MPI to store the generated prime in. This must point to an initialized MPi. \param nbits The required size of the destination MPI in bits. This must be between \c 3 and #MBEDTLS_MPI_MAX_BITS. \param flags A mask of flags of type #mbedtls_mpi_gen_prime_flag_t. \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, in which case \p X holds a probably prime number. \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed. \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if nbits is not between \c 3 and #MBEDTLS_MPI_MAX_BITS.