RAND_ADD(3)

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

πŸ’… RAND_ADD(3) β€” like, the actual manual, bestie

okay so real talk β€” this page lives in Library Functions Manual, and it's all about RAND_add, RAND_cleanup, RAND_poll, RAND_seed, and RAND_status, aka the little crew that used to "manipulate the PRNG state". Yes queen, we're talking about the random number generator. Sit down, this one's short and honestly a little sad. πŸ₯²


✨ NAME ✨

RAND_add, RAND_cleanup, RAND_poll, RAND_seed, RAND_status β€” manipulate the PRNG state


πŸŽ€ SYNOPSIS πŸŽ€

so first things first, you gotta pull in the library, mwah:

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

and then these five icons are just vibing here:

void
RAND_add(const void *buf, int num, double entropy);

void
RAND_cleanup(void);

int
RAND_poll(void);

void
RAND_seed(const void *buf, int num);

int
RAND_status(void);

copy them exactly if you must, but like… read DESCRIPTION first bestie, i'm begging 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea. These functions used to allow for the state of the random number generator to be controlled by external sources. emphasis on used to. past tense. it's giving retired pop star. πŸ’€

they're kept for ABI compatibility but β€” and this is the part where i hold your hand β€” they are no longer functional, and should not be used in new programs. not now, not ever, not for a little side project at 3am. periodt.

like, the way that these are literally just decorative at this point 😭. they're here so old binaries don't break</>, that's the whole entire job. main character energy of a cardboard cutout ngl.

bestie pls do not build new code on these. they will not do the thing you think they do. the vibe check says no. πŸ™ˆ

🌸 RETURN VALUES 🌸

short and sweet: RAND_poll() and RAND_status() always return 1. that's it. that's the whole bit. iconic honestly, no notes, no drama, no error paths to memorize. πŸŽ€


⭐ HISTORY ⭐

storytime with your fav unix gossip account 🧚:

  • RAND_cleanup() and RAND_seed() first appeared in SSLeay 0.5.1 and have been available since OpenBSD 2.4.
  • RAND_add() and RAND_status() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.
  • RAND_poll() first appeared in OpenSSL 0.9.6 and has been available since OpenBSD 2.9.

so yeah: ancient. legends. fossils in the best way. they've been around longer than most of us have had wifi πŸ”₯


k bye, this page is from Debian, dated June 8, 2025 πŸ’– β€” go use the new random APIs, i'm rooting for you, slay βœ¨πŸ‘‘

πŸ“¦ where this page comes from