diff options
author | tb <> | 2024-03-02 11:28:46 +0000 |
---|---|---|
committer | tb <> | 2024-03-02 11:28:46 +0000 |
commit | 9b9fc000d4d482c0c3086b0e54b4c1a88c76ee34 (patch) | |
tree | f40142fa94b70538607eebd6e277749aa7bb40c1 /src/lib/libcrypto/malloc-wrapper.c | |
parent | e26a003ae69c592a266ff1b2331d6206111a56db (diff) | |
download | openbsd-9b9fc000d4d482c0c3086b0e54b4c1a88c76ee34.tar.gz openbsd-9b9fc000d4d482c0c3086b0e54b4c1a88c76ee34.tar.bz2 openbsd-9b9fc000d4d482c0c3086b0e54b4c1a88c76ee34.zip |
Remove a bunch of CRYPTO memory API
This was neutered early on in the fork and has been rotting ever since.
Some parts of the API are still used, but it's easier to clean up when
most of the mess is gone.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/malloc-wrapper.c')
-rw-r--r-- | src/lib/libcrypto/malloc-wrapper.c | 150 |
1 files changed, 1 insertions, 149 deletions
diff --git a/src/lib/libcrypto/malloc-wrapper.c b/src/lib/libcrypto/malloc-wrapper.c index 4d57f00b23..e13cc23373 100644 --- a/src/lib/libcrypto/malloc-wrapper.c +++ b/src/lib/libcrypto/malloc-wrapper.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc-wrapper.c,v 1.8 2023/07/08 08:28:23 beck Exp $ */ | 1 | /* $OpenBSD: malloc-wrapper.c,v 1.9 2024/03/02 11:28:46 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Bob Beck | 3 | * Copyright (c) 2014 Bob Beck |
4 | * | 4 | * |
@@ -36,111 +36,6 @@ CRYPTO_set_mem_ex_functions(void *(*m)(size_t, const char *, int), | |||
36 | } | 36 | } |
37 | LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions); | 37 | LCRYPTO_ALIAS(CRYPTO_set_mem_ex_functions); |
38 | 38 | ||
39 | int | ||
40 | CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*f)(void *)) | ||
41 | { | ||
42 | return 0; | ||
43 | } | ||
44 | LCRYPTO_ALIAS(CRYPTO_set_locked_mem_functions); | ||
45 | |||
46 | int | ||
47 | CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t, const char *, int), | ||
48 | void (*f)(void *)) | ||
49 | { | ||
50 | return 0; | ||
51 | } | ||
52 | LCRYPTO_ALIAS(CRYPTO_set_locked_mem_ex_functions); | ||
53 | |||
54 | int | ||
55 | CRYPTO_set_mem_debug_functions(void (*m)(void *, int, const char *, int, int), | ||
56 | void (*r)(void *, void *, int, const char *, int, int), | ||
57 | void (*f)(void *, int), void (*so)(long), long (*go)(void)) | ||
58 | { | ||
59 | return 0; | ||
60 | } | ||
61 | LCRYPTO_ALIAS(CRYPTO_set_mem_debug_functions); | ||
62 | |||
63 | |||
64 | void | ||
65 | CRYPTO_get_mem_functions(void *(**m)(size_t), void *(**r)(void *, size_t), | ||
66 | void (**f)(void *)) | ||
67 | { | ||
68 | if (m != NULL) | ||
69 | *m = malloc; | ||
70 | if (r != NULL) | ||
71 | *r = realloc; | ||
72 | if (f != NULL) | ||
73 | *f = free; | ||
74 | } | ||
75 | LCRYPTO_ALIAS(CRYPTO_get_mem_functions); | ||
76 | |||
77 | void | ||
78 | CRYPTO_get_mem_ex_functions(void *(**m)(size_t, const char *, int), | ||
79 | void *(**r)(void *, size_t, const char *, int), void (**f)(void *)) | ||
80 | { | ||
81 | if (m != NULL) | ||
82 | *m = NULL; | ||
83 | if (r != NULL) | ||
84 | *r = NULL; | ||
85 | if (f != NULL) | ||
86 | *f = free; | ||
87 | } | ||
88 | LCRYPTO_ALIAS(CRYPTO_get_mem_ex_functions); | ||
89 | |||
90 | void | ||
91 | CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *)) | ||
92 | { | ||
93 | if (m != NULL) | ||
94 | *m = malloc; | ||
95 | if (f != NULL) | ||
96 | *f = free; | ||
97 | } | ||
98 | LCRYPTO_ALIAS(CRYPTO_get_locked_mem_functions); | ||
99 | |||
100 | void | ||
101 | CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t, const char *, int), | ||
102 | void (**f)(void *)) | ||
103 | { | ||
104 | if (m != NULL) | ||
105 | *m = NULL; | ||
106 | if (f != NULL) | ||
107 | *f = free; | ||
108 | } | ||
109 | LCRYPTO_ALIAS(CRYPTO_get_locked_mem_ex_functions); | ||
110 | |||
111 | void | ||
112 | CRYPTO_get_mem_debug_functions(void (**m)(void *, int, const char *, int, int), | ||
113 | void (**r)(void *, void *, int, const char *, int, int), | ||
114 | void (**f)(void *, int), void (**so)(long), long (**go)(void)) | ||
115 | { | ||
116 | if (m != NULL) | ||
117 | *m = NULL; | ||
118 | if (r != NULL) | ||
119 | *r = NULL; | ||
120 | if (f != NULL) | ||
121 | *f = NULL; | ||
122 | if (so != NULL) | ||
123 | *so = NULL; | ||
124 | if (go != NULL) | ||
125 | *go = NULL; | ||
126 | } | ||
127 | LCRYPTO_ALIAS(CRYPTO_get_mem_debug_functions); | ||
128 | |||
129 | |||
130 | void * | ||
131 | CRYPTO_malloc_locked(int num, const char *file, int line) | ||
132 | { | ||
133 | if (num <= 0) | ||
134 | return NULL; | ||
135 | return malloc(num); | ||
136 | } | ||
137 | |||
138 | void | ||
139 | CRYPTO_free_locked(void *ptr) | ||
140 | { | ||
141 | free(ptr); | ||
142 | } | ||
143 | |||
144 | void * | 39 | void * |
145 | CRYPTO_malloc(int num, const char *file, int line) | 40 | CRYPTO_malloc(int num, const char *file, int line) |
146 | { | 41 | { |
@@ -155,51 +50,8 @@ CRYPTO_strdup(const char *str, const char *file, int line) | |||
155 | return strdup(str); | 50 | return strdup(str); |
156 | } | 51 | } |
157 | 52 | ||
158 | void * | ||
159 | CRYPTO_realloc(void *ptr, int num, const char *file, int line) | ||
160 | { | ||
161 | if (num <= 0) | ||
162 | return NULL; | ||
163 | return realloc(ptr, num); | ||
164 | } | ||
165 | |||
166 | void * | ||
167 | CRYPTO_realloc_clean(void *ptr, int old_len, int num, const char *file, | ||
168 | int line) | ||
169 | { | ||
170 | if (num <= 0) | ||
171 | return NULL; | ||
172 | /* Original does not support shrinking. */ | ||
173 | if (num < old_len) | ||
174 | return NULL; | ||
175 | return recallocarray(ptr, old_len, num, 1); | ||
176 | } | ||
177 | LCRYPTO_ALIAS(CRYPTO_realloc_clean); | ||
178 | |||
179 | void | 53 | void |
180 | CRYPTO_free(void *ptr) | 54 | CRYPTO_free(void *ptr) |
181 | { | 55 | { |
182 | free(ptr); | 56 | free(ptr); |
183 | } | 57 | } |
184 | |||
185 | void * | ||
186 | CRYPTO_remalloc(void *a, int num, const char *file, int line) | ||
187 | { | ||
188 | free(a); | ||
189 | return malloc(num); | ||
190 | } | ||
191 | LCRYPTO_ALIAS(CRYPTO_remalloc); | ||
192 | |||
193 | void | ||
194 | CRYPTO_set_mem_debug_options(long bits) | ||
195 | { | ||
196 | return; | ||
197 | } | ||
198 | LCRYPTO_ALIAS(CRYPTO_set_mem_debug_options); | ||
199 | |||
200 | long | ||
201 | CRYPTO_get_mem_debug_options(void) | ||
202 | { | ||
203 | return 0; | ||
204 | } | ||
205 | LCRYPTO_ALIAS(CRYPTO_get_mem_debug_options); | ||