From 7195431474e9cc20c92260b1f6e99b34cd93e04d Mon Sep 17 00:00:00 2001 From: asterix Date: Thu, 15 Feb 2007 13:48:40 +0000 Subject: [PATCH] Fix bug in randpool_init. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@786 38d2e660-2303-0410-9eaa-f027e97ec537 --- algos/randpool.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/algos/randpool.c b/algos/randpool.c index d975ba56..74113d51 100755 --- a/algos/randpool.c +++ b/algos/randpool.c @@ -13,6 +13,9 @@ /*#* *#* $Log$ + *#* Revision 1.18 2007/02/15 13:48:40 asterix + *#* Fix bug in randpool_init. + *#* *#* Revision 1.17 2007/02/15 13:40:42 asterix *#* Fix bug in randpool_add and randpool_strir. *#* @@ -171,21 +174,20 @@ void randpool_init(EntropyPool *pool, void *_data, size_t len) data = (uint8_t *)_data; memset(pool, 0, sizeof(EntropyPool)); - pool->pos_get = CONFIG_MD2_BLOCK_LEN; + pool->pos_get = MD2_DIGEST_LEN; #if CONFIG_RANDPOOL_TIMER pool->last_counter = timer_clock(); #endif - ASSERT(len < CONFIG_SIZE_ENTROPY_POOL); - - if(len > 0) + if(data) { /* * Initialize a entropy pool with a * previous pool, and assume all pool as * entropy. */ + len = MIN(len,(size_t)CONFIG_SIZE_ENTROPY_POOL); memcpy(pool->pool_entropy, data, len); pool->entropy = len; } -- 2.34.1