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

PAL DRBG - platform. This file contains the real-time OS APIs that need to be implemented in the platform layer. More...

#include "pal.h"

Go to the source code of this file.

Functions

palStatus_t pal_plat_DRBGInit (void)
 Initialize all data structures (semaphores, mutexes, memory pools, message queues) at system initialization. More...
 
palStatus_t pal_plat_DRBGDestroy (void)
 De-initialize thread objects. More...
 
palStatus_t pal_plat_osRandomBuffer (uint8_t *randomBuf, size_t bufSizeBytes, size_t *actualRandomSizeBytes)
 Generate a random number into the given buffer with the given size in bytes. More...
 
palStatus_t pal_plat_osRandomBuffer_blocking (uint8_t *randomBuf, size_t bufSizeBytes)
 Generate random number into given buffer with given size in bytes. More...
 

Detailed Description

PAL DRBG - platform. This file contains the real-time OS APIs that need to be implemented in the platform layer.

Function Documentation

palStatus_t pal_plat_DRBGDestroy ( void  )

De-initialize thread objects.

palStatus_t pal_plat_DRBGInit ( void  )

Initialize all data structures (semaphores, mutexes, memory pools, message queues) at system initialization.

In case of a failure in any of the initializations, the function returns an error and stops the rest of the initializations.

Returns
PAL_SUCCESS(0) in case of success, PAL_ERR_CREATION_FAILED in case of failure.
palStatus_t pal_plat_osRandomBuffer ( uint8_t *  randomBuf,
size_t  bufSizeBytes,
size_t *  actualRandomSizeBytes 
)

Generate a random number into the given buffer with the 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.
[out]actualRandomSizeBytesThe actual size of the written random data to the output buffer.
Returns
PAL_SUCCESS on success. A negative value indicating a specific error code in case of failure.
Note
In case the platform was able to provide random data with non-zero size and less than bufSizeBytesthe function must return PAL_ERR_RTOS_TRNG_PARTIAL_DATA
palStatus_t pal_plat_osRandomBuffer_blocking ( 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. 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.