crypto_rng_get_bytes(9)
π crypto_rng_get_bytes(9) π
okay bestie, welcome to the Kernel API Manual β today's main character is crypto_rng_get_bytes, aka the little function that hands you random numbers. no cap, it's giving "glow-up for your buffer" β¨
πΈ NAME πΈ
crypto_rng_get_bytes β get random number. that's it. that's the whole vibe. π²
β¨ SYNOPSIS β¨
int crypto_rng_get_bytes (struct crypto_rng *tfm , u8 *rdata , unsigned
int dlen );
like, it returns an int, and it takes three lil friends. slay π
π ARGUMENTS π
tfmβ the cipher handle π«Ά literally the RNG's whole identity, hold it gently.rdataβ your output buffer, and yes it's where the random numbers go to live their best life.dlenβ the length of that output buffer. please tell it the truth, it needs to know π
π¦ DESCRIPTION π¦
so here's the tea β β this function fills the caller-allocated buffer with random numbers, using the random number generator that the cipher handle (tfm) is referencing. you bring the buffer, it brings the chaos. iconic partnership honestly. π₯
bestie note: caller-allocated means YOU made the buffer. it's not gonna do it for you. no free rides, only free random bytes. π
β RETURN β
0β function was successful, we ate and left no crumbs π< 0β an error occurred π vibe check failed, go read the error code
π SEE ALSO π
- Kernel file
./include/crypto/rng.hstructrng_alg(9) crypto_stdrng_get_bytes(9)Random number generator API(9)crypto_alloc_rng(9)crypto_rng_alg(9)crypto_free_rng(9)crypto_rng_generate(9)crypto_rng_reset(9)crypto_rng_seedsize(9)
iykyk β go read them all, they're the friend group π
and that's the whole page, bestie π this one came from ./include/crypto, dated October 2026 β so go forth, fill your buffers with randomness, and remember: stay random, stay iconic π§ββοΈπΈβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms