+ md2_init(&context); //Init MD2 algorithm.
+
+ randpool_add(pool, "", 0, 0);
+
+ for (int i = 0; i < NUM_STIR_LOOP; i++)
+ {
+ sprintf(tmp_buf, "%0x%0x%0x",pool->counter, i, pool->pos_add);
+
+ /*
+ * Hash with MD2 algorithm the entropy pool.
+ */
+ md2_update(&context, pool->pool_entropy, CONFIG_SIZE_ENTROPY_POOL);
+
+ md2_update(&context, tmp_buf, strlen(tmp_buf));
+
+ /*Insert a message digest in entropy pool.*/
+ randpool_push(pool, md2_end(&context), CONFIG_MD2_BLOCK_LEN);
+
+ pool->counter = (pool->counter + 1) & 0xFFFFFFFF; //Clamp a counter to 4 byte.
+
+ }
+
+ /*Insert in pool the difference between a two call of this function (see above).*/
+ randpool_add(pool, "", 0, 0);
+
+ pool->entropy = entropy; //Restore old value of entropy. We haven't add entropy.