Loading...
Searching...
No Matches
ADC Noise Entropy Source

Entropy Source based on LSB of ADC samples. More...

Detailed Description

Entropy Source based on LSB of ADC samples.

This module provides entropy from ADC samples. Thereby, only the LSB is considered for generation of output values. The available resolution as well as internal sampling rates, specific driver settings and device inaccuracies may lead to different behavior between different platforms. The configured ADC pin might be unconnected and floating, it can be exposed as an I/O pin or internally connected to a thermal noise source, an avalanche diode circuit or the receive path of an antenna. The possibilities are manifold, thus, configuration and deployment properties of this module need to be thoroughly validated.

Note
It is worth noting that ADC pins are typically vulnerable when physically accessible. Developers should consider additional tamper detection concepts and enclosures.

Files

file  adc_noise.h
 

Functions

int entropy_source_adc_init (void)
 Initialize ADC and test structures, if tests are enabled.
 
int entropy_source_adc_get (uint8_t *buf, size_t len)
 Generates bytes from ADC noise.
 
static uint32_t entropy_source_adc_entropy_per_sample (void)
 Static entropy per sample value for this source [bit/sample * 2^16].
 
#define CONFIG_ENTROPY_SOURCE_ADC_LINE   ADC_LINE(0)
 ADC line default configuration.
 
#define CONFIG_ENTROPY_SOURCE_ADC_HMIN   (0)
 ADC estimated entropy per sample [2^16 * bit/sample].
 
#define CONFIG_ENTROPY_SOURCE_ADC_HEALTH_TEST   0
 Disable ADC health test by default.
 
#define CONFIG_ENTROPY_SOURCE_ADC_COND   0
 Disable ADC conditioning test by default.
 

Macro Definition Documentation

◆ CONFIG_ENTROPY_SOURCE_ADC_COND

#define CONFIG_ENTROPY_SOURCE_ADC_COND   0

Disable ADC conditioning test by default.

Definition at line 113 of file adc_noise.h.

◆ CONFIG_ENTROPY_SOURCE_ADC_HEALTH_TEST

#define CONFIG_ENTROPY_SOURCE_ADC_HEALTH_TEST   0

Disable ADC health test by default.

Definition at line 108 of file adc_noise.h.

◆ CONFIG_ENTROPY_SOURCE_ADC_HMIN

#define CONFIG_ENTROPY_SOURCE_ADC_HMIN   (0)

ADC estimated entropy per sample [2^16 * bit/sample].

The entropy value needs to be estimated and evaluated thoroughly beforehand deployment! To avoid float, the actual entropy value per one byte sample needs to be manually multiplied by 2^16 before before configuring it (e.g., to an entropy value of 1 bit/sample, a value of 1 * 65536 needs to be set) . We default to zero which is an invalid configuration to enforce a thoughtful investigation on the actual entropy properties. See Entropy Sources for further information about entropy source validation. H_min=0 bit/sample * 2^16 is invalid and needs to set manually!

Definition at line 102 of file adc_noise.h.

◆ CONFIG_ENTROPY_SOURCE_ADC_LINE

#define CONFIG_ENTROPY_SOURCE_ADC_LINE   ADC_LINE(0)

ADC line default configuration.

The ADC line maps to an I/O pin. This number acts as index to an array of predefined ADC devices that contain the pin definition. Typically, the array is defined by a board in a periph_conf.h file. Please note that a board is not required to specify a minimum number of lines.

Definition at line 81 of file adc_noise.h.

Function Documentation

◆ entropy_source_adc_entropy_per_sample()

static uint32_t entropy_source_adc_entropy_per_sample ( void  )
inlinestatic

Static entropy per sample value for this source [bit/sample * 2^16].

Returns
entropy per sample

Definition at line 148 of file adc_noise.h.

◆ entropy_source_adc_get()

int entropy_source_adc_get ( uint8_t *  buf,
size_t  len 
)

Generates bytes from ADC noise.

Parameters
[out]bufpointer to write noisy bytes to
[in]lennumber of bytes to generate
Returns
ENTROPY_SOURCE_OK on success
negative entropy_source_error_t code on error

◆ entropy_source_adc_init()

int entropy_source_adc_init ( void  )

Initialize ADC and test structures, if tests are enabled.

Returns
ENTROPY_SOURCE_OK on success
ENTROPY_SOURCE_ERR_INIT on ADC initialization failure