text
[RRG-proxmark3.git] / common / mbedtls / entropy_poll.h
blobeca3b5620cc2291d5adadd0c25d65755499be204
1 /**
2 * \file entropy_poll.h
4 * \brief Platform-specific and custom entropy polling functions
5 */
6 /*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0
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
14 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef MBEDTLS_ENTROPY_POLL_H
23 #define MBEDTLS_ENTROPY_POLL_H
25 #if !defined(MBEDTLS_CONFIG_FILE)
26 #include "mbedtls/config.h"
27 #else
28 #include MBEDTLS_CONFIG_FILE
29 #endif
31 #include <stddef.h>
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
38 * Default thresholds for built-in sources, in bytes
40 #define MBEDTLS_ENTROPY_MIN_PLATFORM 32 /**< Minimum for platform source */
41 #define MBEDTLS_ENTROPY_MIN_HAVEGE 32 /**< Minimum for HAVEGE */
42 #define MBEDTLS_ENTROPY_MIN_HARDCLOCK 4 /**< Minimum for mbedtls_timing_hardclock() */
43 #if !defined(MBEDTLS_ENTROPY_MIN_HARDWARE)
44 #define MBEDTLS_ENTROPY_MIN_HARDWARE 32 /**< Minimum for the hardware source */
45 #endif
47 /**
48 * \brief Entropy poll callback that provides 0 entropy.
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
55 #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
56 /**
57 * \brief Platform-specific entropy poll callback
59 int mbedtls_platform_entropy_poll(void *data,
60 unsigned char *output, size_t len, size_t *olen);
61 #endif
63 #if defined(MBEDTLS_HAVEGE_C)
64 /**
65 * \brief HAVEGE based entropy poll callback
67 * Requires an HAVEGE state as its data pointer.
69 int mbedtls_havege_poll(void *data,
70 unsigned char *output, size_t len, size_t *olen);
71 #endif
73 #if defined(MBEDTLS_TIMING_C)
74 /**
75 * \brief mbedtls_timing_hardclock-based entropy poll callback
77 int mbedtls_hardclock_poll(void *data,
78 unsigned char *output, size_t len, size_t *olen);
79 #endif
81 #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
82 /**
83 * \brief Entropy poll callback for a hardware source
85 * \warning This is not provided by mbed TLS!
86 * See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h.
88 * \note This must accept NULL as its first argument.
90 int mbedtls_hardware_poll(void *data,
91 unsigned char *output, size_t len, size_t *olen);
92 #endif
94 #if defined(MBEDTLS_ENTROPY_NV_SEED)
95 /**
96 * \brief Entropy poll callback for a non-volatile seed file
98 * \note This must accept NULL as its first argument.
100 int mbedtls_nv_seed_poll(void *data,
101 unsigned char *output, size_t len, size_t *olen);
102 #endif
104 #ifdef __cplusplus
106 #endif
108 #endif /* entropy_poll.h */