| 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 | * | 
|  | 6 | *  Copyright (C) 2006-2011, Brainspark B.V. | 
|  | 7 | * | 
|  | 8 | *  This file is part of PolarSSL (http://www.polarssl.org) | 
|  | 9 | *  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é-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 32 | #if !defined(POLARSSL_CONFIG_FILE) | 
| Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 33 | #include "config.h" | 
| Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 34 | #else | 
|  | 35 | #include POLARSSL_CONFIG_FILE | 
|  | 36 | #endif | 
| Paul Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 37 |  | 
|  | 38 | #ifdef __cplusplus | 
|  | 39 | extern "C" { | 
|  | 40 | #endif | 
|  | 41 |  | 
| Paul Bakker | bd4a9d0 | 2011-12-10 17:02:19 +0000 | [diff] [blame] | 42 | /* | 
|  | 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 Bakker | 6083fd2 | 2011-12-03 21:45:14 +0000 | [diff] [blame] | 49 | #if !defined(POLARSSL_NO_PLATFORM_ENTROPY) | 
|  | 50 | /** | 
|  | 51 | * \brief           Platform-specific entropy poll callback | 
|  | 52 | */ | 
|  | 53 | int 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 | */ | 
|  | 63 | int 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 | */ | 
|  | 71 | int 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 */ |