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

PAL DRBG. This file contains the real-time OS APIs and is a part of the PAL service API. More...

#include <stdint.h>
#include "pal.h"

Go to the source code of this file.

Functions

palStatus_t pal_osRandomBuffer (uint8_t *randomBuf, size_t bufSizeBytes)
 Generate random number into given buffer with given size in bytes. More...
 
palStatus_t pal_osRandom32bit (uint32_t *randomInt)
 Generate a 32-bit random number. More...
 

Detailed Description

PAL DRBG. This file contains the real-time OS APIs and is a part of the PAL service API.

It provides thread, timers, semaphores, mutexes and memory pool management APIs as well as random API.

Function Documentation

palStatus_t pal_osRandom32bit ( uint32_t *  randomInt)

Generate a 32-bit random number.

Parameters
[out]randomIntA 32-bit buffer to hold the generated number.
Note
pal_init() MUST be called before this function.
If non-volatile entropy is expected, the entropy must be in storage when this function is called. Non-volatile entropy may be injected using pal_plat_osEntropyInject().
Returns
PAL_SUCCESS on success, a negative value indicating a specific error code in case of failure.
palStatus_t pal_osRandomBuffer ( uint8_t *  randomBuf,
size_t  bufSizeBytes 
)

Generate random number into given buffer with given size in bytes.

Parameters
[out]randomBufA buffer to hold the generated number.
[in]bufSizeBytesThe size of the buffer and the size of the required random number to generate.
Note
pal_init() MUST be called before this function.
If non-volatile entropy is expected, the entropy must have been injected before this function is called. If entropy has not been injected to non-volatile memory, us pal_plat_osEntropyInject().
Returns
PAL_SUCCESS on success, a negative value indicating a specific error code in case of failure.