FreeBSD/sys/dev/random/random_harvestq.c
/*-
 * Entropy harvesting direct routine.
 *
 * This is not supposed to be fast, but will only be used during
 * (e.g.) booting when initial entropy is being gathered.
 */
Entropy harvesting direct routine.
This is not supposed to be fast, but will only be used during
booting when initial entropy is being gathered.
Entropy harvesting direct routine . This is not supposed to be fast but will only be used during booting when initial entropy is being gathered .
void
random_harvest_direct(const void *entropy, u_int size, u_int bits, enum random_entropy_source origin)
{
	struct harvest_event event;
	KASSERT(origin >= RANDOM_START && origin < ENTROPYSOURCE, ("%s: origin %d invalid\n", __func__, origin));
	if (!(harvest_context.hc_source_mask & (1 << origin)))
		return;
	size = MIN(size, sizeof(event.he_entropy));
	event.he_somecounter = (uint32_t)get_cyclecount();
	event.he_size = size;
	event.he_bits = bits;
	event.he_source = origin;
	event.he_destination = harvest_context.hc_destination[origin]++;
	memcpy(event.he_entropy, entropy, size);
	random_harvestq_fast_process_event(&event);
	explicit_bzero(&event, sizeof(event));
}
void random_harvest_direct ( const void * entropy , u_int size , u_int bits , enum random_entropy_source origin ) { struct harvest_event event ; KASSERT ( origin >= RANDOM_START && origin < ENTROPYSOURCE , ( " \n " , __func__ , origin ) ) ; if ( ! ( harvest_context . hc_source_mask & ( 1 << origin ) ) ) return ; size = MIN ( size , sizeof ( event . he_entropy ) ) ; event . he_somecounter = ( uint32_t ) get_cyclecount ( ) ; event . he_size = size ; event . he_bits = bits ; event . he_source = origin ; event . he_destination = harvest_context . hc_destination [ origin ] ++ ; memcpy ( event . he_entropy , entropy , size ) ; random_harvestq_fast_process_event ( & event ) ; explicit_bzero ( & event , sizeof ( event ) ) ; }
Entropy harvesting direct routine.
Entropy harvesting direct routine .