drng_chacha20_get — Obtain random numbers
|struct chacha20_drng * drng,|
|uint8_t * outbuf,|
[in] allocated ChaCha20 cipher handle
[out] allocated buffer that is to be filled with random numbers
[in] length of outbuf indicating the size of the random number byte string to be generated
Generate random numbers and fill the buffer provided by the caller.
Before each request of random numbers, a high-resolution time stamp is mixed into the random number generator state.
If the last (re)seeding operation is longer than 600 seconds ago or more than 1GB of random numbers were generated, an automated reseed is performed.
After the generation of random numbers, the internal state of the ChaCha20 DRNG is completely re-created using ChaCha20 to provide enhanced backtracking resistance. I.e. if the state of the DRNG becomes known after generation of random numbers, an attacker cannot deduce the already generated random numbers.
return 0 upon success; < 0 on error