BearSSL
Data Fields
br_prng_class Struct Reference

Class type for PRNG implementations. More...

Data Fields

size_t context_size
 Size (in bytes) of the context structure appropriate for running this PRNG. More...
 
void(* init )(const br_prng_class **ctx, const void *params, const void *seed, size_t seed_len)
 Initialisation method. More...
 
void(* generate )(const br_prng_class **ctx, void *out, size_t len)
 Random bytes generation. More...
 
void(* update )(const br_prng_class **ctx, const void *seed, size_t seed_len)
 Inject additional seed bytes. More...
 

Detailed Description

Class type for PRNG implementations.

A br_prng_class instance references the methods implementing a PRNG. Constant instances of this structure are defined for each implemented PRNG. Such instances are also called "vtables".

Field Documentation

◆ context_size

size_t br_prng_class::context_size

Size (in bytes) of the context structure appropriate for running this PRNG.

◆ generate

void(* br_prng_class::generate) (const br_prng_class **ctx, void *out, size_t len)

Random bytes generation.

This method produces len pseudorandom bytes, in the out buffer. The context is updated accordingly.

Parameters
ctxPRNG context.
outoutput buffer.
lennumber of pseudorandom bytes to produce.

◆ init

void(* br_prng_class::init) (const br_prng_class **ctx, const void *params, const void *seed, size_t seed_len)

Initialisation method.

The context to initialise is provided as a pointer to its first field (the vtable pointer); this function sets that first field to a pointer to the vtable.

The extra parameters depend on the implementation; each implementation defines what kind of extra parameters it expects (if any).

Requirements on the initial seed depend on the implemented PRNG.

Parameters
ctxPRNG context to initialise.
paramsextra parameters for the PRNG.
seedinitial seed.
seed_leninitial seed length (in bytes).

◆ update

void(* br_prng_class::update) (const br_prng_class **ctx, const void *seed, size_t seed_len)

Inject additional seed bytes.

The provided seed bytes are added into the PRNG internal entropy pool.

Parameters
ctxPRNG context.
seedadditional seed.
seed_lenadditional seed length (in bytes).

The documentation for this struct was generated from the following file: