]> git.zerfleddert.de Git - proxmark3-svn/blame - common/mbedtls/entropy_poll.h
Merge branch 'master' into fix_iclass_sim
[proxmark3-svn] / common / mbedtls / entropy_poll.h
CommitLineData
700d8687
OM
1/**
2 * \file entropy_poll.h
3 *
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
9 *
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.
14 *
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.
19 *
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.
23 *
24 * This file is part of mbed TLS (https://tls.mbed.org)
25 */
26#ifndef MBEDTLS_ENTROPY_POLL_H
27#define MBEDTLS_ENTROPY_POLL_H
28
29#if !defined(MBEDTLS_CONFIG_FILE)
30#include "config.h"
31#else
32#include MBEDTLS_CONFIG_FILE
33#endif
34
35#include <stddef.h>
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/*
42 * Default thresholds for built-in sources, in bytes
43 */
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
50
51/**
52 * \brief Entropy poll callback that provides 0 entropy.
53 */
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
58
59#if !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
60/**
61 * \brief Platform-specific entropy poll callback
62 */
63int mbedtls_platform_entropy_poll( void *data,
64 unsigned char *output, size_t len, size_t *olen );
65#endif
66
67#if defined(MBEDTLS_HAVEGE_C)
68/**
69 * \brief HAVEGE based entropy poll callback
70 *
71 * Requires an HAVEGE state as its data pointer.
72 */
73int mbedtls_havege_poll( void *data,
74 unsigned char *output, size_t len, size_t *olen );
75#endif
76
77#if defined(MBEDTLS_TIMING_C)
78/**
79 * \brief mbedtls_timing_hardclock-based entropy poll callback
80 */
81int mbedtls_hardclock_poll( void *data,
82 unsigned char *output, size_t len, size_t *olen );
83#endif
84
85#if defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
86/**
87 * \brief Entropy poll callback for a hardware source
88 *
89 * \warning This is not provided by mbed TLS!
90 * See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h.
91 *
92 * \note This must accept NULL as its first argument.
93 */
94int mbedtls_hardware_poll( void *data,
95 unsigned char *output, size_t len, size_t *olen );
96#endif
97
98#if defined(MBEDTLS_ENTROPY_NV_SEED)
99/**
100 * \brief Entropy poll callback for a non-volatile seed file
101 *
102 * \note This must accept NULL as its first argument.
103 */
104int mbedtls_nv_seed_poll( void *data,
105 unsigned char *output, size_t len, size_t *olen );
106#endif
107
108#ifdef __cplusplus
109}
110#endif
111
112#endif /* entropy_poll.h */
Impressum, Datenschutz