mbedtls_hmac_drbg_random_with_add() function
This function updates an HMAC_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.
Arguments
p_rng
The HMAC_DRBG context. This must be a pointer to a #mbedtls_hmac_drbg_context structure.
output
The buffer to fill.
output_len
The length of the buffer in bytes. This must be at most #MBEDTLS_HMAC_DRBG_MAX_REQUEST.
additional
Additional data to update with. If this is \c NULL, there is no additional data and \p add_len should be \c 0.
add_len
The length of the additional data. This must be at most #MBEDTLS_HMAC_DRBG_MAX_INPUT.
Return value
\c 0 if successful. #MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED if a call to the entropy source failed. #MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG if \p output_len > #MBEDTLS_HMAC_DRBG_MAX_REQUEST. #MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG if \p add_len > #MBEDTLS_HMAC_DRBG_MAX_INPUT.
Notes
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.
mbedtls_hmac_drbg_random_with_add() is called by 1 function and calls 6 functions:
![]()
mbedtls_hmac_drbg_random_with_add()
mbedtls_hmac_drbg_random_with_add() reads 7 variables and writes 1 variable:
![]()
mbedtls_hmac_drbg_random_with_add()