Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

pal_entropy.h File Reference

pal_entropy.h File Reference

PAL entropy. 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.

Detailed Description

PAL entropy.

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

Definition in file pal_entropy.h.


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 from `pal_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.

Definition at line 23 of file pal_entropy.c.