RAND_EGD(3SSL)
π RAND_EGD π
okay bestie, gather round, because this one is a little vintage. This is the OpenSSL manpage for RAND_egd, RAND_egd_bytes and RAND_query_egd_bytes β three functions whose whole job is sliding into a daemon's DMs and asking it for some randomness. (Manual section: 3SSL, iykyk. π¦)
πΈ NAME πΈ
RAND_egd, RAND_egd_bytes, RAND_query_egd_bytes β query entropy gathering daemon
β¨ SYNOPSIS β¨
no cap, here's the vibe:
#include <openssl/rand.h>
int RAND_egd_bytes(const char *path, int num);
int RAND_egd(const char *path);
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int num);
π DESCRIPTION π
so on older platforms where there's no good source of randomness lying around β think no "/dev/urandom" β you can still hit up an Entropy Gathering Daemon (EGD, king of the socket era π
) over a local socket, grab some randomness, and use it to seed the OpenSSL RNG. The protocol it speaks is the one defined by the EGDs that live at <http://egd.sourceforge.net/> or <http://prngd.sourceforge.net>. periodt.
RAND_egd_bytes()β asks fornumbytes of randomness from an EGD sitting at the socketpath, then takes whatever data comes back and hands it straight toRAND_add(). β¨RAND_egd()β literally the same thing asRAND_egd_bytes()but withnumset to255. that's the whole difference, bestie.RAND_query_egd_bytes()β also requestsnumbytes of randomness from an EGD at the socketpath, except herenummust be less than 256. IfbufisNULL, it's justRAND_egd_bytes()in a trench coat. Ifbufis notNULL, then the data gets copied into the buffer andRAND_add()is not called. noted. π
also, fun fact: OpenSSL can be configured at build time to try to use the EGD for seeding automatically. fancy.
π RETURN VALUES π
RAND_egd()andRAND_egd_bytes()return the number of bytes read from the daemon when things go right π₯ β or-1if the connection failed, or if the daemon didn't return enough data to fully seed the PRNG. (rude of it, honestly.)RAND_query_egd_bytes()returns the number of bytes read from the daemon on success, or-1if the connection failed.
π heads up: that -1 is the "something went wrong" flag for all three of them. check it. always check it.
π SEE ALSO π
π COPYRIGHT π
Copyright 2000-2018 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 π«Ά tysm for reading, this was RAND_EGD(3SSL) from OpenSSL 4.0.3, dated 2026-09-29. slay, stay random, and go check your return values π
β¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms