leo hendrickson / Mbed OS example-Ethernet-mbed-Cloud-connect
Embed: (wiki syntax)

« Back to documentation index

pal_plat_drbg.h File Reference

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

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.
palStatus_t pal_plat_DRBGDestroy (void)
 De-initialize thread objects.
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.
palStatus_t pal_plat_osRandomBuffer_blocking (uint8_t *randomBuf, size_t bufSizeBytes)
 Generate random number into given buffer with given size in bytes.

Detailed Description

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

Definition in file pal_plat_drbg.h.


Function Documentation

palStatus_t pal_plat_DRBGDestroy ( void   )

De-initialize thread objects.

Definition at line 55 of file pal_plat_drbg_sotp.c.

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.

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

init CTR DRBG context (entropy and DRBG mbedtls contexts) and noise 2. If not expecting entropy (MBEDTLS_ENTROPY_NV_SEED not defined): 2.a Seed the DRBG 3. If expecting entropy (MBEDTLS_ENTROPY_NV_SEED defined): Do nothing (DRBG will be initialized by pal_plat_osEntropyInject()

Definition at line 37 of file pal_plat_drbg_sotp.c.

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 `bufSizeBytes`the function must return `PAL_ERR_RTOS_TRNG_PARTIAL_DATA`

Definition at line 884 of file FreeRTOS/RTOS/pal_plat_rtos.c.

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.

Definition at line 84 of file pal_plat_drbg_sotp.c.