69 #define ENTROPY_SOURCE_HMIN_SCALE(x)    ((x * (1UL << 16))) 
   75 #define ENTROPY_SOURCE_HMIN_SCALE_BACK(x)    ((float)x / (1UL << 16)) 
   92 #ifndef CONFIG_ENTROPY_SOURCE_TESTS_WIN 
   93 #define CONFIG_ENTROPY_SOURCE_TESTS_WIN     (512) 
  102 #ifndef CONFIG_ENTROPY_SOURCE_NEUMANN_ABORT 
  103 #define CONFIG_ENTROPY_SOURCE_NEUMANN_ABORT (5) 
  140                                   uint8_t *out, 
size_t len);
 
  162     return (1 + ((20 * 65536) / entropy_per_sample));
 
  180     if (entropy_per_sample < 49152UL) {        
 
  183     else if (entropy_per_sample < 98304UL) {   
 
  186     else if (entropy_per_sample < 196608UL) {   
 
  189     else if (entropy_per_sample < 393216UL) {   
 
  192     else if (entropy_per_sample <= 524288UL) {  
 
  216     state->
c_rep = c_rep;
 
POSIX.1-2008 compliant version of the assert macro.
 
#define assert(cond)
abort the program if assertion is false
 
static void entropy_source_test_prop_init(entropy_source_tests_prop_t *state, uint16_t c_prop)
Initialize structure for Adaptive Proportion Test.
 
static uint32_t entropy_source_test_rep_cutoff(uint32_t entropy_per_sample)
Calculate cutoff value for Repetition Count Test (NIST SP 800-90B 4.4.1)
 
entropy_source_error_t
Entropy source error codes.
 
int entropy_source_test_rep(entropy_source_tests_rep_t *state, uint8_t sample)
Performs Repetition Count Test (NIST SP 800-90B 4.4.1).
 
static int entropy_source_test(entropy_source_tests_rep_t *state_rep, entropy_source_tests_prop_t *state_prop, uint8_t sample)
Convenience function to perform entropy_source_test_rep and entropy_source_test_prop.
 
int entropy_source_test_prop(entropy_source_tests_prop_t *state, uint8_t sample)
Performs Adaptive Proportion Test (NIST SP 800-90B 4.4.2).
 
int(* entropy_source_sample_func_t)(uint8_t *sample)
Get one sample of the entropy source.
 
int entropy_source_neumann_unbias(entropy_source_sample_func_t func, uint8_t *out, size_t len)
Applies von Neumann unbiasing.
 
static int entropy_source_test_prop_cutoff(uint32_t entropy_per_sample)
Calculate cutoff value for Adaptive Proportion Test (NIST SP 800-90B 4.4.2)
 
static void entropy_source_test_rep_init(entropy_source_tests_rep_t *state, uint16_t c_rep)
Initialize structure for Repetition Count Test.
 
@ ENTROPY_SOURCE_ERR_COND
Conditioning error.
 
@ ENTROPY_SOURCE_ERR_CONFIG
Source configuration error.
 
@ ENTROPY_SOURCE_ERR_TEST_BOTH
Repetition count and Adaptive proportion test error.
 
@ ENTROPY_SOURCE_ERR_TEST_PROP
Adaptive proportion test error.
 
@ ENTROPY_SOURCE_ERR_TEST_REP
Repetition count test error.
 
@ ENTROPY_SOURCE_ERR_INIT
Source initialization error.
 
@ ENTROPY_SOURCE_OK
Success.
 
#define CONFIG_ENTROPY_SOURCE_TESTS_WIN
Window size for Adaptive Proportion Test (NIST SP 800-90B 4.4.2).
 
Adds include for missing inttype definitions.
 
Data structure for Adaptive Proportion Test (NIST SP 800-90B 4.4.2).
 
uint16_t cnt_window
Counter to count window size.
 
uint16_t c_prop
Cutoff threshold.
 
uint16_t cnt_prop
Counter to count proportion.
 
uint8_t old_sample
Preceding sample to compare for repetition.
 
Data structure for Repetition Count Test (NIST SP 800-90B 4.4.1).
 
uint16_t cnt_rep
Counter to count repetition.
 
uint8_t old_sample
Preceding sample to compare for repetition.
 
uint8_t c_rep
Cutoff threshold.