From c4ce14ab6ed86d2d9a5ee72fcb023110fb1a1772 Mon Sep 17 00:00:00 2001 From: asterix Date: Tue, 10 Jun 2008 17:08:43 +0000 Subject: [PATCH] Fix type warning. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1433 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/algo/randpool.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bertos/algo/randpool.c b/bertos/algo/randpool.c index 0fc2ee9d..45bf5285 100644 --- a/bertos/algo/randpool.c +++ b/bertos/algo/randpool.c @@ -66,10 +66,11 @@ static void randpool_push(EntropyPool *pool, void *_byte, size_t n_byte) /* * Insert a bytes in entropy pool. */ - for(int j = 0; j < n_byte; j++) + for(size_t j = 0; j < n_byte; j++) { pool->pool_entropy[i] = pool->pool_entropy[i] ^ byte[j]; - i = (++i) % CONFIG_SIZE_ENTROPY_POOL; + i++; + i = i % CONFIG_SIZE_ENTROPY_POOL; } pool->pos_add = i; // Update a insert bytes. @@ -92,7 +93,7 @@ static void randpool_stir(EntropyPool *pool) for (int i = 0; i < (CONFIG_SIZE_ENTROPY_POOL / MD2_DIGEST_LEN); i++) { - sprintf(tmp_buf, "%0x%0x%0x",pool->counter, i, pool->pos_add); + sprintf((char *)tmp_buf, "%0x%0x%0x", pool->counter, i, pool->pos_add); /* * Hash with MD2 algorithm the entropy pool. @@ -245,10 +246,6 @@ void randpool_get(EntropyPool *pool, void *_data, size_t n_byte) pool->pos_get = i; //Current number of byte we get from pool. pool->entropy -= n_byte; //Update a entropy. - /*If we get all entropy entropy is 0*/ - if(pool->entropy < 0) - pool->entropy = 0; - } /** -- 2.25.1