From 59e4ab51284b09a8a70661caee24fce67567d360 Mon Sep 17 00:00:00 2001 From: Joseph Birr-Pixton Date: Fri, 23 Feb 2024 15:19:22 +0000 Subject: [PATCH] Provide stubs for SSL_{CTX_,}_{get,set}_ex_data --- rustls-libssl/build.rs | 4 ++++ rustls-libssl/src/entry.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/rustls-libssl/build.rs b/rustls-libssl/build.rs index fdf5a6b..f467ea0 100644 --- a/rustls-libssl/build.rs +++ b/rustls-libssl/build.rs @@ -60,11 +60,13 @@ const ENTRYPOINTS: &[&str] = &[ "SSL_CTX_ctrl", "SSL_CTX_free", "SSL_CTX_get_cert_store", + "SSL_CTX_get_ex_data", "SSL_CTX_get_options", "SSL_CTX_load_verify_dir", "SSL_CTX_load_verify_file", "SSL_CTX_new", "SSL_CTX_set_alpn_protos", + "SSL_CTX_set_ex_data", "SSL_CTX_set_options", "SSL_CTX_set_verify", "SSL_CTX_up_ref", @@ -75,6 +77,7 @@ const ENTRYPOINTS: &[&str] = &[ "SSL_get1_peer_certificate", "SSL_get_current_cipher", "SSL_get_error", + "SSL_get_ex_data", "SSL_get_options", "SSL_get_peer_cert_chain", "SSL_get_shutdown", @@ -92,6 +95,7 @@ const ENTRYPOINTS: &[&str] = &[ "SSL_set_alpn_protos", "SSL_set_bio", "SSL_set_connect_state", + "SSL_set_ex_data", "SSL_set_fd", "SSL_set_options", "SSL_set_shutdown", diff --git a/rustls-libssl/src/entry.rs b/rustls-libssl/src/entry.rs index 492fe50..eb9121f 100644 --- a/rustls-libssl/src/entry.rs +++ b/rustls-libssl/src/entry.rs @@ -116,6 +116,20 @@ entry! { } } +entry! { + pub fn _SSL_CTX_set_ex_data(_ssl: *mut SSL_CTX, _idx: c_int, _data: *mut c_void) -> c_int { + // TODO: this always fails; it could be implemented faithfully + 0 + } +} + +entry! { + pub fn _SSL_CTX_get_ex_data(_ssl: *const SSL_CTX, _idx: c_int) -> *mut c_void { + // TODO: this always fails; it could be implemented faithfully + ptr::null_mut() + } +} + entry! { pub fn _SSL_CTX_get_options(ctx: *const SSL_CTX) -> u64 { let ctx = try_clone_arc!(ctx); @@ -352,6 +366,20 @@ entry! { } } +entry! { + pub fn _SSL_set_ex_data(_ssl: *mut SSL, _idx: c_int, _data: *mut c_void) -> c_int { + // TODO: this always fails; it could be implemented faithfully + 0 + } +} + +entry! { + pub fn _SSL_get_ex_data(_ssl: *const SSL, _idx: c_int) -> *mut c_void { + // TODO: this always fails; it could be implemented faithfully + ptr::null_mut() + } +} + entry! { pub fn _SSL_get_options(ssl: *const SSL) -> u64 { let ssl = try_clone_arc!(ssl);