Function esp_idf_sys::mbedtls_ctr_drbg_random_with_add

source ยท
pub unsafe extern "C" fn mbedtls_ctr_drbg_random_with_add(
    p_rng: *mut c_void,
    output: *mut c_uchar,
    output_len: usize,
    additional: *const c_uchar,
    add_len: usize,
) -> c_int
Expand description

\brief This function updates a CTR_DRBG instance with additional data and uses it to generate random data.

This function automatically reseeds if the reseed counter is exceeded or prediction resistance is enabled.

\note This function is not thread-safe. It is not safe to call this function if another thread might be concurrently obtaining random numbers from the same context or updating or reseeding the same context.

\param p_rng The CTR_DRBG context. This must be a pointer to a #mbedtls_ctr_drbg_context structure. \param output The buffer to fill. \param output_len The length of the buffer in bytes. \param additional Additional data to update. Can be \c NULL, in which case the additional data is empty regardless of the value of \p add_len. \param add_len The length of the additional data if \p additional is not \c NULL. This must be less than #MBEDTLS_CTR_DRBG_MAX_INPUT and less than #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT - \c entropy_len where \c entropy_len is the entropy length configured for the context.

\return \c 0 on success. \return #MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or #MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG on failure.