---
name: "libressl-CRYPTO_set_mem_functions"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-CRYPTO_set_mem_functions"
---

# libressl-CRYPTO\_set\_mem\_functions(3)

legacy OpenSSL memory allocation control

## NAME

**CRYPTO\_set\_mem\_functions**, **CRYPTO\_mem\_ctrl**, **CRYPTO\_mem\_leaks**, **CRYPTO\_mem\_leaks\_fp**, **CRYPTO\_mem\_leaks\_cb** – legacy OpenSSL memory allocation control

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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*);

## DESCRIPTION

Do not use any of the interfaces documented here. They are provided purely for compatibility with legacy application code.

**CRYPTO\_set\_mem\_functions**(), **CRYPTO\_mem\_ctrl**(), **CRYPTO\_mem\_leaks**(), **CRYPTO\_mem\_leaks\_fp**(), and **CRYPTO\_mem\_leaks\_cb**() have no effect.

## RETURN VALUES

**CRYPTO\_set\_mem\_functions**() always returns 0.

**CRYPTO\_mem\_ctrl**() always returns CRYPTO\_MEM\_CHECK\_OFF.

**CRYPTO\_mem\_leaks**(), **CRYPTO\_mem\_leaks\_fp**(), and **CRYPTO\_mem\_leaks\_cb**() always return -1.

## SEE ALSO

[crypto(3)](/crypto/3.md)

## HISTORY

**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. All these functions have all been available since OpenBSD 2.4.
