RAND_ADD(3ossl)
π² RAND_ADD π (that's RAND_ADD(3ossl), from the OpenSSL fam)
okay so bestie, welcome to the randomness page β¨ this is the OpenSSL manual for a whole lil squad of functions:
RAND_addRAND_pollRAND_seedRAND_statusRAND_eventRAND_screenRAND_keep_random_devices_open
and their whole thing is add randomness to the PRNG or get its status π yeah. the PRNG. we're feeding the vibes machine. let's go π
β¨ SYNOPSIS β¨
#include <openssl/rand.h>
int RAND_status(void);
int RAND_poll();
void RAND_add(const void *buf, int num, double randomness);
void RAND_seed(const void *buf, int num);
void RAND_keep_random_devices_open(int keep);
now the deprecated girlies π«Ά the following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):
int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);
void RAND_screen(void);
like, they're still here but they're giving "senior year, checked out" π
πΈ DESCRIPTION πΈ
So these functions can be used to seed the random generator and to check its seeded state. In general, manual (re-)seeding of the default OpenSSL random generator (RAND_OpenSSL(3)) is not necessary (but allowed), since it does (re-)seed itself automatically using trusted system entropy sources. This holds unless the default RAND_METHOD has been replaced or OpenSSL was built with automatic reseeding disabled, see RAND(7) for more details.
like, she's independent. she seeds herself. you don't gotta helicopter-parent her π (unless somebody swapped out the RAND_METHOD or the build turned auto-reseed off, then yeah, read RAND(7))
π the individual icons
RAND_status()β indicates whether or not the random generator has been sufficiently seeded. If not, functions such asRAND_bytes(3)will fail. it's literally the vibe check for your entropy π₯RAND_poll()β uses the system's capabilities to seed the random generator using random input obtained from polling various trusted entropy sources. The default choice of the entropy source can be modified at build time, seeRAND(7)for more details. she goes out and collects π§RAND_add()β mixes thenumbytes atbufinto the internal state of the random generator. This function will not normally be needed, as mentioned above. Therandomnessargument is an estimate of how much randomness is contained inbuf, in bytes, and should be a number between zero andnum. Details about sources of randomness and how to estimate their randomness can be found in the literature; for example [NIST SP 800-90B]. The content ofbufcannot be recovered from subsequent random generator output. Applications that intend to save and restore random state in an external file should consider usingRAND_load_file(3)instead.
so like, num bytes in, randomness is your honest guess of how much actual entropy is in there (between zero and num, bestie, don't be lying). and no cap β the content of buf cannot be recovered from subsequent random generator output. one-way trip. she takes the secret to the grave π
NOTE: In FIPS mode, random data provided by the application is not considered to be a trusted entropy source. It is mixed into the internal state of the RNG as additional data only and this does not count as a full reseed. For more details, see EVP_RAND(7). π«Ά so like in FIPS mode your lil contribution is a snack, not a meal. noted.
RAND_seed()β is equivalent toRAND_add()withrandomnessset tonum. same function, different fit. iconic shortcut energy πRAND_keep_random_devices_open()β is used to control file descriptor usage by the random seed sources. Some seed sources maintain open file descriptors by default, which allows such sources to operate in achroot(2)jail without the associated device nodes being available. When thekeepargument is zero, this call disables the retention of file descriptors. Conversely, a nonzero argument enables the retention of file descriptors. This function is usually called during initialization and it takes effect immediately. This capability only applies to the default provider.
so: keep == 0 β stop hoarding file descriptors. keep != 0 β keep hoarding them π usually called during initialization, and it takes effect immediately, no waiting around. and psst β this capability only applies to the default provider. iykyk.
RAND_event()andRAND_screen()β are equivalent toRAND_poll()and exist for compatibility reasons only. See HISTORY section below. they're literally justRAND_poll()in a legacy trench coat π
π¦ RETURN VALUES π¦
RAND_status()returns1if the random generator has been seeded with enough data,0otherwise.RAND_poll()returns1if it generated seed data,0otherwise.RAND_event()returnsRAND_status().- The other functions do not return values.
so like a 1 is a slay and a 0 is a "not yet bestie" π the rest are void, they just do and leave π
π SEE ALSO π
RAND_bytes(3), RAND_egd(3), RAND_load_file(3), RAND(7) EVP_RAND(7)
go read the whole friend group π«Ά
π HISTORY π
RAND_event() and RAND_screen() were deprecated in OpenSSL 1.1.0 and should not be used.
periodt. leave them in the past where they belong π
π COPYRIGHT π
Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π this was RAND_ADD(3ossl) from OpenSSL version 3.5.6, dated 2026-04-07 β mwah, go seed something responsibly πβ¨πΈ
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms