OPENSSL_INIT_CRYPTO(3)
π OPENSSL_INIT_CRYPTO π
okay bestie, real talk β this one's from the Library Functions Manual, and it's about that crypto library startup/shutdown vibe. buckle up π
β¨ NAME β¨
OPENSSL_init_crypto, OPENSSL_init, OPENSSL_cleanup β the whole "wake up the crypto library" and "put the crypto library to bed" situation π
πΈ SYNOPSIS πΈ
library βlibcryptoβ #include <openssl/crypto.h>
int
OPENSSL_init_crypto(uint64_t options, const void *dummy);
void
OPENSSL_init(void);
void
OPENSSL_cleanup(void);
she's giving very specific function signatures, and we respect her for it π«Ά
π¦ DESCRIPTION π¦
okay so first thing β OPENSSL_init_crypto() and OPENSSL_init() are deprecated. like, genuinely deprecated. it is never useful for an application program to call either of them explicitly. not once. not ever. the audacity of some code, honestly π
the library just calls OPENSSL_init_crypto() internally, all by itself, with an options argument of 0, whenever it needs to. and the safest assumption? literally any function might do it. so don't act surprised. π§
want to enable or disable the standard configuration file? use OPENSSL_config(3) or OPENSSL_no_config(3) instead, respectively, bestie. want to load a non-standard configuration file? that's a whole different thing β go see CONF_modules_load_file(3).
now, if OPENSSL_init_crypto() gets called before any other crypto or ssl functions, the crypto library gets initialised by allocating various internal resources β in particular, it calls ERR_load_crypto_strings(3). iconic behaviour tbh π
the following options are supported:
OPENSSL_INIT_LOAD_CONFIGβ at the end of the initialization, callOPENSSL_config(3)with aNULLargument, loading the default configuration file. πOPENSSL_INIT_NO_LOAD_CONFIGβ ignore any later calls toOPENSSL_config(3). like, blocked. π«
the other options flags defined by OpenSSL are all ignored by LibreSSL. all of them. and the dummy argument has no effect whatsoever β it's literally just vibing there π
if this function is called more than once, none of the calls except the first one have any effect. first one ate and left no crumbs π
OPENSSL_init() has no effect at all. no notes. π
OPENSSL_cleanup() frees process-wide resources allocated by libcrypto. and listen β it is intended exclusively for the final shutdown of libcrypto in a process. exclusively. before you call it, the application has to make sure all other threads that may use libcrypto have stopped, and that no library component will use libcrypto again. after it returns, libcrypto cannot be reinitialized and no libcrypto or libssl function may be called. like, that's it, it's over, doors closed π₯
π¨OPENSSL_cleanup()is not a replacement for deprecated cleanup functions such asCRYPTO_cleanup_all_ex_data(3), and it must not be called after individual cryptographic operations, or when an individual library component is finished withlibcrypto. so please, do not use it like that. i'm begging π
π RETURN VALUES π
OPENSSL_init_crypto() is intended to return 1 on success or 0 on error. intended. keep that word in mind, bestie, because the BUGS section is about to have opinions π
β SEE ALSO β
go read those, iykyk πΈ
π HISTORY π
OPENSSL_init()first appeared in OpenSSL 1.0.0e and has been available since OpenBSD 5.3. it stopped having any effect in OpenSSL 1.1.1 and in OpenBSD 5.6. glow-down of the century, lowkey πOPENSSL_init_crypto()first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.3. π¦OPENSSL_cleanup()first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 7.2. π
π BUGS π
okay this is the part where we get real, bestie. OPENSSL_init_crypto() silently ignores almost all kinds of errors. almost all of them. π
in particular, if memory allocation fails, initialisation is likely to remain incomplete, the library may be in an inconsistent internal state β and the return value will usually indicate success anyway. the way that it just lies to your face π
there is no way for the application program to find out whether library initialisation is actually complete, nor to get back to a consistent state if it isn't. not one way. not even a little one. π
highkey the most relatable bug: says "yeah all good" while absolutely not being all good. main character energy, terrible engineering energy.
kay that's the whole page, bestie β every flag, every caveat, every slightly cursed historical detail, all accounted for π
this cutie dropped as part of Debian, dated August 30, 2026 β and that's the sign-off, mwah πβ¨
π¦ where this page comes from
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms