X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fsec%2Frandom.c;h=67c24859529d9a2daee538418b0e8f3a7b062083;hb=4d8a6a97c6c0e15296b51d5f02674079bede1aa0;hp=69f3fed3b4392f6dcc80b4f16d6fca99bc83b062;hpb=955a6b6d683b2958afaab6f3b2afacc188656681;p=bertos.git diff --git a/bertos/sec/random.c b/bertos/sec/random.c index 69f3fed3..67c24859 100644 --- a/bertos/sec/random.c +++ b/bertos/sec/random.c @@ -48,13 +48,14 @@ #include #include #include +#include /********************************************************************************/ /* Configuration of the random module */ /********************************************************************************/ -#define POOL_CONTEXT PP_CAT(PP_CAT(PRNG_NAME, CONFIG_RANDOM_POOL), Context) -#define POOL_INIT PP_CAT(PP_CAT(PRNG_NAME, CONFIG_RANDOM_POOL), _init) +#define POOL_CONTEXT PP_CAT(PP_CAT(POOL_NAMEU, CONFIG_RANDOM_POOL), Context) +#define POOL_INIT PP_CAT(PP_CAT(POOL_NAMEL, CONFIG_RANDOM_POOL), _init) #define EXTRACTOR_STACKINIT PP_CAT(PP_CAT(EXTRACTOR_NAME, CONFIG_RANDOM_EXTRACTOR), _stackinit) @@ -68,7 +69,7 @@ #if CONFIG_RANDOM_POOL != POOL_NONE static POOL_CONTEXT epool_ctx; -static EntropyPool_Context * const epool = (EntropyPool_Context *)&epool_ctx; +static EntropyPool * const epool = (EntropyPool *)&epool_ctx; #endif static PRNG_CONTEXT prng_ctx; @@ -95,7 +96,7 @@ static bool initialized = 0; static void optional_reseeding(void) { #if CONFIG_RANDOM_POOL != POOL_NONE - static ticks_t last_reseed = 0; + static ticks_t last_reseed = -1000; // We don't allow more than 10 reseedings per second // (as suggested by Fortuna)