blob: 6b4aec03e18b269653814c31cffefec13870a76e [file] [log] [blame]
Jens Wiklander32b31802023-10-06 16:59:46 +02001/**
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 Eyckc1633172024-04-09 18:44:13 +02008 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Jens Wiklander32b31802023-10-06 16:59:46 +02009 */
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
18extern "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 */
33int 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 Eyckc1633172024-04-09 18:44:13 +020041 * \warning This is not provided by Mbed TLS!
Jens Wiklander32b31802023-10-06 16:59:46 +020042 * See \c MBEDTLS_ENTROPY_HARDWARE_ALT in mbedtls_config.h.
43 *
44 * \note This must accept NULL as its first argument.
45 */
46int 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 */
56int 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 */