Get a specified number of bits from the entropy source.
It retrives buffer_size
bytes of data from the entropy source. The entropy source will always fill the provided buffer to its full size, however, most entropy sources have biases, and the actual amount of entropy contained in the buffer will be less than the number of bytes. The driver will return the actual number of bytes of entropy placed in the buffer in p_received_entropy_bytes
. A PSA Crypto API implementation will likely feed the output of this function into a Digital Random Bit Generator (DRBG), and typically has a minimum amount of entropy that it needs. To accomplish this, the PSA Crypto implementation should be designed to call this function multiple times until it has received the required amount of entropy from the entropy source.
- Parameters
-
[in,out] | p_context | A hardware-specific structure containing any context information for the implementation |
[out] | p_buffer | A caller-allocated buffer for the retrieved entropy to be placed in |
[in] | buffer_size | The allocated size of p_buffer |
[out] | p_received_entropy_bits | The amount of entropy (in bits) actually provided in p_buffer |
- Return values
-
Definition at line 81 of file crypto_entropy_driver.h.