File psa_util.h
Utility functions for the use of the PSA Crypto library.
Defines
-
MBEDTLS_PSA_RANDOM_STATE
The random generator function for the PSA subsystem.
This function is suitable as the
f_rngrandom generator function parameter of manymbedtls_xxxfunctions.The implementation of this function depends on the configuration of the library.
/** The random generator state for the PSA subsystem.
This macro always expands to NULL because the
p_rngparameter is unused in mbedtls_psa_get_random(), but it’s kept for interface’s backward compatibility.Note
This function may only be used if the PSA crypto subsystem is active. This means that you must call psa_crypto_init() before any call to this function, and you must not call this function after calling mbedtls_psa_crypto_free().
- Parameters:
p_rng – This parameter is only kept for backward compatibility reasons with legacy
f_rngfunctions and it’s ignored. Set to MBEDTLS_PSA_RANDOM_STATE or NULL.output – The buffer to fill. It must have room for
output_sizebytes.output_size – The number of bytes to write to
output. This function may fail ifoutput_sizeis too large. It is guaranteed to accept any output size requested by Mbed TLS library functions. The maximum request size depends on the library configuration.
- Returns:
0on success.- Returns:
An
MBEDTLS_ERR_ENTROPY_xxx,MBEDTLS_ERR_PLATFORM_xxx,MBEDTLS_ERR_CTR_DRBG_xxxorMBEDTLS_ERR_HMAC_DRBG_xxx` on error. */ int mbedtls_psa_get_random(void *p_rng,
unsigned char *output,
size_t output_size);