Example program to test AES-GCM functionality. Used for a workshop

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers havege.h Source File

havege.h

Go to the documentation of this file.
00001 /**
00002  * \file havege.h
00003  *
00004  * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion
00005  *
00006  *  Copyright (C) 2006-2013, Brainspark B.V.
00007  *
00008  *  This file is part of PolarSSL (http://www.polarssl.org)
00009  *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
00010  *
00011  *  All rights reserved.
00012  *
00013  *  This program is free software; you can redistribute it and/or modify
00014  *  it under the terms of the GNU General Public License as published by
00015  *  the Free Software Foundation; either version 2 of the License, or
00016  *  (at your option) any later version.
00017  *
00018  *  This program is distributed in the hope that it will be useful,
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *  GNU General Public License for more details.
00022  *
00023  *  You should have received a copy of the GNU General Public License along
00024  *  with this program; if not, write to the Free Software Foundation, Inc.,
00025  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00026  */
00027 #ifndef POLARSSL_HAVEGE_H
00028 #define POLARSSL_HAVEGE_H
00029 
00030 #include <string.h>
00031 
00032 #define COLLECT_SIZE 1024
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 /**
00039  * \brief          HAVEGE state structure
00040  */
00041 typedef struct
00042 {
00043     int PT1, PT2, offset[2];
00044     int pool[COLLECT_SIZE];
00045     int WALK[8192];
00046 }
00047 havege_state;
00048 
00049 /**
00050  * \brief          HAVEGE initialization
00051  *
00052  * \param hs       HAVEGE state to be initialized
00053  */
00054 void havege_init( havege_state *hs );
00055 
00056 /**
00057  * \brief          HAVEGE rand function
00058  *
00059  * \param p_rng    A HAVEGE state
00060  * \param output   Buffer to fill
00061  * \param len      Length of buffer
00062  *
00063  * \return         0
00064  */
00065 int havege_random( void *p_rng, unsigned char *output, size_t len );
00066 
00067 #ifdef __cplusplus
00068 }
00069 #endif
00070 
00071 #endif /* havege.h */
00072 
00073