Lines Matching refs:pool
62 * Size of entropy pool in 32-bit words. This _MUST_ be a power of 2.
93 isc_uint32_t cursor; /*%< current add point in the pool */
97 isc_uint32_t pool[RND_POOLWORDS]; /*%< random pool data */
107 isc_entropypool_t pool;
165 * The random pool "taps"
231 entropy += ent->pool.entropy;
233 ent->pool.entropy = ISC_MIN(entropy, RND_POOLBITS);
237 * Decrement the amount of entropy the pool has.
241 entropy = ISC_MIN(entropy, ent->pool.entropy);
242 ent->pool.entropy -= entropy;
254 pseudo += ent->pool.pseudo;
256 ent->pool.pseudo = ISC_MIN(pseudo, RND_POOLBITS * 8);
260 * Decrement the amount of pseudo the pool has.
264 pseudo = ISC_MIN(pseudo, ent->pool.pseudo);
265 ent->pool.pseudo -= pseudo;
269 * Add one word to the pool, rotating the input as needed.
274 * Steal some values out of the pool, and xor them into the
277 * Mix the new value into the pool using xor. This will
281 val ^= rp->pool[(rp->cursor + TAP1) & (RND_POOLWORDS - 1)];
282 val ^= rp->pool[(rp->cursor + TAP2) & (RND_POOLWORDS - 1)];
283 val ^= rp->pool[(rp->cursor + TAP3) & (RND_POOLWORDS - 1)];
284 val ^= rp->pool[(rp->cursor + TAP4) & (RND_POOLWORDS - 1)];
285 val ^= rp->pool[(rp->cursor + TAP5) & (RND_POOLWORDS - 1)];
287 rp->pool[rp->cursor++] ^= val;
289 rp->pool[rp->cursor++] ^=
293 * If we have looped around the pool, increment the rotate
297 * to try to spread the bits throughout the pool quickly when the
298 * pool is empty.
307 * Add a buffer's worth of data to the pool.
309 * Requires that the lock is held on the entropy pool.
336 entropypool_add_word(&ent->pool, val);
342 entropypool_add_word(&ent->pool, val);
357 entropypool_add_word(&ent->pool, val);
519 * Extract some number of bytes from the random pool, decreasing the
522 * Do this by stiring the pool and returning a part of hash as randomness.
560 * have enough data in our pool for this pass. If we don't,
571 * of entropy in the pool, don't block here. It is
572 * better to drain the pool once in a while and
574 * pool full.
576 if (ent->pool.entropy >= THRESHOLD_BITS)
585 if (ent->pool.entropy < THRESHOLD_BITS) {
593 * If we've extracted half our pool size in bits
610 isc_sha1_update(&hash, (void *)(ent->pool.pool),
615 * Stir the extracted data (all of it) back into the pool.
626 deltae = ISC_MIN(deltae, ent->pool.entropy);
656 isc_entropypool_init(isc_entropypool_t *pool) {
657 pool->cursor = RND_POOLWORDS - 1;
658 pool->entropy = 0;
659 pool->pseudo = 0;
660 pool->rotate = 0;
661 memset(pool->pool, 0, RND_POOLBYTES);
665 isc_entropypool_invalidate(isc_entropypool_t *pool) {
666 pool->cursor = 0;
667 pool->entropy = 0;
668 pool->pseudo = 0;
669 pool->rotate = 0;
670 memset(pool->pool, 0, RND_POOLBYTES);
705 isc_entropypool_init(&ent->pool);
818 isc_entropypool_invalidate(&ent->pool);
1086 "Entropy pool %p: refcnt %u cursor %u,"
1090 ent->pool.cursor, ent->pool.rotate,
1091 ent->pool.entropy, ent->pool.pseudo,
1113 estimate = ent->pool.entropy;