Lines Matching defs:pool

58  * Size of entropy pool in 32-bit words.  This _MUST_ be a power of 2.
89 isc_uint32_t cursor; /*%< current add point in the pool */
93 isc_uint32_t pool[RND_POOLWORDS]; /*%< random pool data */
103 isc_entropypool_t pool;
161 * The random pool "taps"
227 entropy += ent->pool.entropy;
229 ent->pool.entropy = ISC_MIN(entropy, RND_POOLBITS);
233 * Decrement the amount of entropy the pool has.
237 entropy = ISC_MIN(entropy, ent->pool.entropy);
238 ent->pool.entropy -= entropy;
250 pseudo += ent->pool.pseudo;
252 ent->pool.pseudo = ISC_MIN(pseudo, RND_POOLBITS * 8);
256 * Decrement the amount of pseudo the pool has.
260 pseudo = ISC_MIN(pseudo, ent->pool.pseudo);
261 ent->pool.pseudo -= pseudo;
265 * Add one word to the pool, rotating the input as needed.
270 * Steal some values out of the pool, and xor them into the
273 * Mix the new value into the pool using xor. This will
277 val ^= rp->pool[(rp->cursor + TAP1) & (RND_POOLWORDS - 1)];
278 val ^= rp->pool[(rp->cursor + TAP2) & (RND_POOLWORDS - 1)];
279 val ^= rp->pool[(rp->cursor + TAP3) & (RND_POOLWORDS - 1)];
280 val ^= rp->pool[(rp->cursor + TAP4) & (RND_POOLWORDS - 1)];
281 val ^= rp->pool[(rp->cursor + TAP5) & (RND_POOLWORDS - 1)];
283 rp->pool[rp->cursor++] ^= val;
285 rp->pool[rp->cursor++] ^=
289 * If we have looped around the pool, increment the rotate
293 * to try to spread the bits throughout the pool quickly when the
294 * pool is empty.
303 * Add a buffer's worth of data to the pool.
305 * Requires that the lock is held on the entropy pool.
339 entropypool_add_word(&ent->pool, val);
345 entropypool_add_word(&ent->pool, val);
362 entropypool_add_word(&ent->pool, val);
524 * Extract some number of bytes from the random pool, decreasing the
527 * Do this by stiring the pool and returning a part of hash as randomness.
565 * have enough data in our pool for this pass. If we don't,
576 * of entropy in the pool, don't block here. It is
577 * better to drain the pool once in a while and
579 * pool full.
581 if (ent->pool.entropy >= THRESHOLD_BITS)
590 if (ent->pool.entropy < THRESHOLD_BITS) {
598 * If we've extracted half our pool size in bits
615 isc_sha1_update(&hash, (void *)(ent->pool.pool),
620 * Stir the extracted data (all of it) back into the pool.
631 deltae = ISC_MIN(deltae, ent->pool.entropy);
661 isc_entropypool_init(isc_entropypool_t *pool) {
662 pool->cursor = RND_POOLWORDS - 1;
663 pool->entropy = 0;
664 pool->pseudo = 0;
665 pool->rotate = 0;
666 memset(pool->pool, 0, RND_POOLBYTES);
670 isc_entropypool_invalidate(isc_entropypool_t *pool) {
671 pool->cursor = 0;
672 pool->entropy = 0;
673 pool->pseudo = 0;
674 pool->rotate = 0;
675 memset(pool->pool, 0, RND_POOLBYTES);
710 isc_entropypool_init(&ent->pool);
822 isc_entropypool_invalidate(&ent->pool);
1090 "Entropy pool %p: refcnt %u cursor %u,"
1094 ent->pool.cursor, ent->pool.rotate,
1095 ent->pool.entropy, ent->pool.pseudo,
1117 estimate = ent->pool.entropy;