PAL DRBG - platform. This file contains the real-time OS APIs that need to be implemented in the platform layer.
More...
Go to the source code of this file.
|
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...
|
|
PAL DRBG - platform. This file contains the real-time OS APIs that need to be implemented in the platform layer.
#define ENTROPY_RANDOM_SEED "B#S9---D" |
De-initialize thread objects.
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] | randomBuf | A buffer to hold the generated number. |
[in] | bufSizeBytes | The size of the buffer and the size of the required random number to generate. |
[out] | actualRandomSizeBytes | The 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
bufSizeBytes
the 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] | randomBuf | A buffer to hold the generated number. |
[in] | bufSizeBytes | The 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_out | Size of data actually read from KVStore. |
[in] | KVStore | kv_key item name to be read. |
[in] | buffer | The buffer where to read. |
[in] | buffer_size | The 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_out | Size of data actually read from KVStore. |
[in] | KVStore | kv_key item name to be read. |
[in] | buffer | The buffer to be written. |
[in] | buffer_size | The size of the buffer given. |