4 * \brief Platform-specific and custom entropy polling functions
6 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
7 * SPDX-License-Identifier: Apache-2.0
9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 * not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * This file is part of mbed TLS (https://tls.mbed.org)
23 #ifndef MBEDTLS_ENTROPY_POLL_H
24 #define MBEDTLS_ENTROPY_POLL_H
26 #if !defined(MBEDTLS_CONFIG_FILE)
29 #include MBEDTLS_CONFIG_FILE
39 * Default thresholds for built-in sources, in bytes
41 #define MBEDTLS_ENTROPY_MIN_PLATFORM 32 /**< Minimum for platform source */
42 #define MBEDTLS_ENTROPY_MIN_HAVEGE 32 /**< Minimum for HAVEGE */
43 #define MBEDTLS_ENTROPY_MIN_HARDCLOCK 4 /**< Minimum for mbedtls_timing_hardclock() */
44 #define MBEDTLS_ENTROPY_MIN_HARDWARE 32 /**< Minimum for the hardware source */
46 #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
48 * \brief Platform-specific entropy poll callback
50 int mbedtls_platform_entropy_poll( void *data
,
51 unsigned char *output
, size_t len
, size_t *olen
);
54 #if defined(MBEDTLS_HAVEGE_C)
56 * \brief HAVEGE based entropy poll callback
58 * Requires an HAVEGE state as its data pointer.
60 int mbedtls_havege_poll( void *data
,
61 unsigned char *output
, size_t len
, size_t *olen
);
64 #if defined(MBEDTLS_TIMING_C)
66 * \brief mbedtls_timing_hardclock-based entropy poll callback
68 int mbedtls_hardclock_poll( void *data
,
69 unsigned char *output
, size_t len
, size_t *olen
);
72 #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
74 * \brief Entropy poll callback for a hardware source
76 * \warning This is not provided by mbed TLS!
77 * See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h.
79 * \note This must accept NULL as its first argument.
81 int mbedtls_hardware_poll( void *data
,
82 unsigned char *output
, size_t len
, size_t *olen
);
89 #endif /* entropy_poll.h */