drng_chacha20_init — Initialization of a ChaCha20 DRNG cipher handle


DSO_PUBLIC int drng_chacha20_init (struct chacha20_drng ** drng);



[out] cipher handle allocated by the function


The cipher handle including its memory is allocated with this function.

Before the allocation is performed, a self test regarding the correct operation of the ChaCha20 cipher is performed. Only when the self test succeeds, the allocation operation is performed.

The memory is pinned so that the DRNG state cannot be swapped out to disk.

As part of the allocation, the seed source is initialized.

The state of the DRNG is automatically seeded from the internal noise source. Thus, the caller may immediately generate random numbers without providing (additional) seed.

return 0 upon success; < 0 on error