mbed TLS library

Dependents:   HTTPClient-SSL WS_SERVER

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers entropy_poll.h Source File

entropy_poll.h

Go to the documentation of this file.
00001 /**
00002  * \file entropy_poll.h
00003  *
00004  * \brief Platform-specific and custom entropy polling functions
00005  *
00006  *  Copyright (C) 2006-2011, 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_ENTROPY_POLL_H
00025 #define POLARSSL_ENTROPY_POLL_H
00026 
00027 #if !defined(POLARSSL_CONFIG_FILE)
00028 #include "config.h"
00029 #else
00030 #include POLARSSL_CONFIG_FILE
00031 #endif
00032 
00033 #include <stddef.h>
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 /*
00040  * Default thresholds for built-in sources
00041  */
00042 #define ENTROPY_MIN_PLATFORM    128     /**< Minimum for platform source    */
00043 #define ENTROPY_MIN_HAVEGE      128     /**< Minimum for HAVEGE             */
00044 #define ENTROPY_MIN_HARDCLOCK    32     /**< Minimum for hardclock()        */
00045 
00046 #if !defined(POLARSSL_NO_PLATFORM_ENTROPY)
00047 /**
00048  * \brief           Platform-specific entropy poll callback
00049  */
00050 int platform_entropy_poll( void *data,
00051                            unsigned char *output, size_t len, size_t *olen );
00052 #endif
00053 
00054 #if defined(POLARSSL_HAVEGE_C)
00055 /**
00056  * \brief           HAVEGE based entropy poll callback
00057  *
00058  * Requires an HAVEGE state as its data pointer.
00059  */
00060 int havege_poll( void *data,
00061                  unsigned char *output, size_t len, size_t *olen );
00062 #endif
00063 
00064 #if defined(POLARSSL_TIMING_C)
00065 /**
00066  * \brief           hardclock-based entropy poll callback
00067  */
00068 int hardclock_poll( void *data,
00069                     unsigned char *output, size_t len, size_t *olen );
00070 #endif
00071 
00072 #ifdef __cplusplus
00073 }
00074 #endif
00075 
00076 #endif /* entropy_poll.h */
00077