v2 / thirdparty / mbedtls / library / entropy_poll.h
64 lines · 55 sloc · 1.66 KB · 1274cdc3447be8e83616e8512872455e8720c2fd
Raw
1/**
2 * \file entropy_poll.h
3 *
4 * \brief Platform-specific and custom entropy polling functions
5 */
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
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
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 *
41 * \warning This is not provided by Mbed TLS!
42 * 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 */
65