efi_get_random_bytes(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ 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:

  1. the firmware does not implement the EFI_RNG_PROTOCOL 😭 β€” like, no RNG protocol, no random bytes, that's the rules.
  2. 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