blob: 695767b5395dff834b4c87092db5a1a84d0b1a82 [file] [log] [blame]
Paul Bakker6083fd22011-12-03 21:45:14 +00001/**
2 * \file entropy_poll.h
3 *
4 * \brief Platform-specific and custom entropy polling functions
5 *
Manuel Pégourié-Gonnarda658a402015-01-23 09:45:19 +00006 * Copyright (C) 2006-2011, ARM Limited, All Rights Reserved
Paul Bakker6083fd22011-12-03 21:45:14 +00007 *
Manuel Pégourié-Gonnard967a2a52015-01-22 14:28:16 +00008 * This file is part of mbed TLS (http://www.polarssl.org)
Paul Bakker6083fd22011-12-03 21:45:14 +00009 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
10 *
11 * All rights reserved.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27#ifndef POLARSSL_ENTROPY_POLL_H
28#define POLARSSL_ENTROPY_POLL_H
29
30#include <string.h>
31
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020032#if !defined(POLARSSL_CONFIG_FILE)
Paul Bakker6083fd22011-12-03 21:45:14 +000033#include "config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020034#else
35#include POLARSSL_CONFIG_FILE
36#endif
Paul Bakker6083fd22011-12-03 21:45:14 +000037
38#ifdef __cplusplus
39extern "C" {
40#endif
41
Paul Bakkerbd4a9d02011-12-10 17:02:19 +000042/*
43 * Default thresholds for built-in sources
44 */
45#define ENTROPY_MIN_PLATFORM 128 /**< Minimum for platform source */
46#define ENTROPY_MIN_HAVEGE 128 /**< Minimum for HAVEGE */
47#define ENTROPY_MIN_HARDCLOCK 32 /**< Minimum for hardclock() */
48
Paul Bakker6083fd22011-12-03 21:45:14 +000049#if !defined(POLARSSL_NO_PLATFORM_ENTROPY)
50/**
51 * \brief Platform-specific entropy poll callback
52 */
53int platform_entropy_poll( void *data,
54 unsigned char *output, size_t len, size_t *olen );
55#endif
56
57#if defined(POLARSSL_HAVEGE_C)
58/**
59 * \brief HAVEGE based entropy poll callback
60 *
61 * Requires an HAVEGE state as its data pointer.
62 */
63int havege_poll( void *data,
64 unsigned char *output, size_t len, size_t *olen );
65#endif
66
67#if defined(POLARSSL_TIMING_C)
68/**
69 * \brief hardclock-based entropy poll callback
70 */
71int hardclock_poll( void *data,
72 unsigned char *output, size_t len, size_t *olen );
73#endif
74
75#ifdef __cplusplus
76}
77#endif
78
79#endif /* entropy_poll.h */