MPHELL  4.0.0
Typedefs | Enumerations | Functions
mphell-entropy.h File Reference

Declaration of entropy functions. More...

#include <string.h>
#include <math.h>
#include "mphell-errors.h"
Include dependency graph for mphell-entropy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum entropy_source entropy_type
 Define the entropy source.
 

Enumerations

enum  entropy_source { INTEL, DEVURANDOM, DEVRANDOM, ENTROPY_UNSET }
 Define the entropy source. More...
 

Functions

void get_entropy_input (mphell_status ret, uint8_t *data, const entropy_type entropy_src, const uint16_t length)
 Get length bit of entropy from the entropy source selected. More...
 

Detailed Description

Declaration of entropy functions.

Definition in file mphell-entropy.h.

Enumeration Type Documentation

◆ entropy_source

Define the entropy source.

Enumerator
INTEL 

Use the RDSEED instruction, available since Broadwell ("5th-generation Core" of the Intel Core processors)

DEVURANDOM 

Non blocant entropy source, can be of poor quality

DEVRANDOM 

Blocant entropy source, consider installing HAVEGED to increase the entropy throughput

ENTROPY_UNSET 

To use when you provide a RNG which use its own entropy source (ex RANDOM_INTEL or RANDOM_STM32)

Definition at line 38 of file mphell-entropy.h.

Function Documentation

◆ get_entropy_input()

void get_entropy_input ( mphell_status  ret,
uint8_t *  data,
const entropy_type  entropy_src,
const uint16_t  length 
)

Get length bit of entropy from the entropy source selected.

Parameters
retSet to MPHELL_CATASTROPHIC_ERROR_RANDOM if the entropy source is not available, MPHELL_ERROR_RANDOM if no random seed was available, MPHELL_SUCCESS if everything worked !
dataTo store the entropy
entropy_srcTo select the entropy source
lengthLength (in bytes) of data

Definition at line 306 of file mphell-entropy.c.