RAND_LOAD_FILE(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’– RAND_LOAD_FILE(3) β€” PRNG seed file πŸ’–

hiii bestie πŸ’• welcome to the RAND_LOAD_FILE(3) page from the Library Functions Manual β€” we're talking PRNG seed files and it's giving old-school crypto lore ✨

🌸 NAME 🌸

RAND_file_name, RAND_load_file, RAND_write_file β€” PRNG seed file πŸ’ΎπŸ¦‹

✨ SYNOPSIS ✨

okay so this is the whole little lineup, bestie πŸ‘‡

library β€œlibcrypto” #include <openssl/rand.h>

const char *
RAND_file_name(char *buf, size_t num);

int
RAND_load_file(const char *filename, long max_bytes);

int
RAND_write_file(const char *filename);

πŸ’… DESCRIPTION πŸ’…

  • RAND_file_name() β€” returns a default path for the random seed file 🌈. buf points to a buffer of size num where the filename gets stored. If num is too small for the path name, an error occurs 😭.
  • RAND_load_file() β€” used to allow for the state of the random number generator to be controlled by external sources πŸ‘€. It is kept for ABI compatibility but is no longer functional, and should not be used in new programs 🚫.
bestie, fr fr: RAND_load_file() is basically a legacy icon that no longer does the thing. do not build new stuff on it πŸ’€
  • RAND_write_file() β€” writes a number of random bytes (currently 1024) to file filename πŸŽ€βœ¨.

πŸŽ€ RETURN VALUES πŸŽ€

  • RAND_load_file() β€” returns max_bytes, or a bogus positive value if max_bytes is -1 πŸ˜­πŸ™ˆ.
  • RAND_write_file() β€” returns the number of bytes written, or a number less than or equal to 1 if an error occurs πŸ’€.
  • RAND_file_name() β€” returns a pointer to buf on success or NULL on error 🌸.

🧚 HISTORY 🧚

RAND_load_file(), RAND_write_file(), and RAND_file_name() first appeared in SSLeay 0.5.1 and have been available since OpenBSD 2.4 πŸ‘‘β­.


mwah πŸ’‹ this cutie came from Debian, dated June 8, 2025, and its footer tag is RAND_LOAD_FILE(3) πŸ«ΆπŸ’–

πŸ“¦ where this page comes from