Expand description
Kernel entropy pool : a cryptographically sound random bytes from interrupt noise.
Collects entropy from:
- keyboard IRQ timing + scancode data
- timer tick jitter (low bits of TSC)
- storage (AHCI) IRQ timing
- RDRAND when available (as seed material)
The pool uses a tweaked Threefish-like mixing over 128 bytes (4×4 u64s) for efficient diffusion. Output is extracted by hashing the pool state through a compression round : no built-in hash dependency needed.
Constants§
- ENTROPY_
HIGH_ 🔒WATER - Entropy threshold in bytes before we consider the pool “initialised”.
- POOL_
WORDS 🔒 - Number of 64-bit words in the entropy pool (16 = 128 bytes).
Statics§
- ENTROPY_
CTR 🔒 - Estimated entropy count (in bytes). Saturates at POOL_WORDS * 8.
- POOL 🔒
- The entropy pool : a 128‑byte array of 16 u64s.
- POOL_
IDX 🔒 - Index where the next sample will be mixed in.
Functions§
- add_
entropy - Feed a 64‑bit sample into the entropy pool (called from interrupt handlers).
- extract_
block 🔒 - Extract 8 bytes from the pool by folding all words together.
- fill_
random - Fill a byte buffer with random bytes from the entropy pool.
- is_
ready - Check whether the entropy pool has accumulated enough entropy
(at least
ENTROPY_HIGH_WATERbytes). Used by GRND_NONBLOCK. - rdrand64 🔒
- BUG TODO : RDRAND helper (used during boot seeding).
- seed_
from_ rdrand - One-time boot‑time seed of the pool from RDRAND (if available).
- twist 🔒
- Non‑linear twist: multiplicative inverse in GF(2⁶⁴) masked by a prime, then XORed with a rotation of itself.