PolarSSL v1.2.7
entropy.h
Go to the documentation of this file.
1 
27 #ifndef POLARSSL_ENTROPY_H
28 #define POLARSSL_ENTROPY_H
29 
30 #include <string.h>
31 
32 #include "config.h"
33 
34 #include "sha4.h"
35 #if defined(POLARSSL_HAVEGE_C)
36 #include "havege.h"
37 #endif
38 
39 #define POLARSSL_ERR_ENTROPY_SOURCE_FAILED -0x003C
40 #define POLARSSL_ERR_ENTROPY_MAX_SOURCES -0x003E
41 #define POLARSSL_ERR_ENTROPY_NO_SOURCES_DEFINED -0x0040
43 #define ENTROPY_MAX_SOURCES 20
44 #define ENTROPY_MAX_GATHER 128
45 #define ENTROPY_BLOCK_SIZE 64
47 #define ENTROPY_SOURCE_MANUAL ENTROPY_MAX_SOURCES
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
64 typedef int (*f_source_ptr)(void *, unsigned char *, size_t, size_t *);
65 
69 typedef struct
70 {
72  void * p_source;
73  size_t size;
74  size_t threshold;
75 }
77 
81 typedef struct
82 {
86 #if defined(POLARSSL_HAVEGE_C)
88 #endif
89 }
91 
97 void entropy_init( entropy_context *ctx );
98 
111  f_source_ptr f_source, void *p_source,
112  size_t threshold );
113 
121 int entropy_gather( entropy_context *ctx );
122 
132 int entropy_func( void *data, unsigned char *output, size_t len );
133 
144  const unsigned char *data, size_t len );
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif /* entropy.h */