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