Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
Functions
aead-random.h File Reference

Utilities that help with the generation of random masking material. More...

#include <stdint.h>

Go to the source code of this file.

Functions

void aead_random_init (void)
 Initializes the system random number generator for the generation of masking material.
 
void aead_random_finish (void)
 Finishes using the random number source. More...
 
uint32_t aead_random_generate_32 (void)
 Generates a single random 32-bit word. More...
 
uint64_t aead_random_generate_64 (void)
 Generates a single random 64-bit word. More...
 
void aead_random_generate (void *buffer, unsigned size)
 Generates a number of bytes into a buffer. More...
 
void aead_random_reseed (void)
 Reseeds the random number generator from the system TRNG. More...
 
void aead_random_set_seed (const unsigned char seed[32])
 Restarts the random number generator with a specific 256-bit seed. More...
 

Detailed Description

Utilities that help with the generation of random masking material.

Function Documentation

void aead_random_finish ( void  )

Finishes using the random number source.

If the random API has internal state, then this function will destroy the internal state to protect forward secrecy.

void aead_random_generate ( void *  buffer,
unsigned  size 
)

Generates a number of bytes into a buffer.

Parameters
bufferThe buffer to generate into.
sizeThe number of bytes to be generated.
uint32_t aead_random_generate_32 ( void  )

Generates a single random 32-bit word.

Returns
The random word.
uint64_t aead_random_generate_64 ( void  )

Generates a single random 64-bit word.

Returns
The random word.
void aead_random_reseed ( void  )

Reseeds the random number generator from the system TRNG.

This function does nothing if the random API is using the system TRNG directly.

This function is called implicitly by aead_random_init().

void aead_random_set_seed ( const unsigned char  seed[32])

Restarts the random number generator with a specific 256-bit seed.

Parameters
seedThe seed material.

This function does nothing if the random API is using the system TRNG directly. This function is useful for creating reproducible random numbers for test purposes. It should not be used for real work.