Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose SslMethod::{dtls_client,dtls_server} #2358

Merged
merged 2 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions openssl-sys/src/handwritten/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,10 @@ cfg_if! {
pub fn TLS_server_method() -> *const SSL_METHOD;

pub fn TLS_client_method() -> *const SSL_METHOD;

pub fn DTLS_server_method() -> *const SSL_METHOD;

pub fn DTLS_client_method() -> *const SSL_METHOD;
}
} else {
extern "C" {
Expand Down
16 changes: 15 additions & 1 deletion openssl/src/ssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,20 @@ impl SslMethod {
unsafe { SslMethod(TLS_server_method()) }
}

/// Support all versions of the DTLS protocol, explicitly as a client.
#[corresponds(DTLS_client_method)]
#[cfg(any(boringssl, ossl110, libressl291))]
pub fn dtls_client() -> SslMethod {
unsafe { SslMethod(DTLS_client_method()) }
}

/// Support all versions of the DTLS protocol, explicitly as a server.
#[corresponds(DTLS_server_method)]
#[cfg(any(boringssl, ossl110, libressl291))]
pub fn dtls_server() -> SslMethod {
unsafe { SslMethod(DTLS_server_method()) }
}

/// Constructs an `SslMethod` from a pointer to the underlying OpenSSL value.
///
/// # Safety
Expand Down Expand Up @@ -4288,7 +4302,7 @@ cfg_if! {
}
cfg_if! {
if #[cfg(any(boringssl, ossl110, libressl291))] {
use ffi::{TLS_method, DTLS_method, TLS_client_method, TLS_server_method};
use ffi::{TLS_method, DTLS_method, TLS_client_method, TLS_server_method, DTLS_server_method, DTLS_client_method};
} else {
use ffi::{
SSLv23_method as TLS_method, DTLSv1_method as DTLS_method, SSLv23_client_method as TLS_client_method,
Expand Down