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 
21 #ifndef ENTROPY_SOURCES_MBEDTLS_RIOT_H
22 #define ENTROPY_SOURCES_MBEDTLS_RIOT_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 typedef struct {
32  mbedtls_entropy_f_source_ptr func;
33  int strong;
37 
49 int riot_add_entropy_src_avail(mbedtls_entropy_context *ctx);
50 
63 int riot_hwrng_poll(void *data, unsigned char *output, size_t len,
64  size_t *olen);
65 
79 int riot_adc_poll(void *data, unsigned char *output, size_t len,
80  size_t *olen);
81 
82 #if !defined(MODULE_MBEDTLS_ENTROPY_SOURCE_HWRNG) && \
83  !defined(MODULE_ENTROPY_SOURCE_ADC_NOISE)
84 #error "You must enable at least one entropy source. Currently supported are \
85  HWRNG and ADC_NOISE"
86 #endif
87 
88 #ifdef __cplusplus
89 }
90 #endif
93 #endif /* ENTROPY_SOURCES_MBEDTLS_RIOT_H */
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...