nRF5 SDK for Thread and Zigbee v3.2.0
Functions
Random Number Generator

This module includes functions that generates cryptographic random numbers. More...

Functions

otError otRandomCryptoFillBuffer (uint8_t *aBuffer, uint16_t aSize)
 
mbedtls_ctr_drbg_context * otRandomCryptoMbedTlsContextGet (void)
 
uint32_t otRandomNonCryptoGetUint32 (void)
 
uint8_t otRandomNonCryptoGetUint8 (void)
 
uint16_t otRandomNonCryptoGetUint16 (void)
 
uint8_t otRandomNonCryptoGetUint8InRange (uint8_t aMin, uint8_t aMax)
 
uint16_t otRandomNonCryptoGetUint16InRange (uint16_t aMin, uint16_t aMax)
 
uint32_t otRandomNonCryptoGetUint32InRange (uint32_t aMin, uint32_t aMax)
 
void otRandomNonCryptoFillBuffer (uint8_t *aBuffer, uint16_t aSize)
 
uint32_t otRandomNonCryptoAddJitter (uint32_t aValue, uint16_t aJitter)
 

Detailed Description

This module includes functions that generates cryptographic random numbers.

This module includes functions that generates non cryptographic random numbers.

Function Documentation

otError otRandomCryptoFillBuffer ( uint8_t *  aBuffer,
uint16_t  aSize 
)

This function fills a given buffer with cryptographically secure random bytes.

Parameters
[out]aBufferA pointer to a buffer to fill with the random bytes.
[in]aSizeSize of buffer (number of bytes to fill).
mbedtls_ctr_drbg_context* otRandomCryptoMbedTlsContextGet ( void  )

This function returns initialized mbedtls_ctr_drbg_context.

Returns
A pointer to initialized mbedtls_ctr_drbg_context.
uint32_t otRandomNonCryptoAddJitter ( uint32_t  aValue,
uint16_t  aJitter 
)

This function adds a random jitter within a given range to a given value.

Parameters
[in]aValueA value to which the random jitter is added.
[in]aJitterMaximum jitter. Random jitter is selected from the range [-aJitter, aJitter].
Returns
The given value with an added random jitter.
void otRandomNonCryptoFillBuffer ( uint8_t *  aBuffer,
uint16_t  aSize 
)

This function fills a given buffer with random bytes.

Parameters
[out]aBufferA pointer to a buffer to fill with the random bytes.
[in]aSizeSize of buffer (number of bytes to fill).
uint16_t otRandomNonCryptoGetUint16 ( void  )

This function generates and returns a random uint16_t value.

Returns
A random uint16_t value.
uint16_t otRandomNonCryptoGetUint16InRange ( uint16_t  aMin,
uint16_t  aMax 
)

This function generates and returns a random uint16_t value within a given range [aMin, aMax).

Note
The returned random value can include the aMin value but excludes the aMax.
Parameters
[in]aMinA minimum value (this value can be included in returned random result).
[in]aMaxA maximum value (this value is excluded from returned random result).
Returns
A random uint16_t value in the given range (i.e., aMin <= random value < aMax).
uint32_t otRandomNonCryptoGetUint32 ( void  )

This function generates and returns a random uint32_t value.

Returns
A random uint32_t value.
uint32_t otRandomNonCryptoGetUint32InRange ( uint32_t  aMin,
uint32_t  aMax 
)

This function generates and returns a random uint32_t value within a given range [aMin, aMax).

Note
The returned random value can include the aMin value but excludes the aMax.
Parameters
[in]aMinA minimum value (this value can be included in returned random result).
[in]aMaxA maximum value (this value is excluded from returned random result).
Returns
A random uint32_t value in the given range (i.e., aMin <= random value < aMax).
uint8_t otRandomNonCryptoGetUint8 ( void  )

This function generates and returns a random byte.

Returns
A random uint8_t value.
uint8_t otRandomNonCryptoGetUint8InRange ( uint8_t  aMin,
uint8_t  aMax 
)

This function generates and returns a random uint8_t value within a given range [aMin, aMax).

Parameters
[in]aMinA minimum value (this value can be included in returned random result).
[in]aMaxA maximum value (this value is excluded from returned random result).
Returns
A random uint8_t value in the given range (i.e., aMin <= random value < aMax).

Documentation feedback | Developer Zone | Subscribe | Updated