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