1.\" $OpenBSD: OPENSSL_malloc.3,v 1.13 2024/04/04 09:30:43 tb Exp $ 2.\" 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: April 4 2024 $ 18.Dt OPENSSL_MALLOC 3 19.Os 20.Sh NAME 21.Nm OPENSSL_malloc , 22.Nm OPENSSL_free , 23.Nm OPENSSL_strdup , 24.Nm CRYPTO_malloc , 25.Nm CRYPTO_free , 26.Nm CRYPTO_strdup 27.Nd legacy OpenSSL memory allocation wrappers 28.Sh SYNOPSIS 29.In openssl/crypto.h 30.Ft void * 31.Fo OPENSSL_malloc 32.Fa "size_t num" 33.Fc 34.Ft void 35.Fo OPENSSL_free 36.Fa "void *addr" 37.Fc 38.Ft char * 39.Fo OPENSSL_strdup 40.Fa "const char *str" 41.Fc 42.Ft void * 43.Fo CRYPTO_malloc 44.Fa "size_t num" 45.Fa "const char *file" 46.Fa "int line" 47.Fc 48.Ft void 49.Fo CRYPTO_free 50.Fa "void *str" 51.Fa "const char *" 52.Fa int 53.Fc 54.Ft char * 55.Fo CRYPTO_strdup 56.Fa "const char *p" 57.Fa "const char *file" 58.Fa "int line" 59.Fc 60.Sh DESCRIPTION 61Do not use any of the interfaces documented here in new code. 62They are provided purely for compatibility with legacy application code. 63.Pp 64These functions are wrappers around the corresponding 65standard 66.Xr malloc 3 , 67.Xr free 3 , 68and 69.Xr strdup 3 70functions. 71.Pp 72The 73.Fn OPENSSL_* 74functions are implemented as macros. 75.Sh RETURN VALUES 76These functions return the same type and value as the corresponding 77standard functions. 78.Sh SEE ALSO 79.Xr crypto 3 80.Sh HISTORY 81.Fn CRYPTO_malloc 82and 83.Fn CRYPTO_free 84first appeared in SSLeay 0.6.4 and have been available since 85.Ox 2.4 . 86.Pp 87.Fn OPENSSL_malloc 88and 89.Fn OPENSSL_free 90first appeared in OpenSSL 0.9.6 and have been available since 91.Ox 2.9 . 92.Pp 93.Fn CRYPTO_strdup 94and 95.Fn OPENSSL_strdup 96first appeared in OpenSSL 0.9.8j and have been available since 97.Ox 4.5 . 98.Sh CAVEATS 99If interoperability with other implementations is required, 100memory returned by the library as bare pointers must be freed with 101.Fn OPENSSL_free . 102