From: rasky Date: Wed, 29 Sep 2010 16:59:12 +0000 (+0000) Subject: SEC: Fix entropy pool initialization and first reseed. X-Git-Tag: 2.6.0~35 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=9812de7c980f32cf64418adffdc24aea06d0ddf9;p=bertos.git SEC: Fix entropy pool initialization and first reseed. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4366 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/sec/random.c b/bertos/sec/random.c index 5fa8ef35..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_NAMEU, CONFIG_RANDOM_POOL), Context) -#define POOL_INIT PP_CAT(PP_CAT(PRNG_NAMEL, 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) @@ -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)