/src/boringssl/crypto/lhash/internal.h
Line | Count | Source |
1 | | // Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // https://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #ifndef OPENSSL_HEADER_CRYPTO_LHASH_INTERNAL_H |
16 | | #define OPENSSL_HEADER_CRYPTO_LHASH_INTERNAL_H |
17 | | |
18 | | #include <openssl/base.h> |
19 | | |
20 | | |
21 | | BSSL_NAMESPACE_BEGIN |
22 | | |
23 | | // lhash is a traditional, chaining hash table that automatically expands and |
24 | | // contracts as needed. One should not use the lh_* functions directly, rather |
25 | | // use the type-safe macro wrappers: |
26 | | // |
27 | | // A hash table of a specific type of object has type `LHASH_OF(type)`. This |
28 | | // can be defined (once) with `DEFINE_LHASH_OF(type)`. |
29 | | // |
30 | | // struct foo { |
31 | | // int bar; |
32 | | // }; |
33 | | // |
34 | | // DEFINE_LHASH_OF(struct foo) |
35 | | // |
36 | | // Although note that the hash table will contain /pointers/ to `foo`. |
37 | | // |
38 | | // A macro will be defined for each of the `OPENSSL_lh_*` functions below. For |
39 | | // `LHASH_OF(foo)`, the macros would be `lh_foo_new`, `lh_foo_num_items` etc. |
40 | | // |
41 | | // TODO(davidben): Now that this type is completely internal, this can just be a |
42 | | // C++ template without any macros. |
43 | | |
44 | | |
45 | | #define LHASH_OF(type) struct bssl::type##_lhash_st |
46 | | |
47 | | // lhash_cmp_func is a comparison function that returns a value equal, or not |
48 | | // equal, to zero depending on whether `*a` is equal, or not equal to `*b`, |
49 | | // respectively. Note the difference between this and `stack_cmp_func` in that |
50 | | // this takes pointers to the objects directly. |
51 | | // |
52 | | // This function's actual type signature is int (*)(const T*, const T*). The |
53 | | // low-level `lh_*` functions will be passed a type-specific wrapper to call it |
54 | | // correctly. |
55 | | typedef int (*lhash_cmp_func)(const void *a, const void *b); |
56 | | typedef int (*lhash_cmp_func_helper)(lhash_cmp_func func, const void *a, |
57 | | const void *b); |
58 | | |
59 | | // lhash_hash_func is a function that maps an object to a uniformly distributed |
60 | | // uint32_t. |
61 | | // |
62 | | // This function's actual type signature is uint32_t (*)(const T*). The |
63 | | // low-level `lh_*` functions will be passed a type-specific wrapper to call it |
64 | | // correctly. |
65 | | typedef uint32_t (*lhash_hash_func)(const void *a); |
66 | | typedef uint32_t (*lhash_hash_func_helper)(lhash_hash_func func, const void *a); |
67 | | |
68 | | struct _LHASH; |
69 | | |
70 | | // OPENSSL_lh_new returns a new, empty hash table or NULL on error. |
71 | | OPENSSL_EXPORT _LHASH *OPENSSL_lh_new(lhash_hash_func hash, |
72 | | lhash_cmp_func comp); |
73 | | |
74 | | // OPENSSL_lh_free frees the hash table itself but none of the elements. See |
75 | | // `OPENSSL_lh_doall`. |
76 | | OPENSSL_EXPORT void OPENSSL_lh_free(_LHASH *lh); |
77 | | |
78 | | // OPENSSL_lh_num_items returns the number of items in `lh`. |
79 | | OPENSSL_EXPORT size_t OPENSSL_lh_num_items(const _LHASH *lh); |
80 | | |
81 | | // OPENSSL_lh_retrieve finds an element equal to `data` in the hash table and |
82 | | // returns it. If no such element exists, it returns NULL. |
83 | | OPENSSL_EXPORT void *OPENSSL_lh_retrieve(const _LHASH *lh, const void *data, |
84 | | lhash_hash_func_helper call_hash_func, |
85 | | lhash_cmp_func_helper call_cmp_func); |
86 | | |
87 | | // OPENSSL_lh_retrieve_key finds an element matching `key`, given the specified |
88 | | // hash and comparison function. This differs from `OPENSSL_lh_retrieve` in that |
89 | | // the key may be a different type than the values stored in `lh`. `key_hash` |
90 | | // and `cmp_key` must be compatible with the functions passed into |
91 | | // `OPENSSL_lh_new`. |
92 | | OPENSSL_EXPORT void *OPENSSL_lh_retrieve_key(const _LHASH *lh, const void *key, |
93 | | uint32_t key_hash, |
94 | | int (*cmp_key)(const void *key, |
95 | | const void *value)); |
96 | | |
97 | | // OPENSSL_lh_insert inserts `data` into the hash table. If an existing element |
98 | | // is equal to `data` (with respect to the comparison function) then `*old_data` |
99 | | // will be set to that value and it will be replaced. Otherwise, or in the |
100 | | // event of an error, `*old_data` will be set to NULL. It returns one on |
101 | | // success or zero in the case of an allocation error. |
102 | | OPENSSL_EXPORT int OPENSSL_lh_insert(_LHASH *lh, void **old_data, void *data, |
103 | | lhash_hash_func_helper call_hash_func, |
104 | | lhash_cmp_func_helper call_cmp_func); |
105 | | |
106 | | // OPENSSL_lh_delete removes an element equal to `data` from the hash table and |
107 | | // returns it. If no such element is found, it returns NULL. |
108 | | OPENSSL_EXPORT void *OPENSSL_lh_delete(_LHASH *lh, const void *data, |
109 | | lhash_hash_func_helper call_hash_func, |
110 | | lhash_cmp_func_helper call_cmp_func); |
111 | | |
112 | | // OPENSSL_lh_doall_arg calls `func` on each element of the hash table and also |
113 | | // passes `arg` as the second argument. |
114 | | // TODO(fork): rename this |
115 | | OPENSSL_EXPORT void OPENSSL_lh_doall_arg(_LHASH *lh, |
116 | | void (*func)(void *, void *), |
117 | | void *arg); |
118 | | |
119 | | // DEFINE_LHASH_OF creates (inline) definitions of hash table. It must be used |
120 | | // from within the bssl namespace. |
121 | | #define DEFINE_LHASH_OF(type) \ |
122 | | /* We disable MSVC C4191 in this macro, which warns when pointers are cast \ |
123 | | * to the wrong type. While the cast itself is valid, it is often a bug \ |
124 | | * because calling it through the cast is UB. However, we never actually \ |
125 | | * call functions as `lhash_cmp_func`. The type is just a type-erased \ |
126 | | * function pointer. (C does not guarantee function pointers fit in \ |
127 | | * `void*`, and GCC will warn on this.) Thus we just disable the false \ |
128 | | * positive warning. */ \ |
129 | | OPENSSL_MSVC_PRAGMA(warning(push)) \ |
130 | | OPENSSL_MSVC_PRAGMA(warning(disable : 4191)) \ |
131 | | \ |
132 | | struct type##_lhash_st; \ |
133 | | \ |
134 | | typedef int (*lhash_##type##_cmp_func)(const type *, const type *); \ |
135 | | typedef uint32_t (*lhash_##type##_hash_func)(const type *); \ |
136 | | \ |
137 | | inline int lh_##type##_call_cmp_func(lhash_cmp_func func, const void *a, \ |
138 | 902k | const void *b) { \ |
139 | 902k | return ((lhash_##type##_cmp_func)func)((const type *)a, (const type *)b); \ |
140 | 902k | } \ bssl::lh_SSL_SESSION_call_cmp_func(int (*)(void const*, void const*), void const*, void const*) Line | Count | Source | 138 | 225k | const void *b) { \ | 139 | 225k | return ((lhash_##type##_cmp_func)func)((const type *)a, (const type *)b); \ | 140 | 225k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_call_cmp_func(int (*)(void const*, void const*), void const*, void const*) Unexecuted instantiation: bssl::lh_CryptoBuffer_call_cmp_func(int (*)(void const*, void const*), void const*, void const*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_call_cmp_func(int (*)(void const*, void const*), void const*, void const*) bssl::lh_CONF_SECTION_call_cmp_func(int (*)(void const*, void const*), void const*, void const*) Line | Count | Source | 138 | 616k | const void *b) { \ | 139 | 616k | return ((lhash_##type##_cmp_func)func)((const type *)a, (const type *)b); \ | 140 | 616k | } \ |
bssl::lh_CONF_VALUE_call_cmp_func(int (*)(void const*, void const*), void const*, void const*) Line | Count | Source | 138 | 60.8k | const void *b) { \ | 139 | 60.8k | return ((lhash_##type##_cmp_func)func)((const type *)a, (const type *)b); \ | 140 | 60.8k | } \ |
|
141 | | \ |
142 | | inline uint32_t lh_##type##_call_hash_func(lhash_hash_func func, \ |
143 | 788k | const void *a) { \ |
144 | 788k | return ((lhash_##type##_hash_func)func)((const type *)a); \ |
145 | 788k | } \ bssl::lh_SSL_SESSION_call_hash_func(unsigned int (*)(void const*), void const*) Line | Count | Source | 143 | 85.6k | const void *a) { \ | 144 | 85.6k | return ((lhash_##type##_hash_func)func)((const type *)a); \ | 145 | 85.6k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_call_hash_func(unsigned int (*)(void const*), void const*) Unexecuted instantiation: bssl::lh_CryptoBuffer_call_hash_func(unsigned int (*)(void const*), void const*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_call_hash_func(unsigned int (*)(void const*), void const*) bssl::lh_CONF_SECTION_call_hash_func(unsigned int (*)(void const*), void const*) Line | Count | Source | 143 | 639k | const void *a) { \ | 144 | 639k | return ((lhash_##type##_hash_func)func)((const type *)a); \ | 145 | 639k | } \ |
bssl::lh_CONF_VALUE_call_hash_func(unsigned int (*)(void const*), void const*) Line | Count | Source | 143 | 63.2k | const void *a) { \ | 144 | 63.2k | return ((lhash_##type##_hash_func)func)((const type *)a); \ | 145 | 63.2k | } \ |
|
146 | | \ |
147 | | inline LHASH_OF(type) *lh_##type##_new(lhash_##type##_hash_func hash, \ |
148 | 30.9k | lhash_##type##_cmp_func comp) { \ |
149 | 30.9k | return (LHASH_OF(type) *)OPENSSL_lh_new((lhash_hash_func)hash, \ |
150 | 30.9k | (lhash_cmp_func)comp); \ |
151 | 30.9k | } \ bssl::lh_SSL_SESSION_new(unsigned int (*)(ssl_session_st const*), int (*)(ssl_session_st const*, ssl_session_st const*)) Line | Count | Source | 148 | 4.98k | lhash_##type##_cmp_func comp) { \ | 149 | 4.98k | return (LHASH_OF(type) *)OPENSSL_lh_new((lhash_hash_func)hash, \ | 150 | 4.98k | (lhash_cmp_func)comp); \ | 151 | 4.98k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_new(unsigned int (*)(asn1_object_st const*), int (*)(asn1_object_st const*, asn1_object_st const*)) Unexecuted instantiation: bssl::lh_CryptoBuffer_new(unsigned int (*)(bssl::CryptoBuffer const*), int (*)(bssl::CryptoBuffer const*, bssl::CryptoBuffer const*)) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_new(unsigned int (*)(bssl::ASN1_STRING_TABLE const*), int (*)(bssl::ASN1_STRING_TABLE const*, bssl::ASN1_STRING_TABLE const*)) bssl::lh_CONF_SECTION_new(unsigned int (*)(bssl::conf_section_st const*), int (*)(bssl::conf_section_st const*, bssl::conf_section_st const*)) Line | Count | Source | 148 | 12.9k | lhash_##type##_cmp_func comp) { \ | 149 | 12.9k | return (LHASH_OF(type) *)OPENSSL_lh_new((lhash_hash_func)hash, \ | 150 | 12.9k | (lhash_cmp_func)comp); \ | 151 | 12.9k | } \ |
bssl::lh_CONF_VALUE_new(unsigned int (*)(conf_value_st const*), int (*)(conf_value_st const*, conf_value_st const*)) Line | Count | Source | 148 | 12.9k | lhash_##type##_cmp_func comp) { \ | 149 | 12.9k | return (LHASH_OF(type) *)OPENSSL_lh_new((lhash_hash_func)hash, \ | 150 | 12.9k | (lhash_cmp_func)comp); \ | 151 | 12.9k | } \ |
|
152 | | \ |
153 | 30.8k | inline void lh_##type##_free(LHASH_OF(type) *lh) { \ |
154 | 30.8k | OPENSSL_lh_free((_LHASH *)lh); \ |
155 | 30.8k | } \ bssl::lh_SSL_SESSION_free(bssl::SSL_SESSION_lhash_st*) Line | Count | Source | 153 | 4.97k | inline void lh_##type##_free(LHASH_OF(type) *lh) { \ | 154 | 4.97k | OPENSSL_lh_free((_LHASH *)lh); \ | 155 | 4.97k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_free(bssl::ASN1_OBJECT_lhash_st*) Unexecuted instantiation: bssl::lh_CryptoBuffer_free(bssl::CryptoBuffer_lhash_st*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_free(bssl::ASN1_STRING_TABLE_lhash_st*) bssl::lh_CONF_SECTION_free(bssl::CONF_SECTION_lhash_st*) Line | Count | Source | 153 | 12.9k | inline void lh_##type##_free(LHASH_OF(type) *lh) { \ | 154 | 12.9k | OPENSSL_lh_free((_LHASH *)lh); \ | 155 | 12.9k | } \ |
bssl::lh_CONF_VALUE_free(bssl::CONF_VALUE_lhash_st*) Line | Count | Source | 153 | 12.9k | inline void lh_##type##_free(LHASH_OF(type) *lh) { \ | 154 | 12.9k | OPENSSL_lh_free((_LHASH *)lh); \ | 155 | 12.9k | } \ |
|
156 | | \ |
157 | 83.4k | inline size_t lh_##type##_num_items(const LHASH_OF(type) *lh) { \ |
158 | 83.4k | return OPENSSL_lh_num_items((const _LHASH *)lh); \ |
159 | 83.4k | } \ bssl::lh_SSL_SESSION_num_items(bssl::SSL_SESSION_lhash_st const*) Line | Count | Source | 157 | 83.4k | inline size_t lh_##type##_num_items(const LHASH_OF(type) *lh) { \ | 158 | 83.4k | return OPENSSL_lh_num_items((const _LHASH *)lh); \ | 159 | 83.4k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_num_items(bssl::ASN1_OBJECT_lhash_st const*) Unexecuted instantiation: bssl::lh_CryptoBuffer_num_items(bssl::CryptoBuffer_lhash_st const*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_num_items(bssl::ASN1_STRING_TABLE_lhash_st const*) Unexecuted instantiation: bssl::lh_CONF_SECTION_num_items(bssl::CONF_SECTION_lhash_st const*) Unexecuted instantiation: bssl::lh_CONF_VALUE_num_items(bssl::CONF_VALUE_lhash_st const*) |
160 | | \ |
161 | | inline type *lh_##type##_retrieve(const LHASH_OF(type) *lh, \ |
162 | 615k | const type *data) { \ |
163 | 615k | return (type *)OPENSSL_lh_retrieve((const _LHASH *)lh, data, \ |
164 | 615k | lh_##type##_call_hash_func, \ |
165 | 615k | lh_##type##_call_cmp_func); \ |
166 | 615k | } \ bssl::lh_SSL_SESSION_retrieve(bssl::SSL_SESSION_lhash_st const*, ssl_session_st const*) Line | Count | Source | 162 | 116 | const type *data) { \ | 163 | 116 | return (type *)OPENSSL_lh_retrieve((const _LHASH *)lh, data, \ | 164 | 116 | lh_##type##_call_hash_func, \ | 165 | 116 | lh_##type##_call_cmp_func); \ | 166 | 116 | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_retrieve(bssl::ASN1_OBJECT_lhash_st const*, asn1_object_st const*) Unexecuted instantiation: bssl::lh_CryptoBuffer_retrieve(bssl::CryptoBuffer_lhash_st const*, bssl::CryptoBuffer const*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_retrieve(bssl::ASN1_STRING_TABLE_lhash_st const*, bssl::ASN1_STRING_TABLE const*) bssl::lh_CONF_SECTION_retrieve(bssl::CONF_SECTION_lhash_st const*, bssl::conf_section_st const*) Line | Count | Source | 162 | 614k | const type *data) { \ | 163 | 614k | return (type *)OPENSSL_lh_retrieve((const _LHASH *)lh, data, \ | 164 | 614k | lh_##type##_call_hash_func, \ | 165 | 614k | lh_##type##_call_cmp_func); \ | 166 | 614k | } \ |
Unexecuted instantiation: bssl::lh_CONF_VALUE_retrieve(bssl::CONF_VALUE_lhash_st const*, conf_value_st const*) |
167 | | \ |
168 | | typedef struct { \ |
169 | | int (*cmp_key)(const void *key, const type *value); \ |
170 | | const void *key; \ |
171 | | } LHASH_CMP_KEY_##type; \ |
172 | | \ |
173 | 1.15k | inline int lh_##type##_call_cmp_key(const void *key, const void *value) { \ |
174 | 1.15k | const LHASH_CMP_KEY_##type *cb = (const LHASH_CMP_KEY_##type *)key; \ |
175 | 1.15k | return cb->cmp_key(cb->key, (const type *)value); \ |
176 | 1.15k | } \ bssl::lh_SSL_SESSION_call_cmp_key(void const*, void const*) Line | Count | Source | 173 | 1.15k | inline int lh_##type##_call_cmp_key(const void *key, const void *value) { \ | 174 | 1.15k | const LHASH_CMP_KEY_##type *cb = (const LHASH_CMP_KEY_##type *)key; \ | 175 | 1.15k | return cb->cmp_key(cb->key, (const type *)value); \ | 176 | 1.15k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_call_cmp_key(void const*, void const*) Unexecuted instantiation: bssl::lh_CryptoBuffer_call_cmp_key(void const*, void const*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_call_cmp_key(void const*, void const*) Unexecuted instantiation: bssl::lh_CONF_SECTION_call_cmp_key(void const*, void const*) Unexecuted instantiation: bssl::lh_CONF_VALUE_call_cmp_key(void const*, void const*) |
177 | | \ |
178 | | inline type *lh_##type##_retrieve_key( \ |
179 | | const LHASH_OF(type) *lh, const void *key, uint32_t key_hash, \ |
180 | 946 | int (*cmp_key)(const void *key, const type *value)) { \ |
181 | 946 | LHASH_CMP_KEY_##type cb = {cmp_key, key}; \ |
182 | 946 | return (type *)OPENSSL_lh_retrieve_key((const _LHASH *)lh, &cb, key_hash, \ |
183 | 946 | lh_##type##_call_cmp_key); \ |
184 | 946 | } \ bssl::lh_SSL_SESSION_retrieve_key(bssl::SSL_SESSION_lhash_st const*, void const*, unsigned int, int (*)(void const*, ssl_session_st const*)) Line | Count | Source | 180 | 946 | int (*cmp_key)(const void *key, const type *value)) { \ | 181 | 946 | LHASH_CMP_KEY_##type cb = {cmp_key, key}; \ | 182 | 946 | return (type *)OPENSSL_lh_retrieve_key((const _LHASH *)lh, &cb, key_hash, \ | 183 | 946 | lh_##type##_call_cmp_key); \ | 184 | 946 | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_retrieve_key(bssl::ASN1_OBJECT_lhash_st const*, void const*, unsigned int, int (*)(void const*, asn1_object_st const*)) Unexecuted instantiation: bssl::lh_CryptoBuffer_retrieve_key(bssl::CryptoBuffer_lhash_st const*, void const*, unsigned int, int (*)(void const*, bssl::CryptoBuffer const*)) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_retrieve_key(bssl::ASN1_STRING_TABLE_lhash_st const*, void const*, unsigned int, int (*)(void const*, bssl::ASN1_STRING_TABLE const*)) Unexecuted instantiation: bssl::lh_CONF_SECTION_retrieve_key(bssl::CONF_SECTION_lhash_st const*, void const*, unsigned int, int (*)(void const*, bssl::conf_section_st const*)) Unexecuted instantiation: bssl::lh_CONF_VALUE_retrieve_key(bssl::CONF_VALUE_lhash_st const*, void const*, unsigned int, int (*)(void const*, conf_value_st const*)) |
185 | | \ |
186 | | inline int lh_##type##_insert(LHASH_OF(type) *lh, type **old_data, \ |
187 | 159k | type *data) { \ |
188 | 159k | void *old_data_void = nullptr; \ |
189 | 159k | int ret = OPENSSL_lh_insert((_LHASH *)lh, &old_data_void, data, \ |
190 | 159k | lh_##type##_call_hash_func, \ |
191 | 159k | lh_##type##_call_cmp_func); \ |
192 | 159k | *old_data = (type *)old_data_void; \ |
193 | 159k | return ret; \ |
194 | 159k | } \ bssl::lh_SSL_SESSION_insert(bssl::SSL_SESSION_lhash_st*, ssl_session_st**, ssl_session_st*) Line | Count | Source | 187 | 71.6k | type *data) { \ | 188 | 71.6k | void *old_data_void = nullptr; \ | 189 | 71.6k | int ret = OPENSSL_lh_insert((_LHASH *)lh, &old_data_void, data, \ | 190 | 71.6k | lh_##type##_call_hash_func, \ | 191 | 71.6k | lh_##type##_call_cmp_func); \ | 192 | 71.6k | *old_data = (type *)old_data_void; \ | 193 | 71.6k | return ret; \ | 194 | 71.6k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_insert(bssl::ASN1_OBJECT_lhash_st*, asn1_object_st**, asn1_object_st*) Unexecuted instantiation: bssl::lh_CryptoBuffer_insert(bssl::CryptoBuffer_lhash_st*, bssl::CryptoBuffer**, bssl::CryptoBuffer*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_insert(bssl::ASN1_STRING_TABLE_lhash_st*, bssl::ASN1_STRING_TABLE**, bssl::ASN1_STRING_TABLE*) bssl::lh_CONF_SECTION_insert(bssl::CONF_SECTION_lhash_st*, bssl::conf_section_st**, bssl::conf_section_st*) Line | Count | Source | 187 | 24.3k | type *data) { \ | 188 | 24.3k | void *old_data_void = nullptr; \ | 189 | 24.3k | int ret = OPENSSL_lh_insert((_LHASH *)lh, &old_data_void, data, \ | 190 | 24.3k | lh_##type##_call_hash_func, \ | 191 | 24.3k | lh_##type##_call_cmp_func); \ | 192 | 24.3k | *old_data = (type *)old_data_void; \ | 193 | 24.3k | return ret; \ | 194 | 24.3k | } \ |
bssl::lh_CONF_VALUE_insert(bssl::CONF_VALUE_lhash_st*, conf_value_st**, conf_value_st*) Line | Count | Source | 187 | 63.2k | type *data) { \ | 188 | 63.2k | void *old_data_void = nullptr; \ | 189 | 63.2k | int ret = OPENSSL_lh_insert((_LHASH *)lh, &old_data_void, data, \ | 190 | 63.2k | lh_##type##_call_hash_func, \ | 191 | 63.2k | lh_##type##_call_cmp_func); \ | 192 | 63.2k | *old_data = (type *)old_data_void; \ | 193 | 63.2k | return ret; \ | 194 | 63.2k | } \ |
|
195 | | \ |
196 | 13.9k | inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *data) { \ |
197 | 13.9k | return (type *)OPENSSL_lh_delete((_LHASH *)lh, data, \ |
198 | 13.9k | lh_##type##_call_hash_func, \ |
199 | 13.9k | lh_##type##_call_cmp_func); \ |
200 | 13.9k | } \ bssl::lh_SSL_SESSION_delete(bssl::SSL_SESSION_lhash_st*, ssl_session_st const*) Line | Count | Source | 196 | 13.9k | inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *data) { \ | 197 | 13.9k | return (type *)OPENSSL_lh_delete((_LHASH *)lh, data, \ | 198 | 13.9k | lh_##type##_call_hash_func, \ | 199 | 13.9k | lh_##type##_call_cmp_func); \ | 200 | 13.9k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_delete(bssl::ASN1_OBJECT_lhash_st*, asn1_object_st const*) Unexecuted instantiation: bssl::lh_CryptoBuffer_delete(bssl::CryptoBuffer_lhash_st*, bssl::CryptoBuffer const*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_delete(bssl::ASN1_STRING_TABLE_lhash_st*, bssl::ASN1_STRING_TABLE const*) Unexecuted instantiation: bssl::lh_CONF_SECTION_delete(bssl::CONF_SECTION_lhash_st*, bssl::conf_section_st const*) Unexecuted instantiation: bssl::lh_CONF_VALUE_delete(bssl::CONF_VALUE_lhash_st*, conf_value_st const*) |
201 | | \ |
202 | | typedef struct { \ |
203 | | void (*doall_arg)(type *, void *); \ |
204 | | void *arg; \ |
205 | | } LHASH_DOALL_##type; \ |
206 | | \ |
207 | 90.1k | inline void lh_##type##_call_doall_arg(void *value, void *arg) { \ |
208 | 90.1k | const LHASH_DOALL_##type *cb = (const LHASH_DOALL_##type *)arg; \ |
209 | 90.1k | cb->doall_arg((type *)value, cb->arg); \ |
210 | 90.1k | } \ bssl::lh_SSL_SESSION_call_doall_arg(void*, void*) Line | Count | Source | 207 | 13.8k | inline void lh_##type##_call_doall_arg(void *value, void *arg) { \ | 208 | 13.8k | const LHASH_DOALL_##type *cb = (const LHASH_DOALL_##type *)arg; \ | 209 | 13.8k | cb->doall_arg((type *)value, cb->arg); \ | 210 | 13.8k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_call_doall_arg(void*, void*) Unexecuted instantiation: bssl::lh_CryptoBuffer_call_doall_arg(void*, void*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_call_doall_arg(void*, void*) bssl::lh_CONF_SECTION_call_doall_arg(void*, void*) Line | Count | Source | 207 | 24.3k | inline void lh_##type##_call_doall_arg(void *value, void *arg) { \ | 208 | 24.3k | const LHASH_DOALL_##type *cb = (const LHASH_DOALL_##type *)arg; \ | 209 | 24.3k | cb->doall_arg((type *)value, cb->arg); \ | 210 | 24.3k | } \ |
bssl::lh_CONF_VALUE_call_doall_arg(void*, void*) Line | Count | Source | 207 | 51.9k | inline void lh_##type##_call_doall_arg(void *value, void *arg) { \ | 208 | 51.9k | const LHASH_DOALL_##type *cb = (const LHASH_DOALL_##type *)arg; \ | 209 | 51.9k | cb->doall_arg((type *)value, cb->arg); \ | 210 | 51.9k | } \ |
|
211 | | \ |
212 | | inline void lh_##type##_doall_arg(LHASH_OF(type) *lh, \ |
213 | 88.4k | void (*func)(type *, void *), void *arg) { \ |
214 | 88.4k | LHASH_DOALL_##type cb = {func, arg}; \ |
215 | 88.4k | OPENSSL_lh_doall_arg((_LHASH *)lh, lh_##type##_call_doall_arg, &cb); \ |
216 | 88.4k | } \ bssl::lh_SSL_SESSION_doall_arg(bssl::SSL_SESSION_lhash_st*, void (*)(ssl_session_st*, void*), void*) Line | Count | Source | 213 | 62.4k | void (*func)(type *, void *), void *arg) { \ | 214 | 62.4k | LHASH_DOALL_##type cb = {func, arg}; \ | 215 | 62.4k | OPENSSL_lh_doall_arg((_LHASH *)lh, lh_##type##_call_doall_arg, &cb); \ | 216 | 62.4k | } \ |
Unexecuted instantiation: bssl::lh_ASN1_OBJECT_doall_arg(bssl::ASN1_OBJECT_lhash_st*, void (*)(asn1_object_st*, void*), void*) Unexecuted instantiation: bssl::lh_CryptoBuffer_doall_arg(bssl::CryptoBuffer_lhash_st*, void (*)(bssl::CryptoBuffer*, void*), void*) Unexecuted instantiation: bssl::lh_ASN1_STRING_TABLE_doall_arg(bssl::ASN1_STRING_TABLE_lhash_st*, void (*)(bssl::ASN1_STRING_TABLE*, void*), void*) bssl::lh_CONF_SECTION_doall_arg(bssl::CONF_SECTION_lhash_st*, void (*)(bssl::conf_section_st*, void*), void*) Line | Count | Source | 213 | 12.9k | void (*func)(type *, void *), void *arg) { \ | 214 | 12.9k | LHASH_DOALL_##type cb = {func, arg}; \ | 215 | 12.9k | OPENSSL_lh_doall_arg((_LHASH *)lh, lh_##type##_call_doall_arg, &cb); \ | 216 | 12.9k | } \ |
bssl::lh_CONF_VALUE_doall_arg(bssl::CONF_VALUE_lhash_st*, void (*)(conf_value_st*, void*), void*) Line | Count | Source | 213 | 12.9k | void (*func)(type *, void *), void *arg) { \ | 214 | 12.9k | LHASH_DOALL_##type cb = {func, arg}; \ | 215 | 12.9k | OPENSSL_lh_doall_arg((_LHASH *)lh, lh_##type##_call_doall_arg, &cb); \ | 216 | 12.9k | } \ |
|
217 | | \ |
218 | | OPENSSL_MSVC_PRAGMA(warning(pop)) |
219 | | |
220 | | BSSL_NAMESPACE_END |
221 | | |
222 | | #endif // OPENSSL_HEADER_CRYPTO_LHASH_INTERNAL_H |