mbedtls_mpi_core_fill_random() function
Fill an integer with a number of random bytes.
Arguments
X_limbs
The number of limbs of \p X.
bytes
The number of random bytes to generate.
f_rng
The RNG function to use. This must not be \c NULL.
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 value
\c 0 if successful. #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p X does not have enough room for \p bytes bytes. A negative error code on RNG failure.
Notes
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.
![]()
int mbedtls_mpi_core_fill_random(
mbedtls_mpi_core_fill_random() is called by 2 functions and calls 2 functions:
![]()
mbedtls_mpi_core_fill_random()
mbedtls_mpi_core_fill_random():
![]()
mbedtls_mpi_core_fill_random()