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