Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file havege.h |
Paul Bakker | e0ccd0a | 2009-01-04 16:27:10 +0000 | [diff] [blame^] | 3 | * |
| 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine |
| 5 | * |
| 6 | * Copyright (C) 2009 Paul Bakker |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 21 | */ |
Paul Bakker | 40e4694 | 2009-01-03 21:51:57 +0000 | [diff] [blame] | 22 | #ifndef POLARSSL_HAVEGE_H |
| 23 | #define POLARSSL_HAVEGE_H |
Paul Bakker | 5121ce5 | 2009-01-03 21:22:43 +0000 | [diff] [blame] | 24 | |
| 25 | #define COLLECT_SIZE 1024 |
| 26 | |
| 27 | /** |
| 28 | * \brief HAVEGE state structure |
| 29 | */ |
| 30 | typedef struct |
| 31 | { |
| 32 | int PT1, PT2, offset[2]; |
| 33 | int pool[COLLECT_SIZE]; |
| 34 | int WALK[8192]; |
| 35 | } |
| 36 | havege_state; |
| 37 | |
| 38 | #ifdef __cplusplus |
| 39 | extern "C" { |
| 40 | #endif |
| 41 | |
| 42 | /** |
| 43 | * \brief HAVEGE initialization |
| 44 | * |
| 45 | * \param hs HAVEGE state to be initialized |
| 46 | */ |
| 47 | void havege_init( havege_state *hs ); |
| 48 | |
| 49 | /** |
| 50 | * \brief HAVEGE rand function |
| 51 | * |
| 52 | * \param rng_st points to an HAVEGE state |
| 53 | * |
| 54 | * \return A random int |
| 55 | */ |
| 56 | int havege_rand( void *p_rng ); |
| 57 | |
| 58 | #ifdef __cplusplus |
| 59 | } |
| 60 | #endif |
| 61 | |
| 62 | #endif /* havege.h */ |