Jens Wiklander | 32b3180 | 2023-10-06 16:59:46 +0200 | [diff] [blame] | 1 | /** |
| 2 | * \file entropy_poll.h |
| 3 | * |
| 4 | * \brief Platform-specific and custom entropy polling functions |
| 5 | */ |
| 6 | /* |
| 7 | * Copyright The Mbed TLS Contributors |
Tom Van Eyck | c163317 | 2024-04-09 18:44:13 +0200 | [diff] [blame] | 8 | * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
Jens Wiklander | 32b3180 | 2023-10-06 16:59:46 +0200 | [diff] [blame] | 9 | */ |
| 10 | #ifndef MBEDTLS_ENTROPY_POLL_H |
| 11 | #define MBEDTLS_ENTROPY_POLL_H |
| 12 | |
| 13 | #include "mbedtls/build_info.h" |
| 14 | |
| 15 | #include <stddef.h> |
| 16 | |
| 17 | #ifdef __cplusplus |
| 18 | extern "C" { |
| 19 | #endif |
| 20 | |
| 21 | /* |
| 22 | * Default thresholds for built-in sources, in bytes |
| 23 | */ |
| 24 | #define MBEDTLS_ENTROPY_MIN_PLATFORM 32 /**< Minimum for platform source */ |
| 25 | #if !defined(MBEDTLS_ENTROPY_MIN_HARDWARE) |
| 26 | #define MBEDTLS_ENTROPY_MIN_HARDWARE 32 /**< Minimum for the hardware source */ |
| 27 | #endif |
| 28 | |
| 29 | #if !defined(MBEDTLS_NO_PLATFORM_ENTROPY) |
| 30 | /** |
| 31 | * \brief Platform-specific entropy poll callback |
| 32 | */ |
| 33 | int mbedtls_platform_entropy_poll(void *data, |
| 34 | unsigned char *output, size_t len, size_t *olen); |
| 35 | #endif |
| 36 | |
| 37 | #if defined(MBEDTLS_ENTROPY_HARDWARE_ALT) |
| 38 | /** |
| 39 | * \brief Entropy poll callback for a hardware source |
| 40 | * |
Tom Van Eyck | c163317 | 2024-04-09 18:44:13 +0200 | [diff] [blame] | 41 | * \warning This is not provided by Mbed TLS! |
Jens Wiklander | 32b3180 | 2023-10-06 16:59:46 +0200 | [diff] [blame] | 42 | * See \c MBEDTLS_ENTROPY_HARDWARE_ALT in mbedtls_config.h. |
| 43 | * |
| 44 | * \note This must accept NULL as its first argument. |
| 45 | */ |
| 46 | int mbedtls_hardware_poll(void *data, |
| 47 | unsigned char *output, size_t len, size_t *olen); |
| 48 | #endif |
| 49 | |
| 50 | #if defined(MBEDTLS_ENTROPY_NV_SEED) |
| 51 | /** |
| 52 | * \brief Entropy poll callback for a non-volatile seed file |
| 53 | * |
| 54 | * \note This must accept NULL as its first argument. |
| 55 | */ |
| 56 | int mbedtls_nv_seed_poll(void *data, |
| 57 | unsigned char *output, size_t len, size_t *olen); |
| 58 | #endif |
| 59 | |
| 60 | #ifdef __cplusplus |
| 61 | } |
| 62 | #endif |
| 63 | |
| 64 | #endif /* entropy_poll.h */ |