blob: a974462c50f022022109e85be0f42d4a2840788a [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/**
2 * \file havege.h
Paul Bakkere0ccd0a2009-01-04 16:27:10 +00003 *
Paul Bakker37ca75d2011-01-06 12:28:03 +00004 * \brief Diffie-Hellman-Merkle key exchange
5 *
Paul Bakker84f12b72010-07-18 10:13:04 +00006 * Copyright (C) 2006-2010, Brainspark B.V.
Paul Bakkerb96f1542010-07-18 20:36:00 +00007 *
8 * This file is part of PolarSSL (http://www.polarssl.org)
Paul Bakker84f12b72010-07-18 10:13:04 +00009 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
Paul Bakkerb96f1542010-07-18 20:36:00 +000010 *
Paul Bakker77b385e2009-07-28 17:23:11 +000011 * All rights reserved.
Paul Bakkere0ccd0a2009-01-04 16:27:10 +000012 *
Paul Bakkere0ccd0a2009-01-04 16:27:10 +000013 * 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.
Paul Bakker5121ce52009-01-03 21:22:43 +000026 */
Paul Bakker40e46942009-01-03 21:51:57 +000027#ifndef POLARSSL_HAVEGE_H
28#define POLARSSL_HAVEGE_H
Paul Bakker5121ce52009-01-03 21:22:43 +000029
30#define COLLECT_SIZE 1024
31
32/**
33 * \brief HAVEGE state structure
34 */
35typedef struct
36{
37 int PT1, PT2, offset[2];
38 int pool[COLLECT_SIZE];
39 int WALK[8192];
40}
41havege_state;
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/**
48 * \brief HAVEGE initialization
49 *
50 * \param hs HAVEGE state to be initialized
51 */
52void havege_init( havege_state *hs );
53
54/**
55 * \brief HAVEGE rand function
56 *
Paul Bakker13e2dfe2009-07-28 07:18:38 +000057 * \param p_rng A HAVEGE state
Paul Bakker5121ce52009-01-03 21:22:43 +000058 *
59 * \return A random int
60 */
61int havege_rand( void *p_rng );
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif /* havege.h */