Function esp_idf_sys::mbedtls_ctr_drbg_seed

source ยท
pub unsafe extern "C" fn mbedtls_ctr_drbg_seed(
    ctx: *mut mbedtls_ctr_drbg_context,
    f_entropy: Option<unsafe extern "C" fn(arg1: *mut c_void, arg2: *mut c_uchar, arg3: usize) -> c_int>,
    p_entropy: *mut c_void,
    custom: *const c_uchar,
    len: usize,
) -> c_int
Expand description
  • The \p custom string.

\note To achieve the nominal security strength permitted by CTR_DRBG, the entropy length must be: - at least 16 bytes for a 128-bit strength (maximum achievable strength when using AES-128); - at least 32 bytes for a 256-bit strength (maximum achievable strength when using AES-256).

                 In addition, if you do not pass a nonce in \p custom,
                 the sum of the entropy length
                 and the entropy nonce length must be:
                 - at least 24 bytes for a 128-bit strength
                 (maximum achievable strength when using AES-128);
                 - at least 48 bytes for a 256-bit strength
                 (maximum achievable strength when using AES-256).

\param ctx The CTR_DRBG context to seed. It must have been initialized with mbedtls_ctr_drbg_init(). After a successful call to mbedtls_ctr_drbg_seed(), you may not call mbedtls_ctr_drbg_seed() again on the same context unless you call mbedtls_ctr_drbg_free() and mbedtls_ctr_drbg_init() again first. After a failed call to mbedtls_ctr_drbg_seed(), you must call mbedtls_ctr_drbg_free(). \param f_entropy The entropy callback, taking as arguments the \p p_entropy context, the buffer to fill, and the length of the buffer. \p f_entropy is always called with a buffer size less than or equal to the entropy length. \param p_entropy The entropy context to pass to \p f_entropy. \param custom The personalization string. This can be \c NULL, in which case the personalization string is empty regardless of the value of \p len. \param len The length of the personalization string. This must be at most #MBEDTLS_CTR_DRBG_MAX_SEED_INPUT - #MBEDTLS_CTR_DRBG_ENTROPY_LEN.

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