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