Mistake on this page? Email us
pal_entropy.h File Reference

PAL entropy. This file contains entropy injection and is part of the PAL API. More...

Go to the source code of this file.

Functions

palStatus_t pal_osEntropyInject (const uint8_t *entropyBuf, size_t bufSizeBytes)
 Inject entropy to non-volatile memory, so that the random number generator may use it. More...
 

Detailed Description

PAL entropy. This file contains entropy injection and is part of the PAL API.

Function Documentation

palStatus_t pal_osEntropyInject ( const uint8_t *  entropyBuf,
size_t  bufSizeBytes 
)

Inject entropy to non-volatile memory, so that the random number generator may use it.

In addition to OS functions, the module implementing pal_drbg.h will hold a deterministic random bit generator (DRBG) instance that works with the entropy injected by this function.

Note
This API call must be placed before any function that may attempt to generate a random number, both by the OS or PAL DRBG. After this API call, pal_osRandomBuffer()calls frompal_drbg.h` will succeed.
Parameters
entropyBuf- pointer to buffer containing the entropy.
bufSizeBytes- size of entropyBuf in bytes.
Returns
PAL_SUCCESS - if operation is successful
PAL_ERR_NOT_SUPPORTED - code compiled in a way that does not expect entropy to be injected. TRNG must be available to inject entropy.
PAL_ERR_INVALID_ARGUMENT - bufSizeBytes too small.
PAL_ERR_ENTROPY_EXISTS - Entropy already injected.
PAL_ERR_GENERIC_FAILURE - Another cause of error.