Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /**
  2.  * \file entropy_poll.h
  3.  *
  4.  * \brief Platform-specific and custom entropy polling functions
  5.  *
  6.  *  Copyright (C) 2006-2011, Brainspark B.V.
  7.  *
  8.  *  This file is part of PolarSSL (http://www.polarssl.org)
  9.  *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
  10.  *
  11.  *  All rights reserved.
  12.  *
  13.  *  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.
  26.  */
  27. #ifndef POLARSSL_ENTROPY_POLL_H
  28. #define POLARSSL_ENTROPY_POLL_H
  29.  
  30. #include <string.h>
  31.  
  32. #include "config.h"
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. /*
  39.  * Default thresholds for built-in sources
  40.  */
  41. #define ENTROPY_MIN_PLATFORM    128     /**< Minimum for platform source    */
  42. #define ENTROPY_MIN_HAVEGE      128     /**< Minimum for HAVEGE             */
  43. #define ENTROPY_MIN_HARDCLOCK    32     /**< Minimum for hardclock()        */
  44.  
  45. #if !defined(POLARSSL_NO_PLATFORM_ENTROPY)
  46. /**
  47.  * \brief           Platform-specific entropy poll callback
  48.  */
  49. int platform_entropy_poll( void *data,
  50.                            unsigned char *output, size_t len, size_t *olen );
  51. #endif
  52.  
  53. #if defined(POLARSSL_HAVEGE_C)
  54. /**
  55.  * \brief           HAVEGE based entropy poll callback
  56.  *
  57.  * Requires an HAVEGE state as its data pointer.
  58.  */
  59. int havege_poll( void *data,
  60.                  unsigned char *output, size_t len, size_t *olen );
  61. #endif
  62.  
  63. #if defined(POLARSSL_TIMING_C)
  64. /**
  65.  * \brief           hardclock-based entropy poll callback
  66.  */
  67. int hardclock_poll( void *data,
  68.                     unsigned char *output, size_t len, size_t *olen );
  69. #endif
  70.  
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74.  
  75. #endif /* entropy_poll.h */
  76.