xref: /freebsd/crypto/openssl/include/openssl/lhash.h (revision 1731fc70f7344af08db49b06c63c963fa12ee354)
1 /*
2  * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 /* clang-format off */
11 
12 /* clang-format on */
13 
14 /*
15  * Header for dynamic hash table routines Author - Eric Young
16  */
17 
18 #ifndef OPENSSL_LHASH_H
19 #define OPENSSL_LHASH_H
20 #pragma once
21 
22 #include <openssl/macros.h>
23 #ifndef OPENSSL_NO_DEPRECATED_3_0
24 #define HEADER_LHASH_H
25 #endif
26 
27 #include <openssl/e_os2.h>
28 #include <openssl/bio.h>
29 #ifndef OPENSSL_NO_STDIO
30 #include <stdio.h>
31 #endif
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 typedef struct lhash_node_st OPENSSL_LH_NODE;
38 typedef int (*OPENSSL_LH_COMPFUNC)(const void *, const void *);
39 typedef int (*OPENSSL_LH_COMPFUNCTHUNK)(const void *, const void *, OPENSSL_LH_COMPFUNC cfn);
40 typedef unsigned long (*OPENSSL_LH_HASHFUNC)(const void *);
41 typedef unsigned long (*OPENSSL_LH_HASHFUNCTHUNK)(const void *, OPENSSL_LH_HASHFUNC hfn);
42 typedef void (*OPENSSL_LH_DOALL_FUNC)(void *);
43 typedef void (*OPENSSL_LH_DOALL_FUNC_THUNK)(void *, OPENSSL_LH_DOALL_FUNC doall);
44 typedef void (*OPENSSL_LH_DOALL_FUNCARG)(void *, void *);
45 typedef void (*OPENSSL_LH_DOALL_FUNCARG_THUNK)(void *, void *, OPENSSL_LH_DOALL_FUNCARG doall);
46 typedef struct lhash_st OPENSSL_LHASH;
47 
48 /*
49  * Macros for declaring and implementing type-safe wrappers for LHASH
50  * callbacks. This way, callbacks can be provided to LHASH structures without
51  * function pointer casting and the macro-defined callbacks provide
52  * per-variable casting before deferring to the underlying type-specific
53  * callbacks. NB: It is possible to place a "static" in front of both the
54  * DECLARE and IMPLEMENT macros if the functions are strictly internal.
55  */
56 
57 /* First: "hash" functions */
58 #define DECLARE_LHASH_HASH_FN(name, o_type) \
59     unsigned long name##_LHASH_HASH(const void *);
60 #define IMPLEMENT_LHASH_HASH_FN(name, o_type)        \
61     unsigned long name##_LHASH_HASH(const void *arg) \
62     {                                                \
63         const o_type *a = arg;                       \
64         return name##_hash(a);                       \
65     }
66 #define LHASH_HASH_FN(name) name##_LHASH_HASH
67 
68 /* Second: "compare" functions */
69 #define DECLARE_LHASH_COMP_FN(name, o_type) \
70     int name##_LHASH_COMP(const void *, const void *);
71 #define IMPLEMENT_LHASH_COMP_FN(name, o_type)                 \
72     int name##_LHASH_COMP(const void *arg1, const void *arg2) \
73     {                                                         \
74         const o_type *a = arg1;                               \
75         const o_type *b = arg2;                               \
76         return name##_cmp(a, b);                              \
77     }
78 #define LHASH_COMP_FN(name) name##_LHASH_COMP
79 
80 /* Fourth: "doall_arg" functions */
81 #define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
82     void name##_LHASH_DOALL_ARG(void *, void *);
83 #define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
84     void name##_LHASH_DOALL_ARG(void *arg1, void *arg2)    \
85     {                                                      \
86         o_type *a = arg1;                                  \
87         a_type *b = arg2;                                  \
88         name##_doall_arg(a, b);                            \
89     }
90 #define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG
91 
92 #define LH_LOAD_MULT 256
93 
94 int OPENSSL_LH_error(OPENSSL_LHASH *lh);
95 OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c);
96 OPENSSL_LHASH *OPENSSL_LH_set_thunks(OPENSSL_LHASH *lh,
97     OPENSSL_LH_HASHFUNCTHUNK hw,
98     OPENSSL_LH_COMPFUNCTHUNK cw,
99     OPENSSL_LH_DOALL_FUNC_THUNK daw,
100     OPENSSL_LH_DOALL_FUNCARG_THUNK daaw);
101 void OPENSSL_LH_free(OPENSSL_LHASH *lh);
102 void OPENSSL_LH_flush(OPENSSL_LHASH *lh);
103 void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data);
104 void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data);
105 void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data);
106 void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func);
107 void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh,
108     OPENSSL_LH_DOALL_FUNCARG func, void *arg);
109 void OPENSSL_LH_doall_arg_thunk(OPENSSL_LHASH *lh,
110     OPENSSL_LH_DOALL_FUNCARG_THUNK daaw,
111     OPENSSL_LH_DOALL_FUNCARG fn, void *arg);
112 
113 unsigned long OPENSSL_LH_strhash(const char *c);
114 unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh);
115 unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh);
116 void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load);
117 
118 #ifndef OPENSSL_NO_STDIO
119 #ifndef OPENSSL_NO_DEPRECATED_3_1
120 OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp);
121 OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp);
122 OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp);
123 #endif
124 #endif
125 #ifndef OPENSSL_NO_DEPRECATED_3_1
126 OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out);
127 OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out);
128 OSSL_DEPRECATEDIN_3_1 void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out);
129 #endif
130 
131 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
132 #define _LHASH OPENSSL_LHASH
133 #define LHASH_NODE OPENSSL_LH_NODE
134 #define lh_error OPENSSL_LH_error
135 #define lh_new OPENSSL_LH_new
136 #define lh_free OPENSSL_LH_free
137 #define lh_insert OPENSSL_LH_insert
138 #define lh_delete OPENSSL_LH_delete
139 #define lh_retrieve OPENSSL_LH_retrieve
140 #define lh_doall OPENSSL_LH_doall
141 #define lh_doall_arg OPENSSL_LH_doall_arg
142 #define lh_strhash OPENSSL_LH_strhash
143 #define lh_num_items OPENSSL_LH_num_items
144 #ifndef OPENSSL_NO_STDIO
145 #define lh_stats OPENSSL_LH_stats
146 #define lh_node_stats OPENSSL_LH_node_stats
147 #define lh_node_usage_stats OPENSSL_LH_node_usage_stats
148 #endif
149 #define lh_stats_bio OPENSSL_LH_stats_bio
150 #define lh_node_stats_bio OPENSSL_LH_node_stats_bio
151 #define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio
152 #endif
153 
154 /* Type checking... */
155 
156 #define LHASH_OF(type) struct lhash_st_##type
157 
158 /* Helper macro for internal use */
159 #define DEFINE_LHASH_OF_INTERNAL(type)                                                                         \
160     LHASH_OF(type)                                                                                             \
161     {                                                                                                          \
162         union lh_##type##_dummy {                                                                              \
163             void *d1;                                                                                          \
164             unsigned long d2;                                                                                  \
165             int d3;                                                                                            \
166         } dummy;                                                                                               \
167     };                                                                                                         \
168     typedef int (*lh_##type##_compfunc)(const type *a, const type *b);                                         \
169     typedef unsigned long (*lh_##type##_hashfunc)(const type *a);                                              \
170     typedef void (*lh_##type##_doallfunc)(type * a);                                                           \
171     static ossl_inline unsigned long lh_##type##_hash_thunk(const void *data, OPENSSL_LH_HASHFUNC hfn)         \
172     {                                                                                                          \
173         unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn;                        \
174         return hfn_conv((const type *)data);                                                                   \
175     }                                                                                                          \
176     static ossl_inline int lh_##type##_comp_thunk(const void *da, const void *db, OPENSSL_LH_COMPFUNC cfn)     \
177     {                                                                                                          \
178         int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn;                \
179         return cfn_conv((const type *)da, (const type *)db);                                                   \
180     }                                                                                                          \
181     static ossl_inline void lh_##type##_doall_thunk(void *node, OPENSSL_LH_DOALL_FUNC doall)                   \
182     {                                                                                                          \
183         void (*doall_conv)(type *) = (void (*)(type *))doall;                                                  \
184         doall_conv((type *)node);                                                                              \
185     }                                                                                                          \
186     static ossl_inline void lh_##type##_doall_arg_thunk(void *node, void *arg, OPENSSL_LH_DOALL_FUNCARG doall) \
187     {                                                                                                          \
188         void (*doall_conv)(type *, void *) = (void (*)(type *, void *))doall;                                  \
189         doall_conv((type *)node, arg);                                                                         \
190     }                                                                                                          \
191     static ossl_unused ossl_inline type *                                                                      \
192     ossl_check_##type##_lh_plain_type(type *ptr)                                                               \
193     {                                                                                                          \
194         return ptr;                                                                                            \
195     }                                                                                                          \
196     static ossl_unused ossl_inline const type *                                                                \
197     ossl_check_const_##type##_lh_plain_type(const type *ptr)                                                   \
198     {                                                                                                          \
199         return ptr;                                                                                            \
200     }                                                                                                          \
201     static ossl_unused ossl_inline const OPENSSL_LHASH *                                                       \
202     ossl_check_const_##type##_lh_type(const LHASH_OF(type) *lh)                                                \
203     {                                                                                                          \
204         return (const OPENSSL_LHASH *)lh;                                                                      \
205     }                                                                                                          \
206     static ossl_unused ossl_inline OPENSSL_LHASH *                                                             \
207     ossl_check_##type##_lh_type(LHASH_OF(type) *lh)                                                            \
208     {                                                                                                          \
209         return (OPENSSL_LHASH *)lh;                                                                            \
210     }                                                                                                          \
211     static ossl_unused ossl_inline OPENSSL_LH_COMPFUNC                                                         \
212     ossl_check_##type##_lh_compfunc_type(lh_##type##_compfunc cmp)                                             \
213     {                                                                                                          \
214         return (OPENSSL_LH_COMPFUNC)cmp;                                                                       \
215     }                                                                                                          \
216     static ossl_unused ossl_inline OPENSSL_LH_HASHFUNC                                                         \
217     ossl_check_##type##_lh_hashfunc_type(lh_##type##_hashfunc hfn)                                             \
218     {                                                                                                          \
219         return (OPENSSL_LH_HASHFUNC)hfn;                                                                       \
220     }                                                                                                          \
221     static ossl_unused ossl_inline OPENSSL_LH_DOALL_FUNC                                                       \
222     ossl_check_##type##_lh_doallfunc_type(lh_##type##_doallfunc dfn)                                           \
223     {                                                                                                          \
224         return (OPENSSL_LH_DOALL_FUNC)dfn;                                                                     \
225     }                                                                                                          \
226     LHASH_OF(type)
227 
228 #ifndef OPENSSL_NO_DEPRECATED_3_1
229 #define DEFINE_LHASH_OF_DEPRECATED(type)                                 \
230     static ossl_unused ossl_inline void                                  \
231     lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out)       \
232     {                                                                    \
233         OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out);       \
234     }                                                                    \
235     static ossl_unused ossl_inline void                                  \
236     lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \
237     {                                                                    \
238         OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \
239     }                                                                    \
240     static ossl_unused ossl_inline void                                  \
241     lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out)            \
242     {                                                                    \
243         OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out);            \
244     }
245 #else
246 #define DEFINE_LHASH_OF_DEPRECATED(type)
247 #endif
248 
249 #define DEFINE_LHASH_OF_EX(type)                                                                                           \
250     LHASH_OF(type)                                                                                                         \
251     {                                                                                                                      \
252         union lh_##type##_dummy {                                                                                          \
253             void *d1;                                                                                                      \
254             unsigned long d2;                                                                                              \
255             int d3;                                                                                                        \
256         } dummy;                                                                                                           \
257     };                                                                                                                     \
258     static unsigned long                                                                                                   \
259     lh_##type##_hfn_thunk(const void *data, OPENSSL_LH_HASHFUNC hfn)                                                       \
260     {                                                                                                                      \
261         unsigned long (*hfn_conv)(const type *) = (unsigned long (*)(const type *))hfn;                                    \
262         return hfn_conv((const type *)data);                                                                               \
263     }                                                                                                                      \
264     static int lh_##type##_cfn_thunk(const void *da, const void *db, OPENSSL_LH_COMPFUNC cfn)                              \
265     {                                                                                                                      \
266         int (*cfn_conv)(const type *, const type *) = (int (*)(const type *, const type *))cfn;                            \
267         return cfn_conv((const type *)da, (const type *)db);                                                               \
268     }                                                                                                                      \
269     static ossl_unused ossl_inline void                                                                                    \
270     lh_##type##_free(LHASH_OF(type) *lh)                                                                                   \
271     {                                                                                                                      \
272         OPENSSL_LH_free((OPENSSL_LHASH *)lh);                                                                              \
273     }                                                                                                                      \
274     static ossl_unused ossl_inline void                                                                                    \
275     lh_##type##_flush(LHASH_OF(type) *lh)                                                                                  \
276     {                                                                                                                      \
277         OPENSSL_LH_flush((OPENSSL_LHASH *)lh);                                                                             \
278     }                                                                                                                      \
279     static ossl_unused ossl_inline type *                                                                                  \
280     lh_##type##_insert(LHASH_OF(type) *lh, type *d)                                                                        \
281     {                                                                                                                      \
282         return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d);                                                          \
283     }                                                                                                                      \
284     static ossl_unused ossl_inline type *                                                                                  \
285     lh_##type##_delete(LHASH_OF(type) *lh, const type *d)                                                                  \
286     {                                                                                                                      \
287         return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d);                                                          \
288     }                                                                                                                      \
289     static ossl_unused ossl_inline type *                                                                                  \
290     lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d)                                                                \
291     {                                                                                                                      \
292         return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d);                                                        \
293     }                                                                                                                      \
294     static ossl_unused ossl_inline int                                                                                     \
295     lh_##type##_error(LHASH_OF(type) *lh)                                                                                  \
296     {                                                                                                                      \
297         return OPENSSL_LH_error((OPENSSL_LHASH *)lh);                                                                      \
298     }                                                                                                                      \
299     static ossl_unused ossl_inline unsigned long                                                                           \
300     lh_##type##_num_items(LHASH_OF(type) *lh)                                                                              \
301     {                                                                                                                      \
302         return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh);                                                                  \
303     }                                                                                                                      \
304     static ossl_unused ossl_inline unsigned long                                                                           \
305     lh_##type##_get_down_load(LHASH_OF(type) *lh)                                                                          \
306     {                                                                                                                      \
307         return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh);                                                              \
308     }                                                                                                                      \
309     static ossl_unused ossl_inline void                                                                                    \
310     lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl)                                                        \
311     {                                                                                                                      \
312         OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl);                                                                 \
313     }                                                                                                                      \
314     static ossl_unused ossl_inline void                                                                                    \
315     lh_##type##_doall_thunk(void *node, OPENSSL_LH_DOALL_FUNC doall)                                                       \
316     {                                                                                                                      \
317         void (*doall_conv)(type *) = (void (*)(type *))doall;                                                              \
318         doall_conv((type *)node);                                                                                          \
319     }                                                                                                                      \
320     static ossl_unused ossl_inline void                                                                                    \
321     lh_##type##_doall_arg_thunk(void *node, void *arg, OPENSSL_LH_DOALL_FUNCARG doall)                                     \
322     {                                                                                                                      \
323         void (*doall_conv)(type *, void *) = (void (*)(type *, void *))doall;                                              \
324         doall_conv((type *)node, arg);                                                                                     \
325     }                                                                                                                      \
326     static ossl_unused ossl_inline void                                                                                    \
327     lh_##type##_doall(LHASH_OF(type) *lh, void (*doall)(type *))                                                           \
328     {                                                                                                                      \
329         OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall);                                               \
330     }                                                                                                                      \
331     static ossl_unused ossl_inline LHASH_OF(type) *                                                                        \
332     lh_##type##_new(unsigned long (*hfn)(const type *),                                                                    \
333         int (*cfn)(const type *, const type *))                                                                            \
334     {                                                                                                                      \
335         return (LHASH_OF(type) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn), \
336             lh_##type##_hfn_thunk, lh_##type##_cfn_thunk,                                                                  \
337             lh_##type##_doall_thunk,                                                                                       \
338             lh_##type##_doall_arg_thunk);                                                                                  \
339     }                                                                                                                      \
340     static ossl_unused ossl_inline void                                                                                    \
341     lh_##type##_doall_arg(LHASH_OF(type) *lh,                                                                              \
342         void (*doallarg)(type *, void *), void *arg)                                                                       \
343     {                                                                                                                      \
344         OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh,                                                                          \
345             (OPENSSL_LH_DOALL_FUNCARG)doallarg, arg);                                                                      \
346     }                                                                                                                      \
347     LHASH_OF(type)
348 
349 #define DEFINE_LHASH_OF(type)        \
350     DEFINE_LHASH_OF_EX(type);        \
351     DEFINE_LHASH_OF_DEPRECATED(type) \
352     LHASH_OF(type)
353 
354 #define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \
355     int_implement_lhash_doall(type, argtype, const type)
356 
357 #define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \
358     int_implement_lhash_doall(type, argtype, type)
359 
360 #define int_implement_lhash_doall(type, argtype, cbargtype)                                 \
361     static ossl_unused ossl_inline void                                                     \
362     lh_##type##_doall_##argtype##_thunk(void *node, void *arg, OPENSSL_LH_DOALL_FUNCARG fn) \
363     {                                                                                       \
364         void (*fn_conv)(cbargtype *, argtype *) = (void (*)(cbargtype *, argtype *))fn;     \
365         fn_conv((cbargtype *)node, (argtype *)arg);                                         \
366     }                                                                                       \
367     static ossl_unused ossl_inline void                                                     \
368     lh_##type##_doall_##argtype(LHASH_OF(type) *lh,                                         \
369         void (*fn)(cbargtype *, argtype *),                                                 \
370         argtype *arg)                                                                       \
371     {                                                                                       \
372         OPENSSL_LH_doall_arg_thunk((OPENSSL_LHASH *)lh,                                     \
373             lh_##type##_doall_##argtype##_thunk,                                            \
374             (OPENSSL_LH_DOALL_FUNCARG)fn,                                                   \
375             (void *)arg);                                                                   \
376     }                                                                                       \
377     LHASH_OF(type)
378 
379 /* clang-format off */
380 DEFINE_LHASH_OF_INTERNAL(OPENSSL_STRING);
381 #define lh_OPENSSL_STRING_new(hfn, cmp) ((LHASH_OF(OPENSSL_STRING) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_OPENSSL_STRING_lh_hashfunc_type(hfn), ossl_check_OPENSSL_STRING_lh_compfunc_type(cmp)), lh_OPENSSL_STRING_hash_thunk, lh_OPENSSL_STRING_comp_thunk, lh_OPENSSL_STRING_doall_thunk, lh_OPENSSL_STRING_doall_arg_thunk))
382 #define lh_OPENSSL_STRING_free(lh) OPENSSL_LH_free(ossl_check_OPENSSL_STRING_lh_type(lh))
383 #define lh_OPENSSL_STRING_flush(lh) OPENSSL_LH_flush(ossl_check_OPENSSL_STRING_lh_type(lh))
384 #define lh_OPENSSL_STRING_insert(lh, ptr) ((OPENSSL_STRING *)OPENSSL_LH_insert(ossl_check_OPENSSL_STRING_lh_type(lh), ossl_check_OPENSSL_STRING_lh_plain_type(ptr)))
385 #define lh_OPENSSL_STRING_delete(lh, ptr) ((OPENSSL_STRING *)OPENSSL_LH_delete(ossl_check_OPENSSL_STRING_lh_type(lh), ossl_check_const_OPENSSL_STRING_lh_plain_type(ptr)))
386 #define lh_OPENSSL_STRING_retrieve(lh, ptr) ((OPENSSL_STRING *)OPENSSL_LH_retrieve(ossl_check_OPENSSL_STRING_lh_type(lh), ossl_check_const_OPENSSL_STRING_lh_plain_type(ptr)))
387 #define lh_OPENSSL_STRING_error(lh) OPENSSL_LH_error(ossl_check_OPENSSL_STRING_lh_type(lh))
388 #define lh_OPENSSL_STRING_num_items(lh) OPENSSL_LH_num_items(ossl_check_OPENSSL_STRING_lh_type(lh))
389 #define lh_OPENSSL_STRING_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_OPENSSL_STRING_lh_type(lh), out)
390 #define lh_OPENSSL_STRING_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_OPENSSL_STRING_lh_type(lh), out)
391 #define lh_OPENSSL_STRING_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_OPENSSL_STRING_lh_type(lh), out)
392 #define lh_OPENSSL_STRING_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_OPENSSL_STRING_lh_type(lh))
393 #define lh_OPENSSL_STRING_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_OPENSSL_STRING_lh_type(lh), dl)
394 #define lh_OPENSSL_STRING_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_OPENSSL_STRING_lh_type(lh), ossl_check_OPENSSL_STRING_lh_doallfunc_type(dfn))
395 DEFINE_LHASH_OF_INTERNAL(OPENSSL_CSTRING);
396 #define lh_OPENSSL_CSTRING_new(hfn, cmp) ((LHASH_OF(OPENSSL_CSTRING) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_OPENSSL_CSTRING_lh_hashfunc_type(hfn), ossl_check_OPENSSL_CSTRING_lh_compfunc_type(cmp)), lh_OPENSSL_CSTRING_hash_thunk, lh_OPENSSL_CSTRING_comp_thunk, lh_OPENSSL_CSTRING_doall_thunk, lh_OPENSSL_CSTRING_doall_arg_thunk))
397 #define lh_OPENSSL_CSTRING_free(lh) OPENSSL_LH_free(ossl_check_OPENSSL_CSTRING_lh_type(lh))
398 #define lh_OPENSSL_CSTRING_flush(lh) OPENSSL_LH_flush(ossl_check_OPENSSL_CSTRING_lh_type(lh))
399 #define lh_OPENSSL_CSTRING_insert(lh, ptr) ((OPENSSL_CSTRING *)OPENSSL_LH_insert(ossl_check_OPENSSL_CSTRING_lh_type(lh), ossl_check_OPENSSL_CSTRING_lh_plain_type(ptr)))
400 #define lh_OPENSSL_CSTRING_delete(lh, ptr) ((OPENSSL_CSTRING *)OPENSSL_LH_delete(ossl_check_OPENSSL_CSTRING_lh_type(lh), ossl_check_const_OPENSSL_CSTRING_lh_plain_type(ptr)))
401 #define lh_OPENSSL_CSTRING_retrieve(lh, ptr) ((OPENSSL_CSTRING *)OPENSSL_LH_retrieve(ossl_check_OPENSSL_CSTRING_lh_type(lh), ossl_check_const_OPENSSL_CSTRING_lh_plain_type(ptr)))
402 #define lh_OPENSSL_CSTRING_error(lh) OPENSSL_LH_error(ossl_check_OPENSSL_CSTRING_lh_type(lh))
403 #define lh_OPENSSL_CSTRING_num_items(lh) OPENSSL_LH_num_items(ossl_check_OPENSSL_CSTRING_lh_type(lh))
404 #define lh_OPENSSL_CSTRING_node_stats_bio(lh, out) OPENSSL_LH_node_stats_bio(ossl_check_const_OPENSSL_CSTRING_lh_type(lh), out)
405 #define lh_OPENSSL_CSTRING_node_usage_stats_bio(lh, out) OPENSSL_LH_node_usage_stats_bio(ossl_check_const_OPENSSL_CSTRING_lh_type(lh), out)
406 #define lh_OPENSSL_CSTRING_stats_bio(lh, out) OPENSSL_LH_stats_bio(ossl_check_const_OPENSSL_CSTRING_lh_type(lh), out)
407 #define lh_OPENSSL_CSTRING_get_down_load(lh) OPENSSL_LH_get_down_load(ossl_check_OPENSSL_CSTRING_lh_type(lh))
408 #define lh_OPENSSL_CSTRING_set_down_load(lh, dl) OPENSSL_LH_set_down_load(ossl_check_OPENSSL_CSTRING_lh_type(lh), dl)
409 #define lh_OPENSSL_CSTRING_doall(lh, dfn) OPENSSL_LH_doall(ossl_check_OPENSSL_CSTRING_lh_type(lh), ossl_check_OPENSSL_CSTRING_lh_doallfunc_type(dfn))
410 
411 /* clang-format on */
412 
413 #ifdef __cplusplus
414 }
415 #endif
416 
417 #endif
418