Function esp_idf_svc::sys::mbedtls_mpi_fill_random

source ·
pub unsafe extern "C" fn mbedtls_mpi_fill_random(
    X: *mut mbedtls_mpi,
    size: usize,
    f_rng: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize) -> i32>,
    p_rng: *mut c_void,
) -> i32
Expand description

\brief Fill an MPI with a number of random bytes.

\param X The destination MPI. This must point to an initialized MPI. \param size The number of random bytes to generate. \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 need a context argument.

\return \c 0 if successful. \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed. \return Another negative error code on failure.

\note The bytes obtained from the RNG are interpreted as a big-endian representation of an MPI; this can be relevant in applications like deterministic ECDSA.