Mbed TLS v2.28.5
entropy_poll.h
Go to the documentation of this file.
1 
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  * Default thresholds for built-in sources, in bytes
39  */
40 #define MBEDTLS_ENTROPY_MIN_PLATFORM 32
41 #define MBEDTLS_ENTROPY_MIN_HAVEGE 32
42 #define MBEDTLS_ENTROPY_MIN_HARDCLOCK 4
43 #if !defined(MBEDTLS_ENTROPY_MIN_HARDWARE)
44 #define MBEDTLS_ENTROPY_MIN_HARDWARE 32
45 #endif
46 
50 #if defined(MBEDTLS_TEST_NULL_ENTROPY)
51 int mbedtls_null_entropy_poll(void *data,
52  unsigned char *output, size_t len, size_t *olen);
53 #endif
54 
55 #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
56 
59 int mbedtls_platform_entropy_poll(void *data,
60  unsigned char *output, size_t len, size_t *olen);
61 #endif
62 
63 #if defined(MBEDTLS_HAVEGE_C)
64 
69 int mbedtls_havege_poll(void *data,
70  unsigned char *output, size_t len, size_t *olen);
71 #endif
72 
73 #if defined(MBEDTLS_TIMING_C)
74 
77 int mbedtls_hardclock_poll(void *data,
78  unsigned char *output, size_t len, size_t *olen);
79 #endif
80 
81 #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
82 
90 int mbedtls_hardware_poll(void *data,
91  unsigned char *output, size_t len, size_t *olen);
92 #endif
93 
94 #if defined(MBEDTLS_ENTROPY_NV_SEED)
95 
100 int mbedtls_nv_seed_poll(void *data,
101  unsigned char *output, size_t len, size_t *olen);
102 #endif
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif /* entropy_poll.h */
int mbedtls_platform_entropy_poll(void *data, unsigned char *output, size_t len, size_t *olen)
Entropy poll callback that provides 0 entropy.
int mbedtls_hardclock_poll(void *data, unsigned char *output, size_t len, size_t *olen)
mbedtls_timing_hardclock-based entropy poll callback
Configuration options (set of defines)
int mbedtls_havege_poll(void *data, unsigned char *output, size_t len, size_t *olen)
HAVEGE based entropy poll callback.