Mbed OS Reference
Loading...
Searching...
No Matches
entropy_poll.h
Go to the documentation of this file.
1
/**
2
* \file entropy_poll.h
3
*
4
* \brief Platform-specific and custom entropy polling functions
5
*/
6
/*
7
* Copyright The Mbed TLS Contributors
8
* SPDX-License-Identifier: Apache-2.0
9
*
10
* Licensed under the Apache License, Version 2.0 (the "License"); you may
11
* not use this file except in compliance with the License.
12
* You may obtain a copy of the License at
13
*
14
* http://www.apache.org/licenses/LICENSE-2.0
15
*
16
* Unless required by applicable law or agreed to in writing, software
17
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
* See the License for the specific language governing permissions and
20
* limitations under the License.
21
*/
22
#ifndef MBEDTLS_ENTROPY_POLL_H
23
#define MBEDTLS_ENTROPY_POLL_H
24
25
#if !defined(MBEDTLS_CONFIG_FILE)
26
#include "
mbedtls/config.h
"
27
#else
28
#include MBEDTLS_CONFIG_FILE
29
#endif
30
31
#include <stddef.h>
32
33
#ifdef __cplusplus
34
extern
"C"
{
35
#endif
36
37
/**
38
* \addtogroup mbedtls_entropy_module
39
* \{
40
*/
41
42
/*
43
* Default thresholds for built-in sources, in bytes
44
*/
45
#define MBEDTLS_ENTROPY_MIN_PLATFORM 32
/**< Minimum for platform source */
46
#define MBEDTLS_ENTROPY_MIN_HAVEGE 32
/**< Minimum for HAVEGE */
47
#define MBEDTLS_ENTROPY_MIN_HARDCLOCK 4
/**< Minimum for mbedtls_timing_hardclock() */
48
#if !defined(MBEDTLS_ENTROPY_MIN_HARDWARE)
49
#define MBEDTLS_ENTROPY_MIN_HARDWARE 32
/**< Minimum for the hardware source */
50
#endif
51
52
/**
53
* \brief Entropy poll callback that provides 0 entropy.
54
*/
55
#if defined(MBEDTLS_TEST_NULL_ENTROPY)
56
int
mbedtls_null_entropy_poll(
void
*data,
57
unsigned
char
*output,
size_t
len,
size_t
*olen );
58
#endif
59
60
#if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
61
/**
62
* \brief Platform-specific entropy poll callback
63
*/
64
int
mbedtls_platform_entropy_poll
(
void
*data,
65
unsigned
char
*output,
size_t
len,
size_t
*olen );
66
#endif
67
68
#if defined(MBEDTLS_HAVEGE_C)
69
/**
70
* \brief HAVEGE based entropy poll callback
71
*
72
* Requires an HAVEGE state as its data pointer.
73
*/
74
int
mbedtls_havege_poll(
void
*data,
75
unsigned
char
*output,
size_t
len,
size_t
*olen );
76
#endif
77
78
#if defined(MBEDTLS_TIMING_C)
79
/**
80
* \brief mbedtls_timing_hardclock-based entropy poll callback
81
*/
82
int
mbedtls_hardclock_poll(
void
*data,
83
unsigned
char
*output,
size_t
len,
size_t
*olen );
84
#endif
85
86
#if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
87
/**
88
* \brief Entropy poll callback for a hardware source
89
*
90
* \warning This is not provided by mbed TLS!
91
* See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h.
92
*
93
* \note This must accept NULL as its first argument.
94
*/
95
int
mbedtls_hardware_poll(
void
*data,
96
unsigned
char
*output,
size_t
len,
size_t
*olen );
97
#endif
98
99
#if defined(MBEDTLS_ENTROPY_NV_SEED)
100
/**
101
* \brief Entropy poll callback for a non-volatile seed file
102
*
103
* \note This must accept NULL as its first argument.
104
*/
105
int
mbedtls_nv_seed_poll(
void
*data,
106
unsigned
char
*output,
size_t
len,
size_t
*olen );
107
#endif
108
109
/// \}
110
111
#ifdef __cplusplus
112
}
113
#endif
114
115
#endif
/* entropy_poll.h */
config.h
Configuration options (set of defines)
mbedtls_platform_entropy_poll
int mbedtls_platform_entropy_poll(void *data, unsigned char *output, size_t len, size_t *olen)
Entropy poll callback that provides 0 entropy.
connectivity
mbedtls
include
mbedtls
entropy_poll.h
Generated by
1.9.5