lhash.h 33 KB

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