FreeBSD/sys/dev/random/random_harvestq.c
/*-
 * Entropy harvesting fast routine.
 *
 * This is supposed to be very fast; do not do anything slow in here!
 * This is the right place for high-rate harvested data.
 */
Entropy harvesting fast routine.
This is supposed to be very fast; do not do anything slow in here.
This is the right place for high-rate harvested data.
Entropy harvesting fast routine . This is supposed to be very fast ; do not do anything slow in here . This is the right place for high - rate harvested data .
void
random_harvest_fast(const void *entropy, u_int size, u_int bits, enum random_entropy_source origin)
{
	u_int pos;
	KASSERT(origin >= RANDOM_START && origin < ENTROPYSOURCE, ("%s: origin %d invalid\n", __func__, origin));
	if (!(harvest_context.hc_source_mask & (1 << origin)))
		return;
	pos = harvest_context.hc_entropy_fast_accumulator.pos;
	harvest_context.hc_entropy_fast_accumulator.buf[pos] ^= jenkins_hash(entropy, size, (uint32_t)get_cyclecount());
	harvest_context.hc_entropy_fast_accumulator.pos = (pos + 1)%RANDOM_ACCUM_MAX;
}
void random_harvest_fast ( const void * entropy , u_int size , u_int bits , enum random_entropy_source origin ) { u_int pos ; KASSERT ( origin >= RANDOM_START && origin < ENTROPYSOURCE , ( " \n " , __func__ , origin ) ) ; if ( ! ( harvest_context . hc_source_mask & ( 1 << origin ) ) ) return ; pos = harvest_context . hc_entropy_fast_accumulator . pos ; harvest_context . hc_entropy_fast_accumulator . buf [ pos ] ^= jenkins_hash ( entropy , size , ( uint32_t ) get_cyclecount ( ) ) ; harvest_context . hc_entropy_fast_accumulator . pos = ( pos + 1 ) % RANDOM_ACCUM_MAX ; }
Entropy harvesting fast routine.
Entropy harvesting fast routine .
/* XXX: FIX!! The above KASSERT is BS. Right now we ignore most structure and just accumulate the supplied data */