diff options
author | schwarze <> | 2016-11-28 16:33:48 +0000 |
---|---|---|
committer | schwarze <> | 2016-11-28 16:33:48 +0000 |
commit | 73b7d4e652c0b4c202146042cde610213cb6deb6 (patch) | |
tree | b4432d5254277778fb343300adaa304b4acbaa07 | |
parent | 0339461929d35f3b9c067030ce31fe1d956a3513 (diff) | |
download | openbsd-73b7d4e652c0b4c202146042cde610213cb6deb6.tar.gz openbsd-73b7d4e652c0b4c202146042cde610213cb6deb6.tar.bz2 openbsd-73b7d4e652c0b4c202146042cde610213cb6deb6.zip |
Document and discourage those wrappers that we have and that OpenSSL
documents, too. There are many additional undocumented ones in our
public OpenSSL headers, but advertising those would be a bad idea.
Nothing of the text from OPENSSL_malloc.pod remains, so use my own
Copyright and license.
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/man/OPENSSL_malloc.3 | 172 |
2 files changed, 174 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index a1cc37cb35..fc9f62bd06 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.56 2016/11/27 20:40:07 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.57 2016/11/28 16:33:48 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -131,6 +131,7 @@ MAN= \ | |||
131 | OPENSSL_VERSION_NUMBER.3 \ | 131 | OPENSSL_VERSION_NUMBER.3 \ |
132 | OPENSSL_config.3 \ | 132 | OPENSSL_config.3 \ |
133 | OPENSSL_load_builtin_modules.3 \ | 133 | OPENSSL_load_builtin_modules.3 \ |
134 | OPENSSL_malloc.3 \ | ||
134 | OpenSSL_add_all_algorithms.3 \ | 135 | OpenSSL_add_all_algorithms.3 \ |
135 | PEM_read_bio_PrivateKey.3 \ | 136 | PEM_read_bio_PrivateKey.3 \ |
136 | PEM_write_bio_PKCS7_stream.3 \ | 137 | PEM_write_bio_PKCS7_stream.3 \ |
diff --git a/src/lib/libcrypto/man/OPENSSL_malloc.3 b/src/lib/libcrypto/man/OPENSSL_malloc.3 new file mode 100644 index 0000000000..bc76e8367b --- /dev/null +++ b/src/lib/libcrypto/man/OPENSSL_malloc.3 | |||
@@ -0,0 +1,172 @@ | |||
1 | .\" $OpenBSD: OPENSSL_malloc.3,v 1.1 2016/11/28 16:33:48 schwarze 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: November 28 2016 $ | ||
18 | .Dt OPENSSL_MALLOC 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm OPENSSL_malloc , | ||
22 | .Nm OPENSSL_realloc , | ||
23 | .Nm OPENSSL_free , | ||
24 | .Nm OPENSSL_strdup , | ||
25 | .Nm OPENSSL_cleanse , | ||
26 | .Nm CRYPTO_malloc , | ||
27 | .Nm CRYPTO_realloc , | ||
28 | .Nm CRYPTO_free , | ||
29 | .Nm CRYPTO_strdup , | ||
30 | .Nm CRYPTO_get_mem_functions , | ||
31 | .Nm CRYPTO_set_mem_functions , | ||
32 | .Nm CRYPTO_mem_ctrl , | ||
33 | .Nm CRYPTO_mem_leaks , | ||
34 | .Nm CRYPTO_mem_leaks_fp | ||
35 | .Nd legacy OpenSSL memory allocation wrappers | ||
36 | .Sh SYNOPSIS | ||
37 | .In openssl/crypto.h | ||
38 | .Ft void * | ||
39 | .Fo OPENSSL_malloc | ||
40 | .Fa "size_t num" | ||
41 | .Fc | ||
42 | .Ft void * | ||
43 | .Fo OPENSSL_realloc | ||
44 | .Fa "void *addr" | ||
45 | .Fa "size_t num" | ||
46 | .Fc | ||
47 | .Ft void | ||
48 | .Fo OPENSSL_free | ||
49 | .Fa "void *addr" | ||
50 | .Fc | ||
51 | .Ft char * | ||
52 | .Fo OPENSSL_strdup | ||
53 | .Fa "const char *str" | ||
54 | .Fc | ||
55 | .Ft void | ||
56 | .Fo OPENSSL_cleanse | ||
57 | .Fa "void *ptr" | ||
58 | .Fa "size_t len" | ||
59 | .Fc | ||
60 | .Ft void * | ||
61 | .Fo CRYPTO_malloc | ||
62 | .Fa "size_t num" | ||
63 | .Fa "const char *file" | ||
64 | .Fa "int line" | ||
65 | .Fc | ||
66 | .Ft void * | ||
67 | .Fo CRYPTO_realloc | ||
68 | .Fa "void *p" | ||
69 | .Fa "size_t num" | ||
70 | .Fa "const char *file" | ||
71 | .Fa "int line" | ||
72 | .Fc | ||
73 | .Ft void | ||
74 | .Fo CRYPTO_free | ||
75 | .Fa "void *str" | ||
76 | .Fa "const char *" | ||
77 | .Fa int | ||
78 | .Fc | ||
79 | .Ft char * | ||
80 | .Fo CRYPTO_strdup | ||
81 | .Fa "const char *p" | ||
82 | .Fa "const char *file" | ||
83 | .Fa "int line" | ||
84 | .Fc | ||
85 | .Ft void | ||
86 | .Fo CRYPTO_get_mem_functions | ||
87 | .Fa "void *(**m)(size_t)" | ||
88 | .Fa "void *(**r)(void *, size_t)" | ||
89 | .Fa "void (**f)(void *)" | ||
90 | .Fc | ||
91 | .Ft int | ||
92 | .Fo CRYPTO_set_mem_functions | ||
93 | .Fa "void *(*m)(size_t)" | ||
94 | .Fa "void *(*r)(void *, size_t)" | ||
95 | .Fa "void (*f)(void *)" | ||
96 | .Fc | ||
97 | .Ft int | ||
98 | .Fo CRYPTO_mem_ctrl | ||
99 | .Fa "int mode" | ||
100 | .Fc | ||
101 | .Ft void | ||
102 | .Fo CRYPTO_mem_leaks | ||
103 | .Fa "BIO *b" | ||
104 | .Fc | ||
105 | .Ft void | ||
106 | .Fo CRYPTO_mem_leaks_fp | ||
107 | .Fa "FILE *fp" | ||
108 | .Fc | ||
109 | .Sh DESCRIPTION | ||
110 | Do not use any of the interfaces documented here. | ||
111 | They are provided purely for compatibility with legacy application code. | ||
112 | .Pp | ||
113 | .Fn OPENSSL_malloc , | ||
114 | .Fn OPENSSL_realloc , | ||
115 | .Fn OPENSSL_free , | ||
116 | and | ||
117 | .Fn OPENSSL_strdup | ||
118 | have the same semantics as | ||
119 | .Xr malloc 3 , | ||
120 | .Xr realloc 3 , | ||
121 | .Xr free 3 , | ||
122 | and | ||
123 | .Xr strdup 3 . | ||
124 | They are wrapper macros around | ||
125 | .Fn CRYPTO_malloc , | ||
126 | .Fn CRYPTO_realloc , | ||
127 | .Fn CRYPTO_free , | ||
128 | and | ||
129 | .Fn CRYPTO_strdup , | ||
130 | which in turn are wrapper functions around | ||
131 | .Xr malloc 3 , | ||
132 | .Xr realloc 3 , | ||
133 | .Xr free 3 , | ||
134 | and | ||
135 | .Xr strdup 3 . | ||
136 | .Pp | ||
137 | .Fn OPENSSL_cleanse | ||
138 | has the same semantics as and is a wrapper around | ||
139 | .Xr explicit_bzero 3 . | ||
140 | .Pp | ||
141 | .Fn CRYPTO_get_mem_functions | ||
142 | assigns pointers to the C library functions | ||
143 | .Xr malloc 3 , | ||
144 | .Xr realloc 3 , | ||
145 | and | ||
146 | .Xr free 3 | ||
147 | to those of its arguments that are not | ||
148 | .Dv NULL. | ||
149 | .Pp | ||
150 | .Fn CRYPTO_set_mem_functions , | ||
151 | .Fn CRYPTO_mem_ctrl , | ||
152 | .Fn CRYPTO_mem_leaks , | ||
153 | and | ||
154 | .Fn CRYPTO_mem_leaks_fp | ||
155 | have no effect. | ||
156 | .Sh RETURN VALUES | ||
157 | .Fn OPENSSL_malloc , | ||
158 | .Fn OPENSSL_realloc , | ||
159 | .Fn CRYPTO_malloc , | ||
160 | .Fn CRYPTO_realloc , | ||
161 | and | ||
162 | .Fn OPENSSL_strdup | ||
163 | return a pointer to allocated memory or | ||
164 | .Dv NULL | ||
165 | on error. | ||
166 | .Pp | ||
167 | .Fn CRYPTO_set_mem_functions | ||
168 | always returns 0. | ||
169 | .Pp | ||
170 | .Fn CRYPTO_mem_ctrl | ||
171 | always returns | ||
172 | .Dv CRYPTO_MEM_CHECK_OFF . | ||