efi_get_random_bytes(9)
π¦ efi_get_random_bytes(9) β kernel api manual, bestie edition π¦
okay so real talk, this one's from the Kernel API Manual and it's genuinely so useful, no cap. it's efi_get_random_bytes, and it's giving "randomness but make it firmware" π
.
β¨ NAME β¨
efi_get_random_bytes β fill a buffer with random bytes π²β¨
like, you hand it a buffer, it fills it with random bytes. that's the whole vibe. iconic honestly.
πΈ SYNOPSIS πΈ
efi_status_t efi_get_random_bytes (unsigned long size , u8 *out );
that's it, that's the whole signature π«Ά. two arguments, one status code back. clean.
π ARGUMENTS π
sizeβ the size of the buffer, bestie. how many bytes you're asking for.unsigned long, so go off.outβ the caller allocated buffer that receives the random bytes π. a lil heads up: you allocate it, this function just fills it. so don't come crying if you handed it unallocated memory, okay? π
β DESCRIPTION β
so here's the tea β: this call will fail if either of these two things is true:
- the firmware does not implement the
EFI_RNG_PROTOCOLπ β like, no RNG protocol, no random bytes, that's the rules. - there are not enough random bytes available to fill the buffer π β you asked for more randomness than the firmware can provide, and it's not gonna fake it for you.
literally either one and the call fails. not a vibe, but like, at least it tells you via the return value instead of silently handing you bad randomness πΈ.
π RETURN π
a status code β¨. that's it. that's the whole return section. go check it, bestie, please π.
π SEE ALSO π
- kernel file
./drivers/firmware/efi/libstub/random.cβ the source, if you wanna read the actual code π§ efi_random_get_seed(9)β the sibling function, go say hi π«Ά
lowkey a reminder from your girl: if this fails, you do not have random bytes. don't pretend you do. that's how you get cursed crypto ππ
and that's the whole page, bestie!! this one came from ./drivers/firmware/efi/libstub, dated October 2026, and if you made it this far, you're literally the main character of the kernel api manual ππβ¨
π¦ 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