10.10. Other cryptographic services¶
10.10.1. Random number generation¶
psa_generate_random (function)¶
Generate random bytes.
psa_status_t psa_generate_random(uint8_t * output, size_t output_size);
Parameters
outputOutput buffer for the generated data.
output_sizeNumber of bytes to generate and output.
Returns: psa_status_t
PSA_SUCCESSSuccess.
outputcontainsoutput_sizebytes of generated random data.PSA_ERROR_BAD_STATEThe library requires initializing by a call to
psa_crypto_init().PSA_ERROR_NOT_SUPPORTEDPSA_ERROR_INSUFFICIENT_MEMORYPSA_ERROR_COMMUNICATION_FAILUREPSA_ERROR_CORRUPTION_DETECTED
Description
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.
Note
To generate a key, use psa_generate_key() instead.