entropy_sources_mbedtls_riot.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
30 typedef struct {
31  mbedtls_entropy_f_source_ptr func;
32  int strong;
36 
48 int riot_add_entropy_src_avail(mbedtls_entropy_context *ctx);
49 
62 int riot_hwrng_poll(void *data, unsigned char *output, size_t len,
63  size_t *olen);
64 
78 int riot_adc_poll(void *data, unsigned char *output, size_t len,
79  size_t *olen);
80 
81 #if !defined(MODULE_MBEDTLS_ENTROPY_SOURCE_HWRNG) && \
82  !defined(MODULE_ENTROPY_SOURCE_ADC_NOISE)
83 #error "You must enable at least one entropy source. Currently supported are \
84  HWRNG and ADC_NOISE"
85 #endif
86 
87 #ifdef __cplusplus
88 }
89 #endif
int riot_hwrng_poll(void *data, unsigned char *output, size_t len, size_t *olen)
Wrapper around RIOTs HWRNG API.
int riot_add_entropy_src_avail(mbedtls_entropy_context *ctx)
Add all available entropy sources to poll.
int riot_adc_poll(void *data, unsigned char *output, size_t len, size_t *olen)
Wrapper around RIOTs ADC entropy API.
Structure containing entropy function and its strength.
mbedtls_entropy_f_source_ptr func
Pointer to entropy callback func.
int strong
Strength of the entropy function (strong=1 for high entropy sources, strong=0 for weak entropy source...