CRYPTO_MEM_LEAK_CB(3ssl)
π CRYPTO_SET_MEM_FUNCTIONS β legacy OpenSSL memory allocation control
okay bestie so this one lives in the Library Functions Manual (section 3), and the vibe check is rough: every single thing on this page is a fossil π¦. It's real, it's documented, and it's giving "museum plaque". Let's get into it.
β¨ NAME β¨
CRYPTO_set_mem_functions, CRYPTO_mem_ctrl, CRYPTO_mem_leaks, CRYPTO_mem_leaks_fp, CRYPTO_mem_leaks_cb β all of them together are the legacy OpenSSL memory allocation control squad π. Emphasis on legacy, like, so much emphasis.
πΈ SYNOPSIS πΈ
#include <openssl/crypto.h>
int
CRYPTO_set_mem_functions(void *(*m)(size_t, const char *, int),
void *(*r)(void *, size_t, const char *, int),
void (*f)(void *, const char *, int));
int
CRYPTO_mem_ctrl(int mode);
int
CRYPTO_mem_leaks(BIO *b);
int
CRYPTO_mem_leaks_fp(FILE *fp);
typedef int *
CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
int
CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
like, look at all those function pointers π . Gorgeous. Useless. Both things can be true.
π DESCRIPTION π
okay so I need you to hear me on this one, fr fr:
Do not use any of the interfaces documented here. π« They are provided purely for compatibility with legacy application code. That's it. That's the whole reason they exist. Nostalgia. Vibes. Old code that refuses to die π.
and like, it gets better (worse). CRYPTO_set_mem_functions(), CRYPTO_mem_ctrl(), CRYPTO_mem_leaks(), CRYPTO_mem_leaks_fp(), and CRYPTO_mem_leaks_cb() have no effect. Not "limited effect". Not "deprecated effect". No effect. They are decoration. They are the throw pillows of the OpenSSL API ποΈβ¨.
π¦ RETURN VALUES π¦
the returns are honestly iconic in how committed they are to doing nothing:
CRYPTO_set_mem_functions()β always returns0. every time. no matter what you pass it. zero. π«ΆCRYPTO_mem_ctrl()β always returnsCRYPTO_MEM_CHECK_OFF. always. the answer is baked in π₯CRYPTO_mem_leaks(),CRYPTO_mem_leaks_fp(), andCRYPTO_mem_leaks_cb()β always return-1. all three. matching. coordinated. slay π
like the consistency?? honestly obsessed. it's giving "I was told to be here and I am technically here" energy π
π SEE ALSO π
crypto(3)β go read this one instead, bestie, it's the actual main character π
β HISTORY β
storytime π§, because these lil guys have been around:
CRYPTO_mem_ctrl(),CRYPTO_mem_leaks(), andCRYPTO_mem_leaks_fp()first appeared in SSLeay 0.6.4.CRYPTO_set_mem_functions()first appeared in SSLeay 0.6.5.CRYPTO_mem_leaks_cb()first appeared in SSLeay 0.6.6.
and then β the glow-up β all these functions have all been available since OpenBSD 2.4 πΈ. ancient. legendary. still here. still doing nothing. periodt π
ngl the whole page is basically one long "please don't" and I respect the honesty π
this lil museum tour was brought to you by the Debian crew, dated March 8, 2025 β happy reading, bestie, and remember: don't call these. seriously. ily, bye ππ¦
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2016 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