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