blob: 08fdd65391cffb51c6f4d865e2599e5fdc34a59b [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/**
2 * \file havege.h
Paul Bakkere0ccd0a2009-01-04 16:27:10 +00003 *
Paul Bakker83ded912010-03-21 17:46:26 +00004 * Copyright (C) 2006-2010, Paul Bakker <polarssl_maintainer at polarssl.org>
Paul Bakker77b385e2009-07-28 17:23:11 +00005 * All rights reserved.
Paul Bakkere0ccd0a2009-01-04 16:27:10 +00006 *
Paul Bakkere0ccd0a2009-01-04 16:27:10 +00007 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Paul Bakker5121ce52009-01-03 21:22:43 +000020 */
Paul Bakker40e46942009-01-03 21:51:57 +000021#ifndef POLARSSL_HAVEGE_H
22#define POLARSSL_HAVEGE_H
Paul Bakker5121ce52009-01-03 21:22:43 +000023
24#define COLLECT_SIZE 1024
25
26/**
27 * \brief HAVEGE state structure
28 */
29typedef struct
30{
31 int PT1, PT2, offset[2];
32 int pool[COLLECT_SIZE];
33 int WALK[8192];
34}
35havege_state;
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/**
42 * \brief HAVEGE initialization
43 *
44 * \param hs HAVEGE state to be initialized
45 */
46void havege_init( havege_state *hs );
47
48/**
49 * \brief HAVEGE rand function
50 *
Paul Bakker13e2dfe2009-07-28 07:18:38 +000051 * \param p_rng A HAVEGE state
Paul Bakker5121ce52009-01-03 21:22:43 +000052 *
53 * \return A random int
54 */
55int havege_rand( void *p_rng );
56
57#ifdef __cplusplus
58}
59#endif
60
61#endif /* havege.h */