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.

Macros

#define ENTROPY_RANDOM_SEED   "B#S9---D"
 

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...
 
palStatus_t storage_kvstore_read (const char *item_name, uint8_t *buffer, size_t buffer_size, size_t *buffer_actual_size_out)
 Direct read from internal KVStore used for entropy injection with non-TRNG. More...
 
palStatus_t storage_kvstore_write (const char *item_name, const uint8_t *buffer, size_t buffer_size)
 Direct write to internal KVstore used for entropy injection with non-TRNG. More...
 

Detailed Description

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

Macro Definition Documentation

#define ENTROPY_RANDOM_SEED   "B#S9---D"

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.
palStatus_t storage_kvstore_read ( const char *  item_name,
uint8_t *  buffer,
size_t  buffer_size,
size_t *  buffer_actual_size_out 
)

Direct read from internal KVStore used for entropy injection with non-TRNG.

Parameters
[out]buffer_actual_size_outSize of data actually read from KVStore.
[in]KVStorekv_key item name to be read.
[in]bufferThe buffer where to read.
[in]buffer_sizeThe size of the buffer given.
palStatus_t storage_kvstore_write ( const char *  item_name,
const uint8_t *  buffer,
size_t  buffer_size 
)

Direct write to internal KVstore used for entropy injection with non-TRNG.

Parameters
[out]buffer_actual_size_outSize of data actually read from KVStore.
[in]KVStorekv_key item name to be read.
[in]bufferThe buffer to be written.
[in]buffer_sizeThe size of the buffer given.