From 3af29817172dce38419b4e21c5f212d66fb6bee8 Mon Sep 17 00:00:00 2001 From: Doug Bodden Date: Tue, 28 Feb 2023 13:33:49 -0500 Subject: [PATCH 1/3] Add DTLS 1.2 support in newer releases of SSL libs. --- openssl-sys/src/handwritten/ssl.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openssl-sys/src/handwritten/ssl.rs b/openssl-sys/src/handwritten/ssl.rs index f179a04ab1..1000276ab9 100644 --- a/openssl-sys/src/handwritten/ssl.rs +++ b/openssl-sys/src/handwritten/ssl.rs @@ -679,6 +679,10 @@ cfg_if! { pub fn TLS_server_method() -> *const SSL_METHOD; pub fn TLS_client_method() -> *const SSL_METHOD; + + // DTLS 1.2 support doesn't exist in LibresSSL 2.9.1 + #[cfg(ossl110)] + pub fn DTLSv1_2_method() -> *const SSL_METHOD; } } else { extern "C" { @@ -699,7 +703,8 @@ cfg_if! { pub fn DTLSv1_method() -> *const SSL_METHOD; - #[cfg(ossl102)] + // DTLS 1.2 support started in OpenSSL 1.0.2, LibreSSL 3.3.2 + #[cfg(any(ossl102,libressl332))] pub fn DTLSv1_2_method() -> *const SSL_METHOD; } } From ee3eaa325ba04fffcc1b795213b366ee3ee1378b Mon Sep 17 00:00:00 2001 From: Doug Bodden Date: Tue, 14 Mar 2023 14:00:12 +0000 Subject: [PATCH 2/3] Move code per PR feedback. --- openssl-sys/src/handwritten/ssl.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openssl-sys/src/handwritten/ssl.rs b/openssl-sys/src/handwritten/ssl.rs index 1000276ab9..29562d41ef 100644 --- a/openssl-sys/src/handwritten/ssl.rs +++ b/openssl-sys/src/handwritten/ssl.rs @@ -680,9 +680,6 @@ cfg_if! { pub fn TLS_client_method() -> *const SSL_METHOD; - // DTLS 1.2 support doesn't exist in LibresSSL 2.9.1 - #[cfg(ossl110)] - pub fn DTLSv1_2_method() -> *const SSL_METHOD; } } else { extern "C" { @@ -710,6 +707,13 @@ cfg_if! { } } +extern "C" { + #[cfg(ossl110)] + pub fn DTLSv1_2_method() -> *const SSL_METHOD; +} + + + extern "C" { pub fn SSL_get_error(ssl: *const SSL, ret: c_int) -> c_int; pub fn SSL_get_version(ssl: *const SSL) -> *const c_char; From 40eed05da58adcc42874a09c07b3abc633a74ed3 Mon Sep 17 00:00:00 2001 From: Doug Bodden Date: Tue, 14 Mar 2023 14:08:30 +0000 Subject: [PATCH 3/3] Fix formatting. --- openssl-sys/src/handwritten/ssl.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/openssl-sys/src/handwritten/ssl.rs b/openssl-sys/src/handwritten/ssl.rs index 29562d41ef..65a4f42f6b 100644 --- a/openssl-sys/src/handwritten/ssl.rs +++ b/openssl-sys/src/handwritten/ssl.rs @@ -712,8 +712,6 @@ extern "C" { pub fn DTLSv1_2_method() -> *const SSL_METHOD; } - - extern "C" { pub fn SSL_get_error(ssl: *const SSL, ret: c_int) -> c_int; pub fn SSL_get_version(ssl: *const SSL) -> *const c_char;