BearSSL
|
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... | |
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".
size_t br_prng_class::context_size |
Size (in bytes) of the context structure appropriate for running this PRNG.
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.
ctx | PRNG context. |
out | output buffer. |
len | number of pseudorandom bytes to produce. |
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.
ctx | PRNG context to initialise. |
params | extra parameters for the PRNG. |
seed | initial seed. |
seed_len | initial seed length (in bytes). |
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.
ctx | PRNG context. |
seed | additional seed. |
seed_len | additional seed length (in bytes). |