nRF52 hardware random number generator (RNG) APIs.
More...
|
uint32_t | RngInit (void) |
| Function for initializing the nrf_drv_rng module. More...
|
|
void | RngDeinit (void) |
| Function for deinitializing the nrf_drv_rng module.
|
|
uint32_t | RngBytesAvailable (uint8_t *bytes_available) |
| Function for getting the number of currently available random bytes. More...
|
|
uint32_t | RngPoolCapacity (uint8_t *pool_capacity) |
| Function for querying the capacity of the application random pool. More...
|
|
uint32_t | RngRand (uint8_t *buffer, uint8_t length) |
| Function for getting the vector of random numbers. More...
|
|
uint32_t | RngBlockRand (uint8_t *buffer, uint32_t length) |
| Blocking function for getting an arbitrary array of random numbers. More...
|
|
nRF52 hardware random number generator (RNG) APIs.
uint32_t RngInit |
( |
void |
| ) |
|
Function for initializing the nrf_drv_rng module.
- Return values
-
NRF_SUCCESS | Driver was successfully initialized. |
NRF_ERROR_INVALID_STATE | Driver was already initialized. |
NRF_ERROR_INVALID_LENGTH | Pool size have to be a power of 2. |
NRF_ERROR_SOFTDEVICE_NOT_ENABLED | SoftDevice is present, but not enabled. |
uint32_t RngBytesAvailable |
( |
uint8_t * |
bytes_available | ) |
|
Function for getting the number of currently available random bytes.
- Parameters
-
[out] | bytes_available | The number of bytes currently available in the pool. |
- Return values
-
NRF_SUCCESS | If the number of available random bytes was written to bytes_available. |
uint32_t RngPoolCapacity |
( |
uint8_t * |
pool_capacity | ) |
|
Function for querying the capacity of the application random pool.
- Parameters
-
[out] | pool_capacity | The capacity of the pool. |
- Return values
-
NRF_SUCCESS | If the capacity of the pool was written to pool_capacity. |
uint32_t RngRand |
( |
uint8_t * |
buffer, |
|
|
uint8_t |
length |
|
) |
| |
Function for getting the vector of random numbers.
- Parameters
-
[out] | buffer | Pointer to uint8_t buffer for storing the bytes. |
[in] | length | Number of bytes to take from the pool and place in buffer. |
- Return values
-
NRF_SUCCESS | If the requested bytes were written to buffer. |
NRF_ERROR_NO_MEM | If no bytes were written to the buffer |
NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES | If no bytes were written to the buffer |
uint32_t RngBlockRand |
( |
uint8_t * |
buffer, |
|
|
uint32_t |
length |
|
) |
| |
Blocking function for getting an arbitrary array of random numbers.
- Note
- This function may execute for a substantial amount of time depending on the length of the buffer required and on the state of the current internal pool of random numbers.
- Parameters
-
[out] | buffer | Pointer to buffer for storing the bytes. |
[in] | length | Number of bytes place in buffer. |
- Return values
-
NRF_SUCCESS | If the requested bytes were written to buffer. |