ASCON Suite
Macros | Functions
ascon-trng-none.c File Reference
#include "ascon-trng.h"
#include <ascon/utility.h>
#include <string.h>

Go to the source code of this file.

Macros

#define THREAD_LOCAL
 

Functions

int ascon_trng_get_bytes (unsigned char *out, size_t outlen)
 Escape hatch that allows applications to provide their own interface to the system TRNG when the library does not know how to generate random bytes on its own. More...
 
int ascon_trng_generate (unsigned char *out, size_t outlen)
 Generates a buffer of bytes from the system TRNG source. More...
 

Macro Definition Documentation

◆ THREAD_LOCAL

#define THREAD_LOCAL

Definition at line 73 of file ascon-trng-none.c.

Function Documentation

◆ ascon_trng_generate()

int ascon_trng_generate ( unsigned char *  out,
size_t  outlen 
)

Generates a buffer of bytes from the system TRNG source.

Parameters
outOutput buffer to be filled with random bytes.
outlenLength of the output buffer in bytes.
Returns
Non-zero if the system random number source is working; zero if there is no system random number source or it has failed.

This function should try to generate high quality random data even if it is a little slower.

Definition at line 192 of file ascon-trng-none.c.

◆ ascon_trng_get_bytes()

int ascon_trng_get_bytes ( unsigned char *  out,
size_t  outlen 
)

Escape hatch that allows applications to provide their own interface to the system TRNG when the library does not know how to generate random bytes on its own.

Parameters
outBuffer to fill with random bytes.
outlenNumber of bytes to provide.
Returns
Non-zero if the application provided the bytes or zero if the application does not know how to generate random bytes.

Definition at line 60 of file ascon-trng-none.c.