CRYPTO_MEM_LEAK_CB(3ssl)

πŸ“¦ version 4.1.0, in opensuse-leap 16.0

πŸ’€ 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 returns 0. every time. no matter what you pass it. zero. 🫢
  • CRYPTO_mem_ctrl() β€” always returns CRYPTO_MEM_CHECK_OFF. always. the answer is baked in πŸ”₯
  • CRYPTO_mem_leaks(), CRYPTO_mem_leaks_fp(), and CRYPTO_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(), and CRYPTO_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