/src/boringssl/include/openssl/base.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2001-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_BASE_H |
16 | | #define OPENSSL_HEADER_BASE_H |
17 | | |
18 | | |
19 | | // This file should be the first included by all BoringSSL headers. All |
20 | | // BoringSSL headers can be assumed to import this file, and this header can be |
21 | | // assumed to include stddef.h (size_t) and stdint.h (uint*_t, etc). |
22 | | |
23 | | #include <stddef.h> // IWYU pragma: export |
24 | | #include <stdint.h> // IWYU pragma: export |
25 | | #include <stdlib.h> |
26 | | #include <sys/types.h> |
27 | | |
28 | | #if defined(__MINGW32__) |
29 | | // stdio.h is needed on MinGW for __MINGW_PRINTF_FORMAT. |
30 | | #include <stdio.h> |
31 | | #endif |
32 | | |
33 | | #if defined(__APPLE__) |
34 | | #include <TargetConditionals.h> |
35 | | #endif |
36 | | |
37 | | // Include a BoringSSL-only header so consumers including this header without |
38 | | // setting up include paths do not accidentally pick up the system |
39 | | // opensslconf.h. |
40 | | #include <openssl/is_boringssl.h> |
41 | | #include <openssl/opensslconf.h> |
42 | | #include <openssl/target.h> // IWYU pragma: export |
43 | | |
44 | | #if defined(BORINGSSL_PREFIX) |
45 | | #include <boringssl_prefix_symbols.h> |
46 | | #endif |
47 | | |
48 | | #if defined(__cplusplus) |
49 | | extern "C" { |
50 | | #endif |
51 | | |
52 | | |
53 | | #if defined(__APPLE__) |
54 | | // Note |TARGET_OS_MAC| is set for all Apple OS variants. |TARGET_OS_OSX| |
55 | | // targets macOS specifically. |
56 | | #if defined(TARGET_OS_OSX) && TARGET_OS_OSX |
57 | | #define OPENSSL_MACOS |
58 | | #endif |
59 | | #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE |
60 | | #define OPENSSL_IOS |
61 | | #endif |
62 | | #endif |
63 | | |
64 | | #define OPENSSL_IS_BORINGSSL |
65 | 0 | #define OPENSSL_VERSION_NUMBER 0x1010107f |
66 | | #define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER |
67 | | |
68 | | // BORINGSSL_API_VERSION is a positive integer that increments as BoringSSL |
69 | | // changes over time. The value itself is not meaningful. It will be incremented |
70 | | // whenever is convenient to coordinate an API change with consumers. This will |
71 | | // not denote any special point in development. |
72 | | // |
73 | | // A consumer may use this symbol in the preprocessor to temporarily build |
74 | | // against multiple revisions of BoringSSL at the same time. It is not |
75 | | // recommended to do so for longer than is necessary. |
76 | | #define BORINGSSL_API_VERSION 36 |
77 | | |
78 | | #if defined(BORINGSSL_SHARED_LIBRARY) |
79 | | |
80 | | #if defined(OPENSSL_WINDOWS) |
81 | | |
82 | | #if defined(BORINGSSL_IMPLEMENTATION) |
83 | | #define OPENSSL_EXPORT __declspec(dllexport) |
84 | | #else |
85 | | #define OPENSSL_EXPORT __declspec(dllimport) |
86 | | #endif |
87 | | |
88 | | #else // defined(OPENSSL_WINDOWS) |
89 | | |
90 | | #if defined(BORINGSSL_IMPLEMENTATION) |
91 | | #define OPENSSL_EXPORT __attribute__((visibility("default"))) |
92 | | #else |
93 | | #define OPENSSL_EXPORT |
94 | | #endif |
95 | | |
96 | | #endif // defined(OPENSSL_WINDOWS) |
97 | | |
98 | | #else // defined(BORINGSSL_SHARED_LIBRARY) |
99 | | |
100 | | #define OPENSSL_EXPORT |
101 | | |
102 | | #endif // defined(BORINGSSL_SHARED_LIBRARY) |
103 | | |
104 | | #if defined(_MSC_VER) |
105 | | |
106 | | // OPENSSL_DEPRECATED is used to mark a function as deprecated. Use |
107 | | // of any functions so marked in caller code will produce a warning. |
108 | | // OPENSSL_BEGIN_ALLOW_DEPRECATED and OPENSSL_END_ALLOW_DEPRECATED |
109 | | // can be used to suppress the warning in regions of caller code. |
110 | | #define OPENSSL_DEPRECATED __declspec(deprecated) |
111 | | #define OPENSSL_BEGIN_ALLOW_DEPRECATED \ |
112 | | __pragma(warning(push)) __pragma(warning(disable : 4996)) |
113 | | #define OPENSSL_END_ALLOW_DEPRECATED __pragma(warning(pop)) |
114 | | |
115 | | #elif defined(__GNUC__) || defined(__clang__) |
116 | | |
117 | | #define OPENSSL_DEPRECATED __attribute__((__deprecated__)) |
118 | | #define OPENSSL_BEGIN_ALLOW_DEPRECATED \ |
119 | | _Pragma("GCC diagnostic push") \ |
120 | | _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") |
121 | | #define OPENSSL_END_ALLOW_DEPRECATED _Pragma("GCC diagnostic pop") |
122 | | |
123 | | #else |
124 | | |
125 | | #define OPENSSL_DEPRECATED |
126 | | #define OPENSSL_BEGIN_ALLOW_DEPRECATED |
127 | | #define OPENSSL_END_ALLOW_DEPRECATED |
128 | | |
129 | | #endif |
130 | | |
131 | | |
132 | | #if defined(__GNUC__) || defined(__clang__) |
133 | | // MinGW has two different printf implementations. Ensure the format macro |
134 | | // matches the selected implementation. See |
135 | | // https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/. |
136 | | #if defined(__MINGW_PRINTF_FORMAT) |
137 | | #define OPENSSL_PRINTF_FORMAT_FUNC(string_index, first_to_check) \ |
138 | | __attribute__(( \ |
139 | | __format__(__MINGW_PRINTF_FORMAT, string_index, first_to_check))) |
140 | | #else |
141 | | #define OPENSSL_PRINTF_FORMAT_FUNC(string_index, first_to_check) \ |
142 | | __attribute__((__format__(__printf__, string_index, first_to_check))) |
143 | | #endif |
144 | | #else |
145 | | #define OPENSSL_PRINTF_FORMAT_FUNC(string_index, first_to_check) |
146 | | #endif |
147 | | |
148 | | // OPENSSL_GNUC_CLANG_PRAGMA emits a pragma on GCC or clang and nothing on other |
149 | | // compilers. |
150 | | #if defined(__GNUC__) || defined(__clang__) |
151 | | #define OPENSSL_GNUC_CLANG_PRAGMA(arg) _Pragma(arg) |
152 | | #else |
153 | | #define OPENSSL_GNUC_CLANG_PRAGMA(arg) |
154 | | #endif |
155 | | |
156 | | // OPENSSL_CLANG_PRAGMA emits a pragma on clang and nothing on other compilers. |
157 | | #if defined(__clang__) |
158 | | #define OPENSSL_CLANG_PRAGMA(arg) _Pragma(arg) |
159 | | #else |
160 | | #define OPENSSL_CLANG_PRAGMA(arg) |
161 | | #endif |
162 | | |
163 | | // OPENSSL_MSVC_PRAGMA emits a pragma on MSVC and nothing on other compilers. |
164 | | #if defined(_MSC_VER) |
165 | | #define OPENSSL_MSVC_PRAGMA(arg) __pragma(arg) |
166 | | #else |
167 | | #define OPENSSL_MSVC_PRAGMA(arg) |
168 | | #endif |
169 | | |
170 | | #if defined(__GNUC__) || defined(__clang__) |
171 | | #define OPENSSL_UNUSED __attribute__((unused)) |
172 | | #elif defined(_MSC_VER) |
173 | | // __pragma wants to be on a separate line. The following is what it takes to |
174 | | // stop clang-format from messing with that. |
175 | | // clang-format off |
176 | | #define OPENSSL_UNUSED __pragma(warning(suppress : 4505)) \ |
177 | | /* */ |
178 | | // clang-format on |
179 | | #else |
180 | | #define OPENSSL_UNUSED |
181 | | #endif |
182 | | |
183 | | // C and C++ handle inline functions differently. In C++, an inline function is |
184 | | // defined in just the header file, potentially emitted in multiple compilation |
185 | | // units (in cases the compiler did not inline), but each copy must be identical |
186 | | // to satsify ODR. In C, a non-static inline must be manually emitted in exactly |
187 | | // one compilation unit with a separate extern inline declaration. |
188 | | // |
189 | | // In both languages, exported inline functions referencing file-local symbols |
190 | | // are problematic. C forbids this altogether (though GCC and Clang seem not to |
191 | | // enforce it). It works in C++, but ODR requires the definitions be identical, |
192 | | // including all names in the definitions resolving to the "same entity". In |
193 | | // practice, this is unlikely to be a problem, but an inline function that |
194 | | // returns a pointer to a file-local symbol |
195 | | // could compile oddly. |
196 | | // |
197 | | // Historically, we used static inline in headers. However, to satisfy ODR, use |
198 | | // plain inline in C++, to allow inline consumer functions to call our header |
199 | | // functions. Plain inline would also work better with C99 inline, but that is |
200 | | // not used much in practice, extern inline is tedious, and there are conflicts |
201 | | // with the old gnu89 model: |
202 | | // https://stackoverflow.com/questions/216510/extern-inline |
203 | | #if defined(__cplusplus) |
204 | | #define OPENSSL_INLINE inline |
205 | | #else |
206 | | // Add OPENSSL_UNUSED so that, should an inline function be emitted via macro |
207 | | // (e.g. a |STACK_OF(T)| implementation) in a source file without tripping |
208 | | // clang's -Wunused-function. |
209 | | #define OPENSSL_INLINE static inline OPENSSL_UNUSED |
210 | | #endif |
211 | | |
212 | | #if defined(__cplusplus) |
213 | | // enums can be predeclared, but only in C++ and only if given an explicit type. |
214 | | // C doesn't support setting an explicit type for enums thus a #define is used |
215 | | // to do this only for C++. However, the ABI type between C and C++ need to have |
216 | | // equal sizes, which is confirmed in a unittest. |
217 | | #define BORINGSSL_ENUM_INT : int |
218 | | enum ssl_early_data_reason_t BORINGSSL_ENUM_INT; |
219 | | enum ssl_encryption_level_t BORINGSSL_ENUM_INT; |
220 | | enum ssl_private_key_result_t BORINGSSL_ENUM_INT; |
221 | | enum ssl_renegotiate_mode_t BORINGSSL_ENUM_INT; |
222 | | enum ssl_select_cert_result_t BORINGSSL_ENUM_INT; |
223 | | enum ssl_select_cert_result_t BORINGSSL_ENUM_INT; |
224 | | enum ssl_ticket_aead_result_t BORINGSSL_ENUM_INT; |
225 | | enum ssl_verify_result_t BORINGSSL_ENUM_INT; |
226 | | #else |
227 | | #define BORINGSSL_ENUM_INT |
228 | | #endif |
229 | | |
230 | | // ossl_ssize_t is a signed type which is large enough to fit the size of any |
231 | | // valid memory allocation. We prefer using |size_t|, but sometimes we need a |
232 | | // signed type for OpenSSL API compatibility. This type can be used in such |
233 | | // cases to avoid overflow. |
234 | | // |
235 | | // Not all |size_t| values fit in |ossl_ssize_t|, but all |size_t| values that |
236 | | // are sizes of or indices into C objects, can be converted without overflow. |
237 | | typedef ptrdiff_t ossl_ssize_t; |
238 | | |
239 | | // CBS_ASN1_TAG is the type used by |CBS| and |CBB| for ASN.1 tags. See that |
240 | | // header for details. This type is defined in base.h as a forward declaration. |
241 | | typedef uint32_t CBS_ASN1_TAG; |
242 | | |
243 | | // CRYPTO_THREADID is a dummy value. |
244 | | typedef int CRYPTO_THREADID; |
245 | | |
246 | | // An |ASN1_NULL| is an opaque type. asn1.h represents the ASN.1 NULL value as |
247 | | // an opaque, non-NULL |ASN1_NULL*| pointer. |
248 | | typedef struct asn1_null_st ASN1_NULL; |
249 | | |
250 | | // CRYPTO_MUST_BE_NULL is an opaque type that is never returned from BoringSSL. |
251 | | // It is used in function parameters that must be NULL. |
252 | | typedef struct crypto_must_be_null_st CRYPTO_MUST_BE_NULL; |
253 | | |
254 | | typedef int ASN1_BOOLEAN; |
255 | | typedef struct ASN1_ITEM_st ASN1_ITEM; |
256 | | typedef struct asn1_object_st ASN1_OBJECT; |
257 | | typedef struct asn1_pctx_st ASN1_PCTX; |
258 | | typedef struct asn1_string_st ASN1_BIT_STRING; |
259 | | typedef struct asn1_string_st ASN1_BMPSTRING; |
260 | | typedef struct asn1_string_st ASN1_ENUMERATED; |
261 | | typedef struct asn1_string_st ASN1_GENERALIZEDTIME; |
262 | | typedef struct asn1_string_st ASN1_GENERALSTRING; |
263 | | typedef struct asn1_string_st ASN1_IA5STRING; |
264 | | typedef struct asn1_string_st ASN1_INTEGER; |
265 | | typedef struct asn1_string_st ASN1_OCTET_STRING; |
266 | | typedef struct asn1_string_st ASN1_PRINTABLESTRING; |
267 | | typedef struct asn1_string_st ASN1_STRING; |
268 | | typedef struct asn1_string_st ASN1_T61STRING; |
269 | | typedef struct asn1_string_st ASN1_TIME; |
270 | | typedef struct asn1_string_st ASN1_UNIVERSALSTRING; |
271 | | typedef struct asn1_string_st ASN1_UTCTIME; |
272 | | typedef struct asn1_string_st ASN1_UTF8STRING; |
273 | | typedef struct asn1_string_st ASN1_VISIBLESTRING; |
274 | | typedef struct asn1_type_st ASN1_TYPE; |
275 | | typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID; |
276 | | typedef struct BASIC_CONSTRAINTS_st BASIC_CONSTRAINTS; |
277 | | typedef struct CMS_ContentInfo_st CMS_ContentInfo; |
278 | | typedef struct CMS_SignerInfo_st CMS_SignerInfo; |
279 | | typedef struct DIST_POINT_st DIST_POINT; |
280 | | typedef struct DSA_SIG_st DSA_SIG; |
281 | | typedef struct GENERAL_NAME_st GENERAL_NAME; |
282 | | typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT; |
283 | | typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS; |
284 | | typedef struct Netscape_spkac_st NETSCAPE_SPKAC; |
285 | | typedef struct Netscape_spki_st NETSCAPE_SPKI; |
286 | | typedef struct RIPEMD160state_st RIPEMD160_CTX; |
287 | | typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM; |
288 | | typedef struct X509_algor_st X509_ALGOR; |
289 | | typedef struct X509_crl_st X509_CRL; |
290 | | typedef struct X509_extension_st X509_EXTENSION; |
291 | | typedef struct X509_info_st X509_INFO; |
292 | | typedef struct X509_name_entry_st X509_NAME_ENTRY; |
293 | | typedef struct X509_name_st X509_NAME; |
294 | | typedef struct X509_pubkey_st X509_PUBKEY; |
295 | | typedef struct X509_req_st X509_REQ; |
296 | | typedef struct X509_sig_st X509_SIG; |
297 | | typedef struct bignum_ctx BN_CTX; |
298 | | typedef struct bignum_st BIGNUM; |
299 | | typedef struct bio_method_st BIO_METHOD; |
300 | | typedef struct bio_st BIO; |
301 | | typedef struct blake2b_state_st BLAKE2B_CTX; |
302 | | typedef struct bn_gencb_st BN_GENCB; |
303 | | typedef struct bn_mont_ctx_st BN_MONT_CTX; |
304 | | typedef struct buf_mem_st BUF_MEM; |
305 | | typedef struct cbb_st CBB; |
306 | | typedef struct cbs_st CBS; |
307 | | typedef struct cmac_ctx_st CMAC_CTX; |
308 | | typedef struct conf_st CONF; |
309 | | typedef struct conf_value_st CONF_VALUE; |
310 | | typedef struct crypto_buffer_pool_st CRYPTO_BUFFER_POOL; |
311 | | typedef struct crypto_buffer_st CRYPTO_BUFFER; |
312 | | typedef struct ctr_drbg_state_st CTR_DRBG_STATE; |
313 | | typedef struct dh_st DH; |
314 | | typedef struct dsa_st DSA; |
315 | | typedef struct ec_group_st EC_GROUP; |
316 | | typedef struct ec_key_st EC_KEY; |
317 | | typedef struct ec_point_st EC_POINT; |
318 | | typedef struct ecdsa_method_st ECDSA_METHOD; |
319 | | typedef struct ecdsa_sig_st ECDSA_SIG; |
320 | | typedef struct engine_st ENGINE; |
321 | | typedef struct env_md_ctx_st EVP_MD_CTX; |
322 | | typedef struct env_md_st EVP_MD; |
323 | | typedef struct evp_aead_st EVP_AEAD; |
324 | | typedef struct evp_aead_ctx_st EVP_AEAD_CTX; |
325 | | typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; |
326 | | typedef struct evp_cipher_st EVP_CIPHER; |
327 | | typedef struct evp_encode_ctx_st EVP_ENCODE_CTX; |
328 | | typedef struct evp_hpke_aead_st EVP_HPKE_AEAD; |
329 | | typedef struct evp_hpke_ctx_st EVP_HPKE_CTX; |
330 | | typedef struct evp_hpke_kdf_st EVP_HPKE_KDF; |
331 | | typedef struct evp_hpke_kem_st EVP_HPKE_KEM; |
332 | | typedef struct evp_hpke_key_st EVP_HPKE_KEY; |
333 | | typedef struct evp_pkey_alg_st EVP_PKEY_ALG; |
334 | | typedef struct evp_pkey_ctx_st EVP_PKEY_CTX; |
335 | | typedef struct evp_pkey_st EVP_PKEY; |
336 | | typedef struct hmac_ctx_st HMAC_CTX; |
337 | | typedef struct md4_state_st MD4_CTX; |
338 | | typedef struct md5_state_st MD5_CTX; |
339 | | typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS; |
340 | | typedef struct pkcs12_st PKCS12; |
341 | | typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO; |
342 | | typedef struct private_key_st X509_PKEY; |
343 | | typedef struct rand_meth_st RAND_METHOD; |
344 | | typedef struct rc4_key_st RC4_KEY; |
345 | | typedef struct rsa_meth_st RSA_METHOD; |
346 | | typedef struct rsa_pss_params_st RSA_PSS_PARAMS; |
347 | | typedef struct rsa_st RSA; |
348 | | typedef struct sha256_state_st SHA256_CTX; |
349 | | typedef struct sha512_state_st SHA512_CTX; |
350 | | typedef struct sha_state_st SHA_CTX; |
351 | | typedef struct spake2_ctx_st SPAKE2_CTX; |
352 | | typedef struct srtp_protection_profile_st SRTP_PROTECTION_PROFILE; |
353 | | typedef struct ssl_cipher_st SSL_CIPHER; |
354 | | typedef struct ssl_credential_st SSL_CREDENTIAL; |
355 | | typedef struct ssl_ctx_st SSL_CTX; |
356 | | typedef struct ssl_early_callback_ctx SSL_CLIENT_HELLO; |
357 | | typedef struct ssl_ech_keys_st SSL_ECH_KEYS; |
358 | | typedef struct ssl_method_st SSL_METHOD; |
359 | | typedef struct ssl_private_key_method_st SSL_PRIVATE_KEY_METHOD; |
360 | | typedef struct ssl_quic_method_st SSL_QUIC_METHOD; |
361 | | typedef struct ssl_session_st SSL_SESSION; |
362 | | typedef struct ssl_st SSL; |
363 | | typedef struct ssl_ticket_aead_method_st SSL_TICKET_AEAD_METHOD; |
364 | | typedef struct st_ERR_FNS ERR_FNS; |
365 | | typedef struct trust_token_st TRUST_TOKEN; |
366 | | typedef struct trust_token_client_st TRUST_TOKEN_CLIENT; |
367 | | typedef struct trust_token_issuer_st TRUST_TOKEN_ISSUER; |
368 | | typedef struct trust_token_method_st TRUST_TOKEN_METHOD; |
369 | | typedef struct v3_ext_ctx X509V3_CTX; |
370 | | typedef struct v3_ext_method X509V3_EXT_METHOD; |
371 | | typedef struct x509_attributes_st X509_ATTRIBUTE; |
372 | | typedef struct x509_lookup_st X509_LOOKUP; |
373 | | typedef struct x509_lookup_method_st X509_LOOKUP_METHOD; |
374 | | typedef struct x509_object_st X509_OBJECT; |
375 | | typedef struct x509_purpose_st X509_PURPOSE; |
376 | | typedef struct x509_revoked_st X509_REVOKED; |
377 | | typedef struct x509_st X509; |
378 | | typedef struct x509_store_ctx_st X509_STORE_CTX; |
379 | | typedef struct x509_store_st X509_STORE; |
380 | | |
381 | | typedef void *OPENSSL_BLOCK; |
382 | | |
383 | | // BSSL_CHECK aborts if |condition| is not true. |
384 | | #define BSSL_CHECK(condition) \ |
385 | 82.6M | do { \ |
386 | 82.6M | if (!(condition)) { \ |
387 | 0 | abort(); \ |
388 | 0 | } \ |
389 | 82.6M | } while (0); |
390 | | |
391 | | #if defined(__cplusplus) |
392 | | } // extern C |
393 | | #elif !defined(BORINGSSL_NO_CXX) |
394 | | #define BORINGSSL_NO_CXX |
395 | | #endif |
396 | | |
397 | | #if defined(BORINGSSL_PREFIX) |
398 | | #define BSSL_NAMESPACE_BEGIN \ |
399 | | namespace bssl { \ |
400 | | inline namespace BORINGSSL_PREFIX { |
401 | | #define BSSL_NAMESPACE_END \ |
402 | | } \ |
403 | | } |
404 | | #else |
405 | | #define BSSL_NAMESPACE_BEGIN namespace bssl { |
406 | | #define BSSL_NAMESPACE_END } |
407 | | #endif |
408 | | |
409 | | // MSVC doesn't set __cplusplus to 201103 to indicate C++11 support (see |
410 | | // https://connect.microsoft.com/VisualStudio/feedback/details/763051/a-value-of-predefined-macro-cplusplus-is-still-199711l) |
411 | | // so MSVC is just assumed to support C++11. |
412 | | #if !defined(BORINGSSL_NO_CXX) && __cplusplus < 201103L && !defined(_MSC_VER) |
413 | | #define BORINGSSL_NO_CXX |
414 | | #endif |
415 | | |
416 | | #if !defined(BORINGSSL_NO_CXX) |
417 | | |
418 | | extern "C++" { |
419 | | |
420 | | #include <memory> |
421 | | |
422 | | // STLPort, used by some Android consumers, not have std::unique_ptr. |
423 | | #if defined(_STLPORT_VERSION) |
424 | | #define BORINGSSL_NO_CXX |
425 | | #endif |
426 | | |
427 | | } // extern C++ |
428 | | #endif // !BORINGSSL_NO_CXX |
429 | | |
430 | | #if defined(BORINGSSL_NO_CXX) |
431 | | |
432 | | #define BORINGSSL_MAKE_DELETER(type, deleter) |
433 | | #define BORINGSSL_MAKE_UP_REF(type, up_ref_func) |
434 | | |
435 | | #else |
436 | | |
437 | | extern "C++" { |
438 | | |
439 | | BSSL_NAMESPACE_BEGIN |
440 | | |
441 | | namespace internal { |
442 | | |
443 | | // The Enable parameter is ignored and only exists so specializations can use |
444 | | // SFINAE. |
445 | | template <typename T, typename Enable = void> |
446 | | struct DeleterImpl {}; |
447 | | |
448 | | struct Deleter { |
449 | | template <typename T> |
450 | 4.89M | void operator()(T *ptr) { |
451 | | // Rather than specialize Deleter for each type, we specialize |
452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only |
453 | | // including base.h as long as the destructor is not emitted. This matches |
454 | | // std::unique_ptr's behavior on forward-declared types. |
455 | | // |
456 | | // DeleterImpl itself is specialized in the corresponding module's header |
457 | | // and must be included to release an object. If not included, the compiler |
458 | | // will error that DeleterImpl<T> does not have a method Free. |
459 | 4.89M | DeleterImpl<T>::Free(ptr); |
460 | 4.89M | } void bssl::internal::Deleter::operator()<ssl_ctx_st>(ssl_ctx_st*) Line | Count | Source | 450 | 216k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 216k | DeleterImpl<T>::Free(ptr); | 460 | 216k | } |
void bssl::internal::Deleter::operator()<evp_pkey_st>(evp_pkey_st*) Line | Count | Source | 450 | 642k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 642k | DeleterImpl<T>::Free(ptr); | 460 | 642k | } |
void bssl::internal::Deleter::operator()<unsigned char>(unsigned char*) Line | Count | Source | 450 | 1.14k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 1.14k | DeleterImpl<T>::Free(ptr); | 460 | 1.14k | } |
void bssl::internal::Deleter::operator()<ssl_ech_keys_st>(ssl_ech_keys_st*) Line | Count | Source | 450 | 14.0k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 14.0k | DeleterImpl<T>::Free(ptr); | 460 | 14.0k | } |
void bssl::internal::Deleter::operator()<x509_st>(x509_st*) Line | Count | Source | 450 | 30.7k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 30.7k | DeleterImpl<T>::Free(ptr); | 460 | 30.7k | } |
void bssl::internal::Deleter::operator()<rsa_st>(rsa_st*) Line | Count | Source | 450 | 12 | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 12 | DeleterImpl<T>::Free(ptr); | 460 | 12 | } |
void bssl::internal::Deleter::operator()<ssl_session_st>(ssl_session_st*) Line | Count | Source | 450 | 356k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 356k | DeleterImpl<T>::Free(ptr); | 460 | 356k | } |
void bssl::internal::Deleter::operator()<bio_st>(bio_st*) Line | Count | Source | 450 | 66.9k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 66.9k | DeleterImpl<T>::Free(ptr); | 460 | 66.9k | } |
void bssl::internal::Deleter::operator()<ssl_st>(ssl_st*) Line | Count | Source | 450 | 106k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 106k | DeleterImpl<T>::Free(ptr); | 460 | 106k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<dh_st>(dh_st*) void bssl::internal::Deleter::operator()<dsa_st>(dsa_st*) Line | Count | Source | 450 | 4.46k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 4.46k | DeleterImpl<T>::Free(ptr); | 460 | 4.46k | } |
void bssl::internal::Deleter::operator()<ec_key_st>(ec_key_st*) Line | Count | Source | 450 | 24.0k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 24.0k | DeleterImpl<T>::Free(ptr); | 460 | 24.0k | } |
void bssl::internal::Deleter::operator()<crypto_buffer_st>(crypto_buffer_st*) Line | Count | Source | 450 | 307k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 307k | DeleterImpl<T>::Free(ptr); | 460 | 307k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<X509_crl_st>(X509_crl_st*) Unexecuted instantiation: void bssl::internal::Deleter::operator()<x509_store_st>(x509_store_st*) void bssl::internal::Deleter::operator()<ssl_credential_st>(ssl_credential_st*) Line | Count | Source | 450 | 252k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 252k | DeleterImpl<T>::Free(ptr); | 460 | 252k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<bssl::ECHConfig>(bssl::ECHConfig*) void bssl::internal::Deleter::operator()<bssl::ECHServerConfig>(bssl::ECHServerConfig*) Line | Count | Source | 450 | 11.5k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 11.5k | DeleterImpl<T>::Free(ptr); | 460 | 11.5k | } |
void bssl::internal::Deleter::operator()<stack_st_CRYPTO_BUFFER>(stack_st_CRYPTO_BUFFER*) Line | Count | Source | 450 | 327k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 327k | DeleterImpl<T>::Free(ptr); | 460 | 327k | } |
void bssl::internal::Deleter::operator()<bssl::SSLPAKEShare>(bssl::SSLPAKEShare*) Line | Count | Source | 450 | 12 | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 12 | DeleterImpl<T>::Free(ptr); | 460 | 12 | } |
void bssl::internal::Deleter::operator()<bssl::SSLKeyShare>(bssl::SSLKeyShare*) Line | Count | Source | 450 | 170k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 170k | DeleterImpl<T>::Free(ptr); | 460 | 170k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<bssl::spake2plus::Prover>(bssl::spake2plus::Prover*) void bssl::internal::Deleter::operator()<ecdsa_sig_st>(ecdsa_sig_st*) Line | Count | Source | 450 | 7.25k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 7.25k | DeleterImpl<T>::Free(ptr); | 460 | 7.25k | } |
void bssl::internal::Deleter::operator()<bignum_st>(bignum_st*) Line | Count | Source | 450 | 461k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 461k | DeleterImpl<T>::Free(ptr); | 460 | 461k | } |
void bssl::internal::Deleter::operator()<ec_point_st>(ec_point_st*) Line | Count | Source | 450 | 140k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 140k | DeleterImpl<T>::Free(ptr); | 460 | 140k | } |
void bssl::internal::Deleter::operator()<bssl::SSLCipherPreferenceList>(bssl::SSLCipherPreferenceList*) Line | Count | Source | 450 | 16.5k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 16.5k | DeleterImpl<T>::Free(ptr); | 460 | 16.5k | } |
void bssl::internal::Deleter::operator()<stack_st_SSL_CIPHER>(stack_st_SSL_CIPHER*) Line | Count | Source | 450 | 23.3k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 23.3k | DeleterImpl<T>::Free(ptr); | 460 | 23.3k | } |
void bssl::internal::Deleter::operator()<buf_mem_st>(buf_mem_st*) Line | Count | Source | 450 | 472k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 472k | DeleterImpl<T>::Free(ptr); | 460 | 472k | } |
void bssl::internal::Deleter::operator()<bssl::SSL_HANDSHAKE>(bssl::SSL_HANDSHAKE*) Line | Count | Source | 450 | 152k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 152k | DeleterImpl<T>::Free(ptr); | 460 | 152k | } |
void bssl::internal::Deleter::operator()<char>(char*) Line | Count | Source | 450 | 26.6k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 26.6k | DeleterImpl<T>::Free(ptr); | 460 | 26.6k | } |
void bssl::internal::Deleter::operator()<bssl::SSL_HANDSHAKE_HINTS>(bssl::SSL_HANDSHAKE_HINTS*) Line | Count | Source | 450 | 92.9k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 92.9k | DeleterImpl<T>::Free(ptr); | 460 | 92.9k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<bssl::spake2plus::Verifier>(bssl::spake2plus::Verifier*) void bssl::internal::Deleter::operator()<err_save_state_st>(err_save_state_st*) Line | Count | Source | 450 | 26.9k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 26.9k | DeleterImpl<T>::Free(ptr); | 460 | 26.9k | } |
void bssl::internal::Deleter::operator()<bssl::SSLAEADContext>(bssl::SSLAEADContext*) Line | Count | Source | 450 | 362k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 362k | DeleterImpl<T>::Free(ptr); | 460 | 362k | } |
void bssl::internal::Deleter::operator()<bssl::CERT>(bssl::CERT*) Line | Count | Source | 450 | 110k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 110k | DeleterImpl<T>::Free(ptr); | 460 | 110k | } |
Unexecuted instantiation: ssl_key_share.cc:void bssl::internal::Deleter::operator()<bssl::(anonymous namespace)::ECKeyShare>(bssl::(anonymous namespace)::ECKeyShare*) Unexecuted instantiation: ssl_key_share.cc:void bssl::internal::Deleter::operator()<bssl::(anonymous namespace)::X25519KeyShare>(bssl::(anonymous namespace)::X25519KeyShare*) Unexecuted instantiation: ssl_key_share.cc:void bssl::internal::Deleter::operator()<bssl::(anonymous namespace)::X25519Kyber768KeyShare>(bssl::(anonymous namespace)::X25519Kyber768KeyShare*) Unexecuted instantiation: ssl_key_share.cc:void bssl::internal::Deleter::operator()<bssl::(anonymous namespace)::X25519MLKEM768KeyShare>(bssl::(anonymous namespace)::X25519MLKEM768KeyShare*) Unexecuted instantiation: ssl_key_share.cc:void bssl::internal::Deleter::operator()<bssl::(anonymous namespace)::MLKEM1024KeyShare>(bssl::(anonymous namespace)::MLKEM1024KeyShare*) void bssl::internal::Deleter::operator()<bssl::SSL_CONFIG>(bssl::SSL_CONFIG*) Line | Count | Source | 450 | 106k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 106k | DeleterImpl<T>::Free(ptr); | 460 | 106k | } |
void bssl::internal::Deleter::operator()<stack_st_SRTP_PROTECTION_PROFILE>(stack_st_SRTP_PROTECTION_PROFILE*) Line | Count | Source | 450 | 5.00k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 5.00k | DeleterImpl<T>::Free(ptr); | 460 | 5.00k | } |
void bssl::internal::Deleter::operator()<bssl::TicketKey>(bssl::TicketKey*) Line | Count | Source | 450 | 388 | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 388 | DeleterImpl<T>::Free(ptr); | 460 | 388 | } |
void bssl::internal::Deleter::operator()<X509_name_st>(X509_name_st*) Line | Count | Source | 450 | 527 | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 527 | DeleterImpl<T>::Free(ptr); | 460 | 527 | } |
void bssl::internal::Deleter::operator()<stack_st_X509>(stack_st_X509*) Line | Count | Source | 450 | 9.89k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 9.89k | DeleterImpl<T>::Free(ptr); | 460 | 9.89k | } |
void bssl::internal::Deleter::operator()<x509_store_ctx_st>(x509_store_ctx_st*) Line | Count | Source | 450 | 7.43k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 7.43k | DeleterImpl<T>::Free(ptr); | 460 | 7.43k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<stack_st_X509_NAME>(stack_st_X509_NAME*) void bssl::internal::Deleter::operator()<bssl::RecordNumberEncrypter>(bssl::RecordNumberEncrypter*) Line | Count | Source | 450 | 43.4k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 43.4k | DeleterImpl<T>::Free(ptr); | 460 | 43.4k | } |
Unexecuted instantiation: tls13_enc.cc:void bssl::internal::Deleter::operator()<bssl::(anonymous namespace)::NullRecordNumberEncrypter>(bssl::(anonymous namespace)::NullRecordNumberEncrypter*) Unexecuted instantiation: tls13_enc.cc:void bssl::internal::Deleter::operator()<bssl::(anonymous namespace)::AES128RecordNumberEncrypter>(bssl::(anonymous namespace)::AES128RecordNumberEncrypter*) Unexecuted instantiation: tls13_enc.cc:void bssl::internal::Deleter::operator()<bssl::(anonymous namespace)::AES256RecordNumberEncrypter>(bssl::(anonymous namespace)::AES256RecordNumberEncrypter*) Unexecuted instantiation: tls13_enc.cc:void bssl::internal::Deleter::operator()<bssl::(anonymous namespace)::ChaChaRecordNumberEncrypter>(bssl::(anonymous namespace)::ChaChaRecordNumberEncrypter*) void bssl::internal::Deleter::operator()<bssl::MRUQueue<bssl::DTLSSentRecord, 32ul> >(bssl::MRUQueue<bssl::DTLSSentRecord, 32ul>*) Line | Count | Source | 450 | 9.67k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 9.67k | DeleterImpl<T>::Free(ptr); | 460 | 9.67k | } |
void bssl::internal::Deleter::operator()<bssl::DTLSIncomingMessage>(bssl::DTLSIncomingMessage*) Line | Count | Source | 450 | 51.4k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 51.4k | DeleterImpl<T>::Free(ptr); | 460 | 51.4k | } |
void bssl::internal::Deleter::operator()<bssl::DTLSWriteEpoch>(bssl::DTLSWriteEpoch*) Line | Count | Source | 450 | 7.29k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 7.29k | DeleterImpl<T>::Free(ptr); | 460 | 7.29k | } |
void bssl::internal::Deleter::operator()<bssl::DTLSReadEpoch>(bssl::DTLSReadEpoch*) Line | Count | Source | 450 | 36.6k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 36.6k | DeleterImpl<T>::Free(ptr); | 460 | 36.6k | } |
void bssl::internal::Deleter::operator()<bssl::DTLSPrevReadEpoch>(bssl::DTLSPrevReadEpoch*) Line | Count | Source | 450 | 34.5k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 34.5k | DeleterImpl<T>::Free(ptr); | 460 | 34.5k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<bssl::DTLS1_STATE>(bssl::DTLS1_STATE*) Unexecuted instantiation: void bssl::internal::Deleter::operator()<bssl::SSL3_STATE>(bssl::SSL3_STATE*) void bssl::internal::Deleter::operator()<bn_mont_ctx_st>(bn_mont_ctx_st*) Line | Count | Source | 450 | 8.00k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 8.00k | DeleterImpl<T>::Free(ptr); | 460 | 8.00k | } |
void bssl::internal::Deleter::operator()<bignum_ctx>(bignum_ctx*) Line | Count | Source | 450 | 111k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 111k | DeleterImpl<T>::Free(ptr); | 460 | 111k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<ec_group_st>(ec_group_st*) Unexecuted instantiation: void bssl::internal::Deleter::operator()<evp_pkey_ctx_st>(evp_pkey_ctx_st*) Unexecuted instantiation: void bssl::internal::Deleter::operator()<X509_algor_st>(X509_algor_st*) void bssl::internal::Deleter::operator()<asn1_object_st>(asn1_object_st*) Line | Count | Source | 450 | 12.0k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 12.0k | DeleterImpl<T>::Free(ptr); | 460 | 12.0k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<asn1_type_st>(asn1_type_st*) Unexecuted instantiation: void bssl::internal::Deleter::operator()<X509_pubkey_st>(X509_pubkey_st*) void bssl::internal::Deleter::operator()<asn1_string_st>(asn1_string_st*) Line | Count | Source | 450 | 7.86k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 7.86k | DeleterImpl<T>::Free(ptr); | 460 | 7.86k | } |
Unexecuted instantiation: void bssl::internal::Deleter::operator()<DSA_SIG_st>(DSA_SIG_st*) void bssl::internal::Deleter::operator()<ACCESS_DESCRIPTION_st>(ACCESS_DESCRIPTION_st*) Line | Count | Source | 450 | 44 | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 44 | DeleterImpl<T>::Free(ptr); | 460 | 44 | } |
void bssl::internal::Deleter::operator()<stack_st_ACCESS_DESCRIPTION>(stack_st_ACCESS_DESCRIPTION*) Line | Count | Source | 450 | 44 | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 44 | DeleterImpl<T>::Free(ptr); | 460 | 44 | } |
void bssl::internal::Deleter::operator()<conf_st>(conf_st*) Line | Count | Source | 450 | 11.7k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 11.7k | DeleterImpl<T>::Free(ptr); | 460 | 11.7k | } |
void bssl::internal::Deleter::operator()<X509_extension_st>(X509_extension_st*) Line | Count | Source | 450 | 2.75k | void operator()(T *ptr) { | 451 | | // Rather than specialize Deleter for each type, we specialize | 452 | | // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only | 453 | | // including base.h as long as the destructor is not emitted. This matches | 454 | | // std::unique_ptr's behavior on forward-declared types. | 455 | | // | 456 | | // DeleterImpl itself is specialized in the corresponding module's header | 457 | | // and must be included to release an object. If not included, the compiler | 458 | | // will error that DeleterImpl<T> does not have a method Free. | 459 | 2.75k | DeleterImpl<T>::Free(ptr); | 460 | 2.75k | } |
|
461 | | }; |
462 | | |
463 | | template <typename T, typename CleanupRet, void (*init)(T *), |
464 | | CleanupRet (*cleanup)(T *)> |
465 | | class StackAllocated { |
466 | | public: |
467 | 1.38M | StackAllocated() { init(&ctx_); } bssl::internal::StackAllocated<cbb_st, void, &CBB_zero, &CBB_cleanup>::StackAllocated() Line | Count | Source | 467 | 864k | StackAllocated() { init(&ctx_); } |
bssl::internal::StackAllocated<evp_cipher_ctx_st, int, &EVP_CIPHER_CTX_init, &EVP_CIPHER_CTX_cleanup>::StackAllocated() Line | Count | Source | 467 | 1.24k | StackAllocated() { init(&ctx_); } |
bssl::internal::StackAllocated<hmac_ctx_st, void, &HMAC_CTX_init, &HMAC_CTX_cleanup>::StackAllocated() Line | Count | Source | 467 | 1.23k | StackAllocated() { init(&ctx_); } |
bssl::internal::StackAllocated<evp_hpke_ctx_st, void, &EVP_HPKE_CTX_zero, &EVP_HPKE_CTX_cleanup>::StackAllocated() Line | Count | Source | 467 | 152k | StackAllocated() { init(&ctx_); } |
bssl::internal::StackAllocated<evp_aead_ctx_st, void, &EVP_AEAD_CTX_zero, &EVP_AEAD_CTX_cleanup>::StackAllocated() Line | Count | Source | 467 | 362k | StackAllocated() { init(&ctx_); } |
|
468 | 1.38M | ~StackAllocated() { cleanup(&ctx_); } bssl::internal::StackAllocated<cbb_st, void, &CBB_zero, &CBB_cleanup>::~StackAllocated() Line | Count | Source | 468 | 864k | ~StackAllocated() { cleanup(&ctx_); } |
bssl::internal::StackAllocated<hmac_ctx_st, void, &HMAC_CTX_init, &HMAC_CTX_cleanup>::~StackAllocated() Line | Count | Source | 468 | 1.23k | ~StackAllocated() { cleanup(&ctx_); } |
bssl::internal::StackAllocated<evp_cipher_ctx_st, int, &EVP_CIPHER_CTX_init, &EVP_CIPHER_CTX_cleanup>::~StackAllocated() Line | Count | Source | 468 | 1.24k | ~StackAllocated() { cleanup(&ctx_); } |
bssl::internal::StackAllocated<evp_hpke_ctx_st, void, &EVP_HPKE_CTX_zero, &EVP_HPKE_CTX_cleanup>::~StackAllocated() Line | Count | Source | 468 | 152k | ~StackAllocated() { cleanup(&ctx_); } |
bssl::internal::StackAllocated<evp_aead_ctx_st, void, &EVP_AEAD_CTX_zero, &EVP_AEAD_CTX_cleanup>::~StackAllocated() Line | Count | Source | 468 | 362k | ~StackAllocated() { cleanup(&ctx_); } |
|
469 | | |
470 | | StackAllocated(const StackAllocated &) = delete; |
471 | | StackAllocated &operator=(const StackAllocated &) = delete; |
472 | | |
473 | 10.6M | T *get() { return &ctx_; } bssl::internal::StackAllocated<cbb_st, void, &CBB_zero, &CBB_cleanup>::get() Line | Count | Source | 473 | 10.4M | T *get() { return &ctx_; } |
bssl::internal::StackAllocated<evp_hpke_ctx_st, void, &EVP_HPKE_CTX_zero, &EVP_HPKE_CTX_cleanup>::get() Line | Count | Source | 473 | 531 | T *get() { return &ctx_; } |
bssl::internal::StackAllocated<evp_cipher_ctx_st, int, &EVP_CIPHER_CTX_init, &EVP_CIPHER_CTX_cleanup>::get() Line | Count | Source | 473 | 2.56k | T *get() { return &ctx_; } |
bssl::internal::StackAllocated<hmac_ctx_st, void, &HMAC_CTX_init, &HMAC_CTX_cleanup>::get() Line | Count | Source | 473 | 15.7k | T *get() { return &ctx_; } |
bssl::internal::StackAllocated<evp_aead_ctx_st, void, &EVP_AEAD_CTX_zero, &EVP_AEAD_CTX_cleanup>::get() Line | Count | Source | 473 | 159k | T *get() { return &ctx_; } |
|
474 | 16.7k | const T *get() const { return &ctx_; } |
475 | | |
476 | | T *operator->() { return &ctx_; } |
477 | | const T *operator->() const { return &ctx_; } |
478 | | |
479 | 395 | void Reset() { |
480 | 395 | cleanup(&ctx_); |
481 | 395 | init(&ctx_); |
482 | 395 | } |
483 | | |
484 | | private: |
485 | | T ctx_; |
486 | | }; |
487 | | |
488 | | template <typename T, typename CleanupRet, void (*init)(T *), |
489 | | CleanupRet (*cleanup)(T *), void (*move)(T *, T *)> |
490 | | class StackAllocatedMovable { |
491 | | public: |
492 | 712k | StackAllocatedMovable() { init(&ctx_); } bssl::internal::StackAllocatedMovable<evp_hpke_key_st, void, &EVP_HPKE_KEY_zero, &EVP_HPKE_KEY_cleanup, &EVP_HPKE_KEY_move>::StackAllocatedMovable() Line | Count | Source | 492 | 23.8k | StackAllocatedMovable() { init(&ctx_); } |
bssl::internal::StackAllocatedMovable<env_md_ctx_st, int, &EVP_MD_CTX_init, &EVP_MD_CTX_cleanup, &EVP_MD_CTX_move>::StackAllocatedMovable() Line | Count | Source | 492 | 688k | StackAllocatedMovable() { init(&ctx_); } |
|
493 | 712k | ~StackAllocatedMovable() { cleanup(&ctx_); } bssl::internal::StackAllocatedMovable<evp_hpke_key_st, void, &EVP_HPKE_KEY_zero, &EVP_HPKE_KEY_cleanup, &EVP_HPKE_KEY_move>::~StackAllocatedMovable() Line | Count | Source | 493 | 23.7k | ~StackAllocatedMovable() { cleanup(&ctx_); } |
bssl::internal::StackAllocatedMovable<env_md_ctx_st, int, &EVP_MD_CTX_init, &EVP_MD_CTX_cleanup, &EVP_MD_CTX_move>::~StackAllocatedMovable() Line | Count | Source | 493 | 688k | ~StackAllocatedMovable() { cleanup(&ctx_); } |
|
494 | | |
495 | | StackAllocatedMovable(StackAllocatedMovable &&other) { |
496 | | init(&ctx_); |
497 | | move(&ctx_, &other.ctx_); |
498 | | } |
499 | 0 | StackAllocatedMovable &operator=(StackAllocatedMovable &&other) { |
500 | 0 | move(&ctx_, &other.ctx_); |
501 | 0 | return *this; |
502 | 0 | } |
503 | | |
504 | 2.70M | T *get() { return &ctx_; } bssl::internal::StackAllocatedMovable<evp_hpke_key_st, void, &EVP_HPKE_KEY_zero, &EVP_HPKE_KEY_cleanup, &EVP_HPKE_KEY_move>::get() Line | Count | Source | 504 | 23.8k | T *get() { return &ctx_; } |
bssl::internal::StackAllocatedMovable<env_md_ctx_st, int, &EVP_MD_CTX_init, &EVP_MD_CTX_cleanup, &EVP_MD_CTX_move>::get() Line | Count | Source | 504 | 2.68M | T *get() { return &ctx_; } |
|
505 | 596k | const T *get() const { return &ctx_; } bssl::internal::StackAllocatedMovable<evp_hpke_key_st, void, &EVP_HPKE_KEY_zero, &EVP_HPKE_KEY_cleanup, &EVP_HPKE_KEY_move>::get() const Line | Count | Source | 505 | 315 | const T *get() const { return &ctx_; } |
bssl::internal::StackAllocatedMovable<env_md_ctx_st, int, &EVP_MD_CTX_init, &EVP_MD_CTX_cleanup, &EVP_MD_CTX_move>::get() const Line | Count | Source | 505 | 595k | const T *get() const { return &ctx_; } |
|
506 | | |
507 | 0 | T *operator->() { return &ctx_; } |
508 | | const T *operator->() const { return &ctx_; } |
509 | | |
510 | 153k | void Reset() { |
511 | 153k | cleanup(&ctx_); |
512 | 153k | init(&ctx_); |
513 | 153k | } |
514 | | |
515 | | private: |
516 | | T ctx_; |
517 | | }; |
518 | | |
519 | | } // namespace internal |
520 | | |
521 | | #define BORINGSSL_MAKE_DELETER(type, deleter) \ |
522 | | namespace internal { \ |
523 | | template <> \ |
524 | | struct DeleterImpl<type> { \ |
525 | 3.71M | static void Free(type *ptr) { deleter(ptr); } \ bssl::internal::DeleterImpl<ssl_ctx_st, void>::Free(ssl_ctx_st*) Line | Count | Source | 525 | 216k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<evp_pkey_st, void>::Free(evp_pkey_st*) Line | Count | Source | 525 | 642k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<unsigned char, void>::Free(unsigned char*) Line | Count | Source | 525 | 1.14k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<ssl_ech_keys_st, void>::Free(ssl_ech_keys_st*) Line | Count | Source | 525 | 14.0k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<x509_st, void>::Free(x509_st*) Line | Count | Source | 525 | 31.3k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<rsa_st, void>::Free(rsa_st*) Line | Count | Source | 525 | 12 | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<ssl_session_st, void>::Free(ssl_session_st*) Line | Count | Source | 525 | 356k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<bio_st, void>::Free(bio_st*) Line | Count | Source | 525 | 66.9k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<ssl_st, void>::Free(ssl_st*) Line | Count | Source | 525 | 106k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<buf_mem_st, void>::Free(buf_mem_st*) Line | Count | Source | 525 | 472k | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<bio_method_st, void>::Free(bio_method_st*) bssl::internal::DeleterImpl<char, void>::Free(char*) Line | Count | Source | 525 | 26.6k | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<evp_aead_ctx_st, void>::Free(evp_aead_ctx_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<evp_cipher_ctx_st, void>::Free(evp_cipher_ctx_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<env_md_ctx_st, void>::Free(env_md_ctx_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<evp_pkey_ctx_st, void>::Free(evp_pkey_ctx_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<spake2_ctx_st, void>::Free(spake2_ctx_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<evp_hpke_ctx_st, void>::Free(evp_hpke_ctx_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<evp_hpke_key_st, void>::Free(evp_hpke_key_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<engine_st, void>::Free(engine_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<PKCS7, void>::Free(PKCS7*) bssl::internal::DeleterImpl<bignum_st, void>::Free(bignum_st*) Line | Count | Source | 525 | 461k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<bignum_ctx, void>::Free(bignum_ctx*) Line | Count | Source | 525 | 111k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<bn_mont_ctx_st, void>::Free(bn_mont_ctx_st*) Line | Count | Source | 525 | 8.00k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<asn1_object_st, void>::Free(asn1_object_st*) Line | Count | Source | 525 | 12.0k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<asn1_string_st, void>::Free(asn1_string_st*) Line | Count | Source | 525 | 7.86k | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<asn1_type_st, void>::Free(asn1_type_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<dh_st, void>::Free(dh_st*) bssl::internal::DeleterImpl<dsa_st, void>::Free(dsa_st*) Line | Count | Source | 525 | 4.46k | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<DSA_SIG_st, void>::Free(DSA_SIG_st*) bssl::internal::DeleterImpl<ec_key_st, void>::Free(ec_key_st*) Line | Count | Source | 525 | 24.0k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<ec_point_st, void>::Free(ec_point_st*) Line | Count | Source | 525 | 140k | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<ec_group_st, void>::Free(ec_group_st*) bssl::internal::DeleterImpl<ecdsa_sig_st, void>::Free(ecdsa_sig_st*) Line | Count | Source | 525 | 7.25k | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<crypto_buffer_pool_st, void>::Free(crypto_buffer_pool_st*) bssl::internal::DeleterImpl<crypto_buffer_st, void>::Free(crypto_buffer_st*) Line | Count | Source | 525 | 696k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<ACCESS_DESCRIPTION_st, void>::Free(ACCESS_DESCRIPTION_st*) Line | Count | Source | 525 | 262 | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<AUTHORITY_KEYID_st, void>::Free(AUTHORITY_KEYID_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<BASIC_CONSTRAINTS_st, void>::Free(BASIC_CONSTRAINTS_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<conf_value_st, void>::Free(conf_value_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<DIST_POINT_st, void>::Free(DIST_POINT_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<GENERAL_NAME_st, void>::Free(GENERAL_NAME_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<GENERAL_SUBTREE_st, void>::Free(GENERAL_SUBTREE_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<NAME_CONSTRAINTS_st, void>::Free(NAME_CONSTRAINTS_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<Netscape_spki_st, void>::Free(Netscape_spki_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<POLICY_MAPPING_st, void>::Free(POLICY_MAPPING_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<POLICYINFO_st, void>::Free(POLICYINFO_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<rsa_pss_params_st, void>::Free(rsa_pss_params_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<X509_algor_st, void>::Free(X509_algor_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<x509_attributes_st, void>::Free(x509_attributes_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<X509_crl_st, void>::Free(X509_crl_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<X509_info_st, void>::Free(X509_info_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<x509_lookup_st, void>::Free(x509_lookup_st*) bssl::internal::DeleterImpl<X509_name_st, void>::Free(X509_name_st*) Line | Count | Source | 525 | 527 | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<X509_name_entry_st, void>::Free(X509_name_entry_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<x509_object_st, void>::Free(x509_object_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<X509_pubkey_st, void>::Free(X509_pubkey_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<X509_req_st, void>::Free(X509_req_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<x509_revoked_st, void>::Free(x509_revoked_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<X509_sig_st, void>::Free(X509_sig_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<x509_store_st, void>::Free(x509_store_st*) bssl::internal::DeleterImpl<x509_store_ctx_st, void>::Free(x509_store_ctx_st*) Line | Count | Source | 525 | 7.43k | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<X509_VERIFY_PARAM_st, void>::Free(X509_VERIFY_PARAM_st*) bssl::internal::DeleterImpl<ssl_credential_st, void>::Free(ssl_credential_st*) Line | Count | Source | 525 | 252k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<err_save_state_st, void>::Free(err_save_state_st*) Line | Count | Source | 525 | 26.9k | static void Free(type *ptr) { deleter(ptr); } \ |
Unexecuted instantiation: bssl::internal::DeleterImpl<hmac_ctx_st, void>::Free(hmac_ctx_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<cmac_ctx_st, void>::Free(cmac_ctx_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<ctr_drbg_state_st, void>::Free(ctr_drbg_state_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<pkcs12_st, void>::Free(pkcs12_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<pkcs8_priv_key_info_st, void>::Free(pkcs8_priv_key_info_st*) Unexecuted instantiation: bssl::internal::DeleterImpl<CMS_ContentInfo_st, void>::Free(CMS_ContentInfo_st*) bssl::internal::DeleterImpl<conf_st, void>::Free(conf_st*) Line | Count | Source | 525 | 11.7k | static void Free(type *ptr) { deleter(ptr); } \ |
bssl::internal::DeleterImpl<X509_extension_st, void>::Free(X509_extension_st*) Line | Count | Source | 525 | 2.75k | static void Free(type *ptr) { deleter(ptr); } \ |
|
526 | | }; \ |
527 | | } |
528 | | |
529 | | // Holds ownership of heap-allocated BoringSSL structures. Sample usage: |
530 | | // bssl::UniquePtr<RSA> rsa(RSA_new()); |
531 | | // bssl::UniquePtr<BIO> bio(BIO_new(BIO_s_mem())); |
532 | | template <typename T> |
533 | | using UniquePtr = std::unique_ptr<T, internal::Deleter>; |
534 | | |
535 | | #define BORINGSSL_MAKE_UP_REF(type, up_ref_func) \ |
536 | 1.84M | inline UniquePtr<type> UpRef(type *v) { \ |
537 | 1.84M | if (v != nullptr) { \ |
538 | 1.44M | up_ref_func(v); \ |
539 | 1.44M | } \ |
540 | 1.84M | return UniquePtr<type>(v); \ |
541 | 1.84M | } \ Unexecuted instantiation: bssl::UpRef(bio_st*) bssl::UpRef(evp_pkey_st*) Line | Count | Source | 536 | 575k | inline UniquePtr<type> UpRef(type *v) { \ | 537 | 575k | if (v != nullptr) { \ | 538 | 478k | up_ref_func(v); \ | 539 | 478k | } \ | 540 | 575k | return UniquePtr<type>(v); \ | 541 | 575k | } \ |
Unexecuted instantiation: bssl::UpRef(rsa_st*) Unexecuted instantiation: bssl::UpRef(dh_st*) Unexecuted instantiation: bssl::UpRef(dsa_st*) Unexecuted instantiation: bssl::UpRef(ec_key_st*) bssl::UpRef(crypto_buffer_st*) Line | Count | Source | 536 | 714k | inline UniquePtr<type> UpRef(type *v) { \ | 537 | 714k | if (v != nullptr) { \ | 538 | 411k | up_ref_func(v); \ | 539 | 411k | } \ | 540 | 714k | return UniquePtr<type>(v); \ | 541 | 714k | } \ |
Line | Count | Source | 536 | 186k | inline UniquePtr<type> UpRef(type *v) { \ | 537 | 186k | if (v != nullptr) { \ | 538 | 185k | up_ref_func(v); \ | 539 | 185k | } \ | 540 | 186k | return UniquePtr<type>(v); \ | 541 | 186k | } \ |
Unexecuted instantiation: bssl::UpRef(X509_crl_st*) Unexecuted instantiation: bssl::UpRef(x509_store_st*) bssl::UpRef(ssl_credential_st*) Line | Count | Source | 536 | 35.9k | inline UniquePtr<type> UpRef(type *v) { \ | 537 | 35.9k | if (v != nullptr) { \ | 538 | 35.9k | up_ref_func(v); \ | 539 | 35.9k | } \ | 540 | 35.9k | return UniquePtr<type>(v); \ | 541 | 35.9k | } \ |
Line | Count | Source | 536 | 212k | inline UniquePtr<type> UpRef(type *v) { \ | 537 | 212k | if (v != nullptr) { \ | 538 | 212k | up_ref_func(v); \ | 539 | 212k | } \ | 540 | 212k | return UniquePtr<type>(v); \ | 541 | 212k | } \ |
bssl::UpRef(ssl_ech_keys_st*) Line | Count | Source | 536 | 401 | inline UniquePtr<type> UpRef(type *v) { \ | 537 | 401 | if (v != nullptr) { \ | 538 | 401 | up_ref_func(v); \ | 539 | 401 | } \ | 540 | 401 | return UniquePtr<type>(v); \ | 541 | 401 | } \ |
bssl::UpRef(ssl_session_st*) Line | Count | Source | 536 | 121k | inline UniquePtr<type> UpRef(type *v) { \ | 537 | 121k | if (v != nullptr) { \ | 538 | 120k | up_ref_func(v); \ | 539 | 120k | } \ | 540 | 121k | return UniquePtr<type>(v); \ | 541 | 121k | } \ |
|
542 | | \ |
543 | 1.13M | inline UniquePtr<type> UpRef(const UniquePtr<type> &ptr) { \ |
544 | 1.13M | return UpRef(ptr.get()); \ |
545 | 1.13M | } Unexecuted instantiation: bssl::UpRef(std::__1::unique_ptr<bio_st, bssl::internal::Deleter> const&) bssl::UpRef(std::__1::unique_ptr<evp_pkey_st, bssl::internal::Deleter> const&) Line | Count | Source | 543 | 484k | inline UniquePtr<type> UpRef(const UniquePtr<type> &ptr) { \ | 544 | 484k | return UpRef(ptr.get()); \ | 545 | 484k | } |
Unexecuted instantiation: bssl::UpRef(std::__1::unique_ptr<rsa_st, bssl::internal::Deleter> const&) Unexecuted instantiation: bssl::UpRef(std::__1::unique_ptr<dh_st, bssl::internal::Deleter> const&) Unexecuted instantiation: bssl::UpRef(std::__1::unique_ptr<dsa_st, bssl::internal::Deleter> const&) Unexecuted instantiation: bssl::UpRef(std::__1::unique_ptr<ec_key_st, bssl::internal::Deleter> const&) bssl::UpRef(std::__1::unique_ptr<crypto_buffer_st, bssl::internal::Deleter> const&) Line | Count | Source | 543 | 509k | inline UniquePtr<type> UpRef(const UniquePtr<type> &ptr) { \ | 544 | 509k | return UpRef(ptr.get()); \ | 545 | 509k | } |
bssl::UpRef(std::__1::unique_ptr<x509_st, bssl::internal::Deleter> const&) Line | Count | Source | 543 | 136k | inline UniquePtr<type> UpRef(const UniquePtr<type> &ptr) { \ | 544 | 136k | return UpRef(ptr.get()); \ | 545 | 136k | } |
Unexecuted instantiation: bssl::UpRef(std::__1::unique_ptr<X509_crl_st, bssl::internal::Deleter> const&) Unexecuted instantiation: bssl::UpRef(std::__1::unique_ptr<x509_store_st, bssl::internal::Deleter> const&) Unexecuted instantiation: bssl::UpRef(std::__1::unique_ptr<ssl_credential_st, bssl::internal::Deleter> const&) Unexecuted instantiation: bssl::UpRef(std::__1::unique_ptr<ssl_ctx_st, bssl::internal::Deleter> const&) bssl::UpRef(std::__1::unique_ptr<ssl_ech_keys_st, bssl::internal::Deleter> const&) Line | Count | Source | 543 | 395 | inline UniquePtr<type> UpRef(const UniquePtr<type> &ptr) { \ | 544 | 395 | return UpRef(ptr.get()); \ | 545 | 395 | } |
bssl::UpRef(std::__1::unique_ptr<ssl_session_st, bssl::internal::Deleter> const&) Line | Count | Source | 543 | 263 | inline UniquePtr<type> UpRef(const UniquePtr<type> &ptr) { \ | 544 | 263 | return UpRef(ptr.get()); \ | 545 | 263 | } |
|
546 | | |
547 | | BSSL_NAMESPACE_END |
548 | | |
549 | | } // extern C++ |
550 | | |
551 | | #endif // !BORINGSSL_NO_CXX |
552 | | |
553 | | #endif // OPENSSL_HEADER_BASE_H |