diff --git a/rustls-libssl/MATRIX.md b/rustls-libssl/MATRIX.md
index 6d9dbf8..353c573 100644
--- a/rustls-libssl/MATRIX.md
+++ b/rustls-libssl/MATRIX.md
@@ -67,7 +67,7 @@
| `SSL_CTX_add_custom_ext` | | | |
| `SSL_CTX_add_server_custom_ext` | | | |
| `SSL_CTX_add_session` | | | |
-| `SSL_CTX_callback_ctrl` | | :white_check_mark: | |
+| `SSL_CTX_callback_ctrl` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_check_private_key` | :white_check_mark: | | :white_check_mark: |
| `SSL_CTX_clear_options` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_config` | | | |
@@ -88,14 +88,14 @@
| `SSL_CTX_get0_security_ex_data` | | | |
| `SSL_CTX_get_cert_store` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_get_ciphers` | | | |
-| `SSL_CTX_get_client_CA_list` | | :white_check_mark: | |
+| `SSL_CTX_get_client_CA_list` | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_CTX_get_client_cert_cb` | | | |
| `SSL_CTX_get_default_passwd_cb` | | | |
| `SSL_CTX_get_default_passwd_cb_userdata` | | | |
-| `SSL_CTX_get_ex_data` | | :white_check_mark: | :exclamation: [^stub] |
+| `SSL_CTX_get_ex_data` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_get_info_callback` | | | |
| `SSL_CTX_get_keylog_callback` | | | |
-| `SSL_CTX_get_max_early_data` | | :white_check_mark: | |
+| `SSL_CTX_get_max_early_data` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_get_num_tickets` | | | |
| `SSL_CTX_get_options` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_get_quiet_shutdown` | | | |
@@ -104,14 +104,14 @@
| `SSL_CTX_get_security_callback` | | | |
| `SSL_CTX_get_security_level` | | | |
| `SSL_CTX_get_ssl_method` | | | |
-| `SSL_CTX_get_timeout` | | :white_check_mark: | |
-| `SSL_CTX_get_verify_callback` | | :white_check_mark: | |
-| `SSL_CTX_get_verify_depth` | | :white_check_mark: | |
-| `SSL_CTX_get_verify_mode` | | :white_check_mark: | |
+| `SSL_CTX_get_timeout` | | :white_check_mark: | :exclamation: [^stub] |
+| `SSL_CTX_get_verify_callback` | | :white_check_mark: | :white_check_mark: |
+| `SSL_CTX_get_verify_depth` | | :white_check_mark: | :white_check_mark: |
+| `SSL_CTX_get_verify_mode` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_has_client_custom_ext` | | | |
| `SSL_CTX_load_verify_dir` | :white_check_mark: | | :white_check_mark: |
| `SSL_CTX_load_verify_file` | :white_check_mark: | | :white_check_mark: |
-| `SSL_CTX_load_verify_locations` | | :white_check_mark: | |
+| `SSL_CTX_load_verify_locations` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_load_verify_store` | | | |
| `SSL_CTX_new` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_new_ex` | | | |
@@ -131,16 +131,16 @@
| `SSL_CTX_set1_param` | | | |
| `SSL_CTX_set_allow_early_data_cb` | | | |
| `SSL_CTX_set_alpn_protos` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| `SSL_CTX_set_alpn_select_cb` | | :white_check_mark: | |
+| `SSL_CTX_set_alpn_select_cb` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_set_async_callback` | | | |
| `SSL_CTX_set_async_callback_arg` | | | |
| `SSL_CTX_set_block_padding` | | | |
-| `SSL_CTX_set_cert_cb` | | :white_check_mark: | |
+| `SSL_CTX_set_cert_cb` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_set_cert_store` | | | |
| `SSL_CTX_set_cert_verify_callback` | | | |
-| `SSL_CTX_set_cipher_list` | :white_check_mark: | :white_check_mark: | :exclamation: [^stub] |
+| `SSL_CTX_set_cipher_list` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_set_ciphersuites` | :white_check_mark: | | :exclamation: [^stub] |
-| `SSL_CTX_set_client_CA_list` | | :white_check_mark: | |
+| `SSL_CTX_set_client_CA_list` | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_CTX_set_client_cert_cb` | | | |
| `SSL_CTX_set_client_cert_engine` [^engine] | | | |
| `SSL_CTX_set_client_hello_cb` | | | |
@@ -156,14 +156,14 @@
| `SSL_CTX_set_default_verify_file` | | | :white_check_mark: |
| `SSL_CTX_set_default_verify_paths` | | | :white_check_mark: |
| `SSL_CTX_set_default_verify_store` | | | :exclamation: [^stub] |
-| `SSL_CTX_set_ex_data` | | :white_check_mark: | :exclamation: [^stub] |
+| `SSL_CTX_set_ex_data` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_set_generate_session_id` | | | |
-| `SSL_CTX_set_info_callback` | | :white_check_mark: | |
+| `SSL_CTX_set_info_callback` | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_CTX_set_keylog_callback` | :white_check_mark: | | :exclamation: [^stub] |
-| `SSL_CTX_set_max_early_data` | | :white_check_mark: | |
+| `SSL_CTX_set_max_early_data` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_set_msg_callback` | :white_check_mark: | | :exclamation: [^stub] |
| `SSL_CTX_set_next_proto_select_cb` [^nextprotoneg] | :white_check_mark: | | :exclamation: [^stub] |
-| `SSL_CTX_set_next_protos_advertised_cb` [^nextprotoneg] | | :white_check_mark: | |
+| `SSL_CTX_set_next_protos_advertised_cb` [^nextprotoneg] | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_CTX_set_not_resumable_session_callback` | | | |
| `SSL_CTX_set_num_tickets` | | | |
| `SSL_CTX_set_options` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
@@ -179,7 +179,7 @@
| `SSL_CTX_set_recv_max_early_data` | | | |
| `SSL_CTX_set_security_callback` | | | |
| `SSL_CTX_set_security_level` | | | |
-| `SSL_CTX_set_session_id_context` | | :white_check_mark: | :exclamation: [^stub] |
+| `SSL_CTX_set_session_id_context` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_set_session_ticket_cb` | | | |
| `SSL_CTX_set_srp_cb_arg` [^deprecatedin_3_0] [^srp] | | | |
| `SSL_CTX_set_srp_client_pwd_callback` [^deprecatedin_3_0] [^srp] | | | |
@@ -191,14 +191,14 @@
| `SSL_CTX_set_ssl_version` [^deprecatedin_3_0] | | | |
| `SSL_CTX_set_stateless_cookie_generate_cb` | | | |
| `SSL_CTX_set_stateless_cookie_verify_cb` | | | |
-| `SSL_CTX_set_timeout` | | :white_check_mark: | |
+| `SSL_CTX_set_timeout` | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_CTX_set_tlsext_max_fragment_length` | | | |
| `SSL_CTX_set_tlsext_ticket_key_evp_cb` | | | |
| `SSL_CTX_set_tlsext_use_srtp` [^srtp] | | | |
| `SSL_CTX_set_tmp_dh_callback` [^deprecatedin_3_0] [^dh] | | | |
| `SSL_CTX_set_trust` | | | |
| `SSL_CTX_set_verify` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| `SSL_CTX_set_verify_depth` | | :white_check_mark: | |
+| `SSL_CTX_set_verify_depth` | | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_up_ref` | | | :white_check_mark: |
| `SSL_CTX_use_PrivateKey` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_CTX_use_PrivateKey_ASN1` | | | |
@@ -272,7 +272,7 @@
| `SSL_callback_ctrl` | | | |
| `SSL_certs_clear` | | | |
| `SSL_check_chain` | | | |
-| `SSL_check_private_key` | | | |
+| `SSL_check_private_key` | | | :white_check_mark: |
| `SSL_clear` | | | |
| `SSL_clear_options` | | :white_check_mark: | :white_check_mark: |
| `SSL_client_hello_get0_ciphers` | | | |
@@ -293,7 +293,7 @@
| `SSL_dane_enable` | | | |
| `SSL_dane_set_flags` | | | |
| `SSL_dane_tlsa_add` | | | |
-| `SSL_do_handshake` | | :white_check_mark: | |
+| `SSL_do_handshake` | | :white_check_mark: | :white_check_mark: |
| `SSL_dup` | | | |
| `SSL_dup_CA_list` | | | |
| `SSL_enable_ct` [^ct] | | | |
@@ -307,7 +307,7 @@
| `SSL_get0_dane` | | | |
| `SSL_get0_dane_authority` | | | |
| `SSL_get0_dane_tlsa` | | | |
-| `SSL_get0_next_proto_negotiated` [^nextprotoneg] | | :white_check_mark: | |
+| `SSL_get0_next_proto_negotiated` [^nextprotoneg] | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_get0_param` | | | |
| `SSL_get0_peer_CA_list` | | | |
| `SSL_get0_peer_certificate` | | | :white_check_mark: |
@@ -329,15 +329,15 @@
| `SSL_get_client_ciphers` | | | |
| `SSL_get_client_random` | | | |
| `SSL_get_current_cipher` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| `SSL_get_current_compression` | | | |
+| `SSL_get_current_compression` | | | :white_check_mark: |
| `SSL_get_current_expansion` | | | |
| `SSL_get_default_passwd_cb` | | | |
| `SSL_get_default_passwd_cb_userdata` | | | |
| `SSL_get_default_timeout` | | | |
| `SSL_get_early_data_status` | | | |
| `SSL_get_error` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| `SSL_get_ex_data` | :white_check_mark: | :white_check_mark: | :exclamation: [^stub] |
-| `SSL_get_ex_data_X509_STORE_CTX_idx` | | :white_check_mark: | |
+| `SSL_get_ex_data` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
+| `SSL_get_ex_data_X509_STORE_CTX_idx` | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_get_fd` | | | |
| `SSL_get_finished` | | | |
| `SSL_get_info_callback` | | | |
@@ -362,8 +362,8 @@
| `SSL_get_security_level` | | | |
| `SSL_get_selected_srtp_profile` [^srtp] | | | |
| `SSL_get_server_random` | | | |
-| `SSL_get_servername` | | :white_check_mark: | |
-| `SSL_get_servername_type` | | | |
+| `SSL_get_servername` | | :white_check_mark: | :white_check_mark: |
+| `SSL_get_servername_type` | | | :white_check_mark: |
| `SSL_get_session` | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_get_shared_ciphers` | | | |
| `SSL_get_shared_sigalgs` | | | |
@@ -378,7 +378,7 @@
| `SSL_get_ssl_method` | | | |
| `SSL_get_state` | | | :white_check_mark: |
| `SSL_get_verify_callback` | | | |
-| `SSL_get_verify_depth` | | | |
+| `SSL_get_verify_depth` | | | :white_check_mark: |
| `SSL_get_verify_mode` | | | |
| `SSL_get_verify_result` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_get_version` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
@@ -393,7 +393,7 @@
| `SSL_is_init_finished` | | :white_check_mark: | :white_check_mark: |
| `SSL_is_server` | | | :white_check_mark: |
| `SSL_key_update` | | | |
-| `SSL_load_client_CA_file` | | :white_check_mark: | |
+| `SSL_load_client_CA_file` | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_load_client_CA_file_ex` | | | |
| `SSL_new` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_new_session_ticket` | | | |
@@ -401,16 +401,16 @@
| `SSL_peek_ex` | | | |
| `SSL_pending` | :white_check_mark: | | :white_check_mark: |
| `SSL_read` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| `SSL_read_early_data` | | :white_check_mark: | |
+| `SSL_read_early_data` | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_read_ex` | | | |
| `SSL_renegotiate` | | | |
| `SSL_renegotiate_abbreviated` | | | |
| `SSL_renegotiate_pending` | | | |
| `SSL_rstate_string` | | | |
| `SSL_rstate_string_long` | | | |
-| `SSL_select_next_proto` | | :white_check_mark: | |
+| `SSL_select_next_proto` | | :white_check_mark: | :white_check_mark: |
| `SSL_sendfile` | | | |
-| `SSL_session_reused` | | :white_check_mark: | :exclamation: [^stub] |
+| `SSL_session_reused` | | :white_check_mark: | :white_check_mark: |
| `SSL_set0_CA_list` | | | |
| `SSL_set0_rbio` | | | :white_check_mark: |
| `SSL_set0_security_ex_data` | | | |
@@ -436,7 +436,7 @@
| `SSL_set_default_passwd_cb` | | | |
| `SSL_set_default_passwd_cb_userdata` | | | |
| `SSL_set_default_read_buffer_len` | | | |
-| `SSL_set_ex_data` | :white_check_mark: | :white_check_mark: | :exclamation: [^stub] |
+| `SSL_set_ex_data` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_set_fd` [^sock] | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `SSL_set_generate_session_id` | | | |
| `SSL_set_hostflags` | | | |
@@ -452,7 +452,7 @@
| `SSL_set_psk_server_callback` [^psk] | | | |
| `SSL_set_psk_use_session_callback` | | | |
| `SSL_set_purpose` | | | |
-| `SSL_set_quiet_shutdown` | | :white_check_mark: | |
+| `SSL_set_quiet_shutdown` | | :white_check_mark: | :white_check_mark: |
| `SSL_set_read_ahead` | | | |
| `SSL_set_record_padding_callback` | | | |
| `SSL_set_record_padding_callback_arg` | | | |
@@ -473,8 +473,8 @@
| `SSL_set_tlsext_use_srtp` [^srtp] | | | |
| `SSL_set_tmp_dh_callback` [^deprecatedin_3_0] [^dh] | | | |
| `SSL_set_trust` | | | |
-| `SSL_set_verify` | | :white_check_mark: | |
-| `SSL_set_verify_depth` | | :white_check_mark: | |
+| `SSL_set_verify` | | :white_check_mark: | :white_check_mark: |
+| `SSL_set_verify_depth` | | :white_check_mark: | :white_check_mark: |
| `SSL_set_verify_result` | | | |
| `SSL_set_wfd` [^sock] | | | |
| `SSL_shutdown` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
@@ -487,7 +487,7 @@
| `SSL_up_ref` | | | :white_check_mark: |
| `SSL_use_PrivateKey` | | :white_check_mark: | :white_check_mark: |
| `SSL_use_PrivateKey_ASN1` | | | |
-| `SSL_use_PrivateKey_file` | | | |
+| `SSL_use_PrivateKey_file` | | | :white_check_mark: |
| `SSL_use_RSAPrivateKey` [^deprecatedin_3_0] | | | |
| `SSL_use_RSAPrivateKey_ASN1` [^deprecatedin_3_0] | | | |
| `SSL_use_RSAPrivateKey_file` [^deprecatedin_3_0] | | | |
@@ -502,7 +502,7 @@
| `SSL_waiting_for_async` | | | |
| `SSL_want` | | | :white_check_mark: |
| `SSL_write` | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-| `SSL_write_early_data` | | :white_check_mark: | |
+| `SSL_write_early_data` | | :white_check_mark: | :exclamation: [^stub] |
| `SSL_write_ex` | | | |
| `SSLv3_client_method` [^deprecatedin_1_1_0] [^ssl3_method] | | | |
| `SSLv3_method` [^deprecatedin_1_1_0] [^ssl3_method] | | | |
diff --git a/rustls-libssl/build.rs b/rustls-libssl/build.rs
index 905d4e5..34fb6d2 100644
--- a/rustls-libssl/build.rs
+++ b/rustls-libssl/build.rs
@@ -49,6 +49,7 @@ const ENTRYPOINTS: &[&str] = &[
"SSL_accept",
"SSL_alert_desc_string",
"SSL_alert_desc_string_long",
+ "SSL_check_private_key",
"SSL_CIPHER_description",
"SSL_CIPHER_find",
"SSL_CIPHER_get_bits",
@@ -61,6 +62,7 @@ const ENTRYPOINTS: &[&str] = &[
"SSL_connect",
"SSL_ctrl",
"SSL_CTX_add_client_CA",
+ "SSL_CTX_callback_ctrl",
"SSL_CTX_check_private_key",
"SSL_CTX_clear_options",
"SSL_CTX_ctrl",
@@ -68,18 +70,28 @@ const ENTRYPOINTS: &[&str] = &[
"SSL_CTX_get0_certificate",
"SSL_CTX_get0_privatekey",
"SSL_CTX_get_cert_store",
+ "SSL_CTX_get_client_CA_list",
"SSL_CTX_get_ex_data",
+ "SSL_CTX_get_max_early_data",
"SSL_CTX_get_options",
+ "SSL_CTX_get_timeout",
+ "SSL_CTX_get_verify_callback",
+ "SSL_CTX_get_verify_depth",
+ "SSL_CTX_get_verify_mode",
"SSL_CTX_load_verify_dir",
"SSL_CTX_load_verify_file",
+ "SSL_CTX_load_verify_locations",
"SSL_CTX_new",
"SSL_CTX_remove_session",
"SSL_CTX_sess_set_get_cb",
"SSL_CTX_sess_set_new_cb",
"SSL_CTX_sess_set_remove_cb",
"SSL_CTX_set_alpn_protos",
+ "SSL_CTX_set_alpn_select_cb",
+ "SSL_CTX_set_cert_cb",
"SSL_CTX_set_cipher_list",
"SSL_CTX_set_ciphersuites",
+ "SSL_CTX_set_client_CA_list",
"SSL_CTX_set_default_passwd_cb",
"SSL_CTX_set_default_passwd_cb_userdata",
"SSL_CTX_set_default_verify_dir",
@@ -87,38 +99,50 @@ const ENTRYPOINTS: &[&str] = &[
"SSL_CTX_set_default_verify_paths",
"SSL_CTX_set_default_verify_store",
"SSL_CTX_set_ex_data",
+ "SSL_CTX_set_info_callback",
"SSL_CTX_set_keylog_callback",
+ "SSL_CTX_set_max_early_data",
"SSL_CTX_set_msg_callback",
"SSL_CTX_set_next_proto_select_cb",
+ "SSL_CTX_set_next_protos_advertised_cb",
"SSL_CTX_set_options",
"SSL_CTX_set_post_handshake_auth",
"SSL_CTX_set_session_id_context",
"SSL_CTX_set_srp_password",
"SSL_CTX_set_srp_username",
+ "SSL_CTX_set_timeout",
"SSL_CTX_set_verify",
+ "SSL_CTX_set_verify_depth",
"SSL_CTX_up_ref",
"SSL_CTX_use_certificate",
"SSL_CTX_use_certificate_chain_file",
"SSL_CTX_use_certificate_file",
"SSL_CTX_use_PrivateKey",
"SSL_CTX_use_PrivateKey_file",
+ "SSL_do_handshake",
"SSL_free",
"SSL_get0_alpn_selected",
+ "SSL_get0_next_proto_negotiated",
"SSL_get0_peer_certificate",
"SSL_get0_verified_chain",
"SSL_get1_peer_certificate",
"SSL_get1_session",
"SSL_get_certificate",
"SSL_get_current_cipher",
+ "SSL_get_current_compression",
"SSL_get_error",
"SSL_get_ex_data",
+ "SSL_get_ex_data_X509_STORE_CTX_idx",
"SSL_get_options",
"SSL_get_peer_cert_chain",
"SSL_get_privatekey",
"SSL_get_rbio",
+ "SSL_get_servername",
+ "SSL_get_servername_type",
"SSL_get_session",
"SSL_get_shutdown",
"SSL_get_state",
+ "SSL_get_verify_depth",
"SSL_get_verify_result",
"SSL_get_version",
"SSL_get_wbio",
@@ -127,9 +151,12 @@ const ENTRYPOINTS: &[&str] = &[
"SSL_in_init",
"SSL_is_init_finished",
"SSL_is_server",
+ "SSL_load_client_CA_file",
"SSL_new",
"SSL_pending",
"SSL_read",
+ "SSL_read_early_data",
+ "SSL_select_next_proto",
"SSL_SESSION_free",
"SSL_SESSION_get_id",
"SSL_session_reused",
@@ -145,16 +172,21 @@ const ENTRYPOINTS: &[&str] = &[
"SSL_set_fd",
"SSL_set_options",
"SSL_set_post_handshake_auth",
+ "SSL_set_quiet_shutdown",
"SSL_set_session",
"SSL_set_session_id_context",
"SSL_set_shutdown",
"SSL_set_SSL_CTX",
+ "SSL_set_verify",
+ "SSL_set_verify_depth",
"SSL_shutdown",
"SSL_up_ref",
"SSL_use_certificate",
"SSL_use_PrivateKey",
+ "SSL_use_PrivateKey_file",
"SSL_want",
"SSL_write",
+ "SSL_write_early_data",
"TLS_client_method",
"TLS_method",
"TLS_server_method",
diff --git a/rustls-libssl/src/callbacks.rs b/rustls-libssl/src/callbacks.rs
new file mode 100644
index 0000000..05f0b62
--- /dev/null
+++ b/rustls-libssl/src/callbacks.rs
@@ -0,0 +1,181 @@
+use core::cell::RefCell;
+use core::ffi::{c_int, c_uchar, c_void};
+use core::{ptr, slice};
+
+use openssl_sys::{SSL_TLSEXT_ERR_NOACK, SSL_TLSEXT_ERR_OK};
+use rustls::AlertDescription;
+
+use crate::entry::{
+ SSL_CTX_alpn_select_cb_func, SSL_CTX_cert_cb_func, SSL_CTX_servername_callback_func, SSL,
+};
+use crate::error::Error;
+
+/// Smuggling SSL* pointers from the outer entrypoint into the
+/// callback call site.
+pub struct SslCallbackContext;
+
+impl SslCallbackContext {
+ /// Register the original SSL* pointer for use in later callbacks.
+ ///
+ /// The returned object de-registers itself when dropped.
+ pub fn new(ssl: *mut SSL) -> Self {
+ SSL_CALLBACK_CONTEXT.set(Some(ssl));
+ Self
+ }
+
+ /// Get the original SSL* pointer, or else `NULL`
+ ///
+ /// This has thread-local semantics: it uses the most recent
+ /// object of this type created on this thread.
+ pub fn ssl_ptr() -> *mut SSL {
+ SSL_CALLBACK_CONTEXT.with_borrow(|holder| {
+ holder
+ .as_ref()
+ .map(|inner| *inner)
+ .unwrap_or_else(ptr::null_mut)
+ })
+ }
+}
+
+impl Drop for SslCallbackContext {
+ fn drop(&mut self) {
+ SSL_CALLBACK_CONTEXT.set(None);
+ }
+}
+
+thread_local! {
+ static SSL_CALLBACK_CONTEXT: RefCell