psa_generate_random() function
Generate random bytes. \warning This function **can** fail! Callers MUST check the return status and MUST NOT use the content of the output buffer if the return status is not #PSA_SUCCESS.
Arguments
output
Output buffer for the generated data.
output_size
Number of bytes to generate and output.
Return value
#PSA_SUCCESS \emptydescription #PSA_ERROR_NOT_SUPPORTED \emptydescription #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription #PSA_ERROR_HARDWARE_FAILURE \emptydescription #PSA_ERROR_CORRUPTION_DETECTED \emptydescription #PSA_ERROR_BAD_STATE The library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.
Notes
To generate a key, use psa_generate_key() instead.
psa_generate_random() is called by 1 function and calls 3 functions:
![]()
psa_generate_random()
psa_generate_random() reads 1 variable:
![]()
psa_generate_random()