Trident IoT Z-Wave SDK
Loading...
Searching...
No Matches
Zpal-entropy

Defines a platform abstraction layer for the Z-Wave random number generation. More...

Collaboration diagram for Zpal-entropy:

Functions

void zpal_entropy_init (void)
 Initialize entropy module.
zpal_status_t zpal_get_random_data (uint8_t *data, size_t len)
 Generate true random array of bytes based on the given length and fill a data buffer. Note that this function may shut down the radio while getting the data.
uint8_t zpal_get_pseudo_random (void)
 Returns a pseudo random byte.

Detailed Description

Defines a platform abstraction layer for the Z-Wave random number generation.

How to use the entropy API:

All the ZPAL entropy APIs are required to be implemented.

The following outlines an example of use:

  1. Initialize module with zpal_entropy_init().
  2. Invoke zpal_get_random_data() or zpal_get_pseudo_random() to get generated data.

Requirements:

  • zpal_get_random_data() generates random data from entropy sources available on platform. Since collecting entropy from hardware may take some time, Z-Wave SDK shall invoke it only once during initialization of PRNG.
  • zpal_get_pseudo_random() is used for non-security related operations such as generating session IDs or calculating delays. Therefore, the execution speed is highly preferred over true randomness of the output.

Function Documentation

◆ zpal_entropy_init()

void zpal_entropy_init ( void )

Initialize entropy module.

◆ zpal_get_pseudo_random()

uint8_t zpal_get_pseudo_random ( void )

Returns a pseudo random byte.

Returns
Pseudo random byte.

◆ zpal_get_random_data()

zpal_status_t zpal_get_random_data ( uint8_t * data,
size_t len )

Generate true random array of bytes based on the given length and fill a data buffer. Note that this function may shut down the radio while getting the data.

Parameters
[out]dataA pointer to where the random array of bytes are stored in data buffer. It MUST NOT be NULL.
[in]lenThe requested size of the random array of bytes that shall be stored in the data buffer.
Returns
ZPAL_STATUS_OK if the random array of bytes are generated and stored in the data buffer. ZPAL_STATUS_OK if the random array of bytes are not generated.