BeRTOS
Data Structures | Defines | Functions
entropy.h File Reference

Entropy pool generic interface. More...

#include <cfg/compiler.h>
#include <cfg/debug.h>

Go to the source code of this file.

Data Structures

struct  EntropyPool
 Sturct data of entropy pool. More...

Defines

#define CONFIG_ENTROPY_NUM_SOURCES   8
 Maximum number of different sources of entropy available in BeRTOS.

Functions

void entropy_add (EntropyPool *e, int source_idx, const uint8_t *data, size_t len, int entropy)
 Add some data samples containing entropy into the pool.
bool entropy_seeding_ready (EntropyPool *ctx)
 Check if the generator is ready to produce a new seed.
void entropy_make_seed (EntropyPool *ctx, uint8_t *out, size_t len)
 Generate a new seed of the specified length.

Detailed Description

Entropy pool generic interface.

Author:
Giovanni Bajo <rasky@develer.com>

Definition in file entropy.h.


Define Documentation

#define CONFIG_ENTROPY_NUM_SOURCES   8

Maximum number of different sources of entropy available in BeRTOS.

Increasing this value will likely make entropy pools use more RAM for their operations, so it should be kept to the minimum necessary for a given project.

Definition at line 50 of file entropy.h.


Function Documentation

void entropy_add ( EntropyPool e,
int  source_idx,
const uint8_t *  data,
size_t  len,
int  entropy 
) [inline]

Add some data samples containing entropy into the pool.

the samples are in the buffer pointed by data for a total of len bytes. entropy is the number of bits of estimated entropy in the samples. source_idx is the index of the entropy source.

Definition at line 69 of file entropy.h.

void entropy_make_seed ( EntropyPool ctx,
uint8_t *  out,
size_t  len 
) [inline]

Generate a new seed of the specified length.

Note:
This should not be abused to generate a very long seed, since the pool cannot hold lots of entropy.

Definition at line 92 of file entropy.h.