Cleanup armsrc/string.c and string.h (#964)
[legacy-proxmark3.git] / common / mbedtls / entropy_poll.h
blobd48b8555bac2e672189be12dc2fba28ca69e69e9
1 /**
2 * \file entropy_poll.h
4 * \brief Platform-specific and custom entropy polling functions
5 */
6 /*
7 * Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
8 * SPDX-License-Identifier: GPL-2.0
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * This file is part of mbed TLS (https://tls.mbed.org)
26 #ifndef MBEDTLS_ENTROPY_POLL_H
27 #define MBEDTLS_ENTROPY_POLL_H
29 #if !defined(MBEDTLS_CONFIG_FILE)
30 #include "config.h"
31 #else
32 #include MBEDTLS_CONFIG_FILE
33 #endif
35 #include <stddef.h>
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
42 * Default thresholds for built-in sources, in bytes
44 #define MBEDTLS_ENTROPY_MIN_PLATFORM 32 /**< Minimum for platform source */
45 #define MBEDTLS_ENTROPY_MIN_HAVEGE 32 /**< Minimum for HAVEGE */
46 #define MBEDTLS_ENTROPY_MIN_HARDCLOCK 4 /**< Minimum for mbedtls_timing_hardclock() */
47 #if !defined(MBEDTLS_ENTROPY_MIN_HARDWARE)
48 #define MBEDTLS_ENTROPY_MIN_HARDWARE 32 /**< Minimum for the hardware source */
49 #endif
51 /**
52 * \brief Entropy poll callback that provides 0 entropy.
54 #if defined(MBEDTLS_TEST_NULL_ENTROPY)
55 int mbedtls_null_entropy_poll( void *data,
56 unsigned char *output, size_t len, size_t *olen );
57 #endif
59 #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
60 /**
61 * \brief Platform-specific entropy poll callback
63 int mbedtls_platform_entropy_poll( void *data,
64 unsigned char *output, size_t len, size_t *olen );
65 #endif
67 #if defined(MBEDTLS_HAVEGE_C)
68 /**
69 * \brief HAVEGE based entropy poll callback
71 * Requires an HAVEGE state as its data pointer.
73 int mbedtls_havege_poll( void *data,
74 unsigned char *output, size_t len, size_t *olen );
75 #endif
77 #if defined(MBEDTLS_TIMING_C)
78 /**
79 * \brief mbedtls_timing_hardclock-based entropy poll callback
81 int mbedtls_hardclock_poll( void *data,
82 unsigned char *output, size_t len, size_t *olen );
83 #endif
85 #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
86 /**
87 * \brief Entropy poll callback for a hardware source
89 * \warning This is not provided by mbed TLS!
90 * See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h.
92 * \note This must accept NULL as its first argument.
94 int mbedtls_hardware_poll( void *data,
95 unsigned char *output, size_t len, size_t *olen );
96 #endif
98 #if defined(MBEDTLS_ENTROPY_NV_SEED)
99 /**
100 * \brief Entropy poll callback for a non-volatile seed file
102 * \note This must accept NULL as its first argument.
104 int mbedtls_nv_seed_poll( void *data,
105 unsigned char *output, size_t len, size_t *olen );
106 #endif
108 #ifdef __cplusplus
110 #endif
112 #endif /* entropy_poll.h */