Function esp_idf_hal::sys::mbedtls_mpi_gen_prime
source · pub unsafe extern "C" fn mbedtls_mpi_gen_prime(
X: *mut mbedtls_mpi,
nbits: usize,
flags: i32,
f_rng: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize) -> i32>,
p_rng: *mut c_void,
) -> i32
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.