SEC: Fix entropy pool initialization and first reseed.
authorrasky <rasky@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 29 Sep 2010 16:59:12 +0000 (16:59 +0000)
committerrasky <rasky@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 29 Sep 2010 16:59:12 +0000 (16:59 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4366 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/sec/random.c

index 5fa8ef35b5080bb3e07eb585136f6a61e6359e48..67c24859529d9a2daee538418b0e8f3a7b062083 100644 (file)
 #include <sec/prng/isaac.h>
 #include <sec/prng/x917.h>
 #include <sec/prng/yarrow.h>
+#include <sec/entropy/yarrow_pool.h>
 
 /********************************************************************************/
 /* 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)