havege.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * \file havege.h
  3. *
  4. * \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion
  5. *
  6. * Copyright (C) 2006-2010, 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_HAVEGE_H
  28. #define POLARSSL_HAVEGE_H
  29. #define COLLECT_SIZE 1024
  30. /**
  31. * \brief HAVEGE state structure
  32. */
  33. typedef struct
  34. {
  35. int PT1, PT2, offset[2];
  36. int pool[COLLECT_SIZE];
  37. int WALK[8192];
  38. }
  39. havege_state;
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /**
  44. * \brief HAVEGE initialization
  45. *
  46. * \param hs HAVEGE state to be initialized
  47. */
  48. void havege_init( havege_state *hs );
  49. /**
  50. * \brief HAVEGE rand function
  51. *
  52. * \param p_rng A HAVEGE state
  53. *
  54. * \return A random int
  55. */
  56. int havege_rand( void *p_rng );
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif /* havege.h */