RANDOM_HARVEST(9)
β¨ RANDOM_HARVEST(9) β¨
okay bestie, welcome to the Kernel Developer's Manual entry for random_harvest β it's giving "gather entropy from the kernel for the entropy device" and honestly? iconic. π
π NAME π
random_harvest β gather entropy from the kernel for the entropy device π§
πΈ SYNOPSIS πΈ
#include <sys/types.h>
#include <sys/random.h>
void
random_harvest_direct(void *entropy, u_int size, enum esource source);
void
random_harvest_fast(void *entropy, u_int size, enum esource source);
void
random_harvest_queue(void *entropy, u_int size, enum esource source);
π¦ DESCRIPTION π¦
so the random_harvest_*() functions are the ones device drivers and other kernel processes use to hand over data that counts as (at least partially) stochastic to the entropy device. like, they're the little delivery girlies feeding the vibes in. π
the caller should pass a pointer pointing to the "random" data in entropy. the argument size contains the number of bytes pointed to. and source gets picked from one of the values enumerated in sys/dev/random.h, and it's used to indicate where the entropy came from. π«Ά
random_harvest_direct()β this variant is for early harvesting, before any multitasking is enabled. no multitasking, no problem. β¨random_harvest_fast()β this one is for sources that should not take a performance hit from harvesting, because they're high-rate sources. some entropy is sacrificed, but the high rate of supply will compensate for that. trade-off queen behavior, honestly. πrandom_harvest_queue()β this is for general harvesting, and it's the default choice for most entropy sources such as interrupts or console events. the main character of harvest variants, no cap. π
interrupt harvesting has been in part simplified for the kernel programmer. so here's the tea: if a device driver registers an interrupt handler with BUS_SETUP_INTR(9) or bus_setup_intr(9), then it is only necessary to include the INTR_ENTROPY bit in the flags argument to have that interrupt source be used for entropy harvesting. and bestie, this should be done wherever practicable. periodt. π
π₯ SEE ALSO π₯
π AUTHORS π
the FreeBSD random(4) entropy device and supporting documentation was written by Mark R V Murray. we stan. π«Ά
mwah π that's the whole page, bestie β from the Debian folks, dated August 26, 2018, on the RANDOM_HARVEST(9) tip. go harvest some entropy, you got this. πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2002-2015 Mark R V Murray
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms