entropy_func() threading support

This commit is contained in:
Paul Bakker 2013-09-28 15:23:57 +02:00
parent 1ffefaca1e
commit f4e7dc50ea
2 changed files with 34 additions and 3 deletions

View file

@ -41,6 +41,10 @@
#endif
#endif
#if defined(POLARSSL_THREADING_C)
#include "threading.h"
#endif
#if defined(POLARSSL_HAVEGE_C)
#include "havege.h"
#endif
@ -106,6 +110,9 @@ typedef struct
#if defined(POLARSSL_HAVEGE_C)
havege_state havege_data;
#endif
#if defined(POLARSSL_THREADING_C)
threading_mutex_t mutex; /*!< mutex */
#endif
}
entropy_context;
@ -149,6 +156,7 @@ int entropy_gather( entropy_context *ctx );
/**
* \brief Retrieve entropy from the accumulator (Max ENTROPY_BLOCK_SIZE)
* (Thread-safe if POLARSSL_THREADING_C is enabled)
*
* \param data Entropy context
* \param output Buffer to fill