ASCON Suite
Functions
ascon-random.c File Reference
#include <ascon/random.h>
#include <ascon/utility.h>
#include "random/ascon-trng.h"

Go to the source code of this file.

Functions

int ascon_random (unsigned char *out, size_t outlen)
 Gets a block of random data from the system. More...
 

Function Documentation

◆ ascon_random()

int ascon_random ( unsigned char *  out,
size_t  outlen 
)

Gets a block of random data from the system.

Parameters
outBuffer to fill with the random data.
outlenNumber of bytes of random data to generate.
Returns
Non-zero if the system random number source is working; zero if there is no system random number source or it has failed.

In the case of a zero return, the returned data may be predictable so the application should probably avoid using it.

This function does not directly return the output of the system random number source. It will process the output with ASCON-XOF to remove any watermarks or bias from untrustworthy TRNG's. And it will spread the entropy uniformly throughout the returned data.

This function is suitable for relatively rare events such as the generation of session keys or password salts. If you need a large amount of continuous random data, then use ascon_random_init() instead.

See also
ascon_random_init()

Definition at line 27 of file ascon-random.c.