Add directive #if in struct EntropyPool, and remove #else in randpool_add.
authorasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 13 Feb 2007 09:57:12 +0000 (09:57 +0000)
committerasterix <asterix@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 13 Feb 2007 09:57:12 +0000 (09:57 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@781 38d2e660-2303-0410-9eaa-f027e97ec537

algos/randpool.c
algos/randpool.h

index 6881bc4896fb5943f59604ab416e138655e90330..ed9bf436df090269e7c8f25e10a6bdc9a43f8263 100755 (executable)
@@ -13,6 +13,9 @@
 
 /*#*
  *#* $Log$
+ *#* Revision 1.14  2007/02/13 09:57:12  asterix
+ *#* Add directive #if in struct EntropyPool, and remove #else in randpool_add.
+ *#*
  *#* Revision 1.13  2007/02/12 18:25:34  asterix
  *#* Fix bug in randpool_getN.
  *#*
@@ -146,16 +149,11 @@ void randpool_add(EntropyPool *pool, void *data, size_t data_len, size_t entropy
                entropy++;
        }
 
-#else
-       size_t event = 0;
-
-       /*Difference of time between a two accese to entropy pool.*/
-       event = pool->last_counter++;
+       pool->last_counter = event;
 
 #endif
 
        pool->entropy += entropy;      //Update a entropy of the pool.
-       pool->last_counter = event;
 }
 
 /**
index 9c310c91e7561f7ea21392b1b0dc34ab297a5439..46d912886d9288334f5dd5037a19c2d0fdccd723 100755 (executable)
@@ -14,6 +14,9 @@
 
 /*#*
  *#* $Log$
+ *#* Revision 1.9  2007/02/13 09:57:12  asterix
+ *#* Add directive #if in struct EntropyPool, and remove #else in randpool_add.
+ *#*
  *#* Revision 1.8  2007/02/12 09:47:39  asterix
  *#* Remove randpool_save. Add randpool_pool.
  *#*
@@ -54,7 +57,11 @@ typedef struct EntropyPool
        size_t pos_add;                                  ///< Number of byte  idd in entropy pool.
        size_t pos_get;                                  ///< Number of byte get in entropy pool.
        size_t counter;                                  ///< Counter.
+
+#if CONFIG_RANDPOOL_TIMER
        size_t last_counter;                             ///< Last timer value.
+#endif
+
        uint8_t pool_entropy[CONFIG_SIZE_ENTROPY_POOL];  ///< Entropy pool.
 
 } EntropyPool;