Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
|
Utility functions for generating random data. More...
Functions | |
void | RAND_GetBytes (uint16_t aNumBytes, void *aBytesOut) |
Get random data for non-cryptographic purposes. More... | |
void | RAND_Seed (uint64_t aSeed) |
Seed the non-cryptographic Pseudo Random Number Generator. More... | |
void | RAND_SeedFromDev (struct ca821x_dev *pDeviceRef) |
Seed the non-cryptographic Pseudo Random Number Generator using entropy from the ca821x. More... | |
ca_error | RAND_GetCryptoBytes (uint16_t aNumBytes, void *aBytesOut) |
Get random data for cryptographic purposes. More... | |
void | RAND_AddRadioEntropySource (void) |
Add the radio-based RNG as an entropy source used by mbedTLS. More... | |
Utility functions for generating random data.
void RAND_AddRadioEntropySource | ( | void | ) |
Add the radio-based RNG as an entropy source used by mbedTLS.
void RAND_GetBytes | ( | uint16_t | aNumBytes, |
void * | aBytesOut | ||
) |
Get random data for non-cryptographic purposes.
This function will never fail.
Depending on the platform this may be from a PRNG. Will fill memory starting from address aBytesOut with aNumBytes of pseudorandom random data. This data will be uniformly distributed, but not suitable for cryptographic purposes as the sequence can be predicted.
aNumBytes | The number of bytes to fill with random data | |
[out] | aBytesOut | The start address to fill with random data |
ca_error RAND_GetCryptoBytes | ( | uint16_t | aNumBytes, |
void * | aBytesOut | ||
) |
Get random data for cryptographic purposes.
This function will use a CPRNG, and be suitable for cryptographic purposes. Will fill memory starting from address aBytesOut with aNumBytes of random data. Upon an error, the output memory will be left in an indeterminate state and should not be relied upon to be random data, or be in its previous state.
aNumBytes | The number of bytes to fill with random data | |
[out] | aBytesOut | The start address to fill with random data |
CA_ERROR_SUCCESS | Success, aBytesOut is filled with aNumBytes of random data. |
CA_ERROR_FAIL | Request failed, aBytesOut is indeterminate |
void RAND_Seed | ( | uint64_t | aSeed | ) |
Seed the non-cryptographic Pseudo Random Number Generator.
It is required to call either this or RAND_SeedFromDev before using RAND_GetBytes or the sequence will be the same for different devices. This is handled within the initialisation functions for each platform.
aSeed | A seed for the PRNG. Should be unique, such as a random number or Unix time. |
void RAND_SeedFromDev | ( | struct ca821x_dev * | pDeviceRef | ) |
Seed the non-cryptographic Pseudo Random Number Generator using entropy from the ca821x.
It is required to call either this or RAND_Seed before using RAND_GetBytes or the sequence will be the same for different devices. This is handled within the initialisation functions for each platform.
pDeviceRef | The CA821x device to use to source the entropy |