From 9812de7c980f32cf64418adffdc24aea06d0ddf9 Mon Sep 17 00:00:00 2001 From: rasky Date: Wed, 29 Sep 2010 16:59:12 +0000 Subject: [PATCH] SEC: Fix entropy pool initialization and first reseed. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4366 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/sec/random.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) -- 2.25.1