Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file entropy_poll.h |
| 3 | * |
| 4 | * \brief Platform-specific and custom entropy polling functions |
| 5 | * |
Manuel Pégourié-Gonnard | a658a40 | 2015-01-23 09:45:19 +0000 | [diff] [blame] | 6 | * Copyright (C) 2006-2011, ARM Limited, All Rights Reserved |
Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 7 | * |
Manuel Pégourié-Gonnard | 860b516 | 2015-01-28 17:12:07 +0000 | [diff] [blame] | 8 | * This file is part of mbed TLS (https://polarssl.org) |
Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 9 | * |
Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 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 | #ifndef POLARSSL_ENTROPY_POLL_H |
| 25 | #define POLARSSL_ENTROPY_POLL_H |
| 26 | |
| 27 | #include <string.h> |
| 28 | |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 29 | #if !defined(POLARSSL_CONFIG_FILE) |
Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 30 | #include "config.h" |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 31 | #else |
| 32 | #include POLARSSL_CONFIG_FILE |
| 33 | #endif |
Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 34 | |
| 35 | #ifdef __cplusplus |
| 36 | extern "C" { |
| 37 | #endif |
| 38 | |
Paul Bakker | bd4a9d0 | 2011-12-10 17:02:19 +0000 | [diff] [blame] | 39 | /* |
| 40 | * Default thresholds for built-in sources |
| 41 | */ |
| 42 | #define ENTROPY_MIN_PLATFORM 128 /**< Minimum for platform source */ |
| 43 | #define ENTROPY_MIN_HAVEGE 128 /**< Minimum for HAVEGE */ |
| 44 | #define ENTROPY_MIN_HARDCLOCK 32 /**< Minimum for hardclock() */ |
| 45 | |
Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 46 | #if !defined(POLARSSL_NO_PLATFORM_ENTROPY) |
| 47 | /** |
| 48 | * \brief Platform-specific entropy poll callback |
| 49 | */ |
| 50 | int platform_entropy_poll( void *data, |
| 51 | unsigned char *output, size_t len, size_t *olen ); |
| 52 | #endif |
| 53 | |
| 54 | #if defined(POLARSSL_HAVEGE_C) |
| 55 | /** |
| 56 | * \brief HAVEGE based entropy poll callback |
| 57 | * |
| 58 | * Requires an HAVEGE state as its data pointer. |
| 59 | */ |
| 60 | int havege_poll( void *data, |
| 61 | unsigned char *output, size_t len, size_t *olen ); |
| 62 | #endif |
| 63 | |
| 64 | #if defined(POLARSSL_TIMING_C) |
| 65 | /** |
| 66 | * \brief hardclock-based entropy poll callback |
| 67 | */ |
| 68 | int hardclock_poll( void *data, |
| 69 | unsigned char *output, size_t len, size_t *olen ); |
| 70 | #endif |
| 71 | |
| 72 | #ifdef __cplusplus |
| 73 | } |
| 74 | #endif |
| 75 | |
| 76 | #endif /* entropy_poll.h */ |