Skip to content

Commit

Permalink
TLS 1.3 version support
Browse files Browse the repository at this point in the history
  • Loading branch information
amousset committed Aug 16, 2023
1 parent 8986c3c commit 9490734
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ fn main() {
if version >= 0x1_01_00_00_0 {
println!("cargo:rustc-cfg=have_min_max_version");
}

// TLS 1.3 requires openssl 1.1.1
if version >= 0x1_01_01_00_0 {
println!("cargo:rustc-cfg=have_tls13_version");
}
}

if let Ok(version) = env::var("DEP_OPENSSL_LIBRESSL_VERSION_NUMBER") {
Expand All @@ -16,5 +21,10 @@ fn main() {
if version >= 0x2_06_01_00_0 {
println!("cargo:rustc-cfg=have_min_max_version");
}

// TLS 1.3 requires libressl 3.2
if version >= 0x3_02_01_00_0 {
println!("cargo:rustc-cfg=have_tls13_version");
}
}
}
1 change: 1 addition & 0 deletions src/imp/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fn supported_protocols(
Protocol::Tlsv10 => SslVersion::TLS1,
Protocol::Tlsv11 => SslVersion::TLS1_1,
Protocol::Tlsv12 => SslVersion::TLS1_2,
#[cfg(have_tls13_version)]
Protocol::Tlsv13 => SslVersion::TLS1_3,
}
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ pub enum Protocol {
/// The TLS 1.2 protocol.
Tlsv12,
/// The TLS 1.3 protocol.
#[cfg(any(target_os = "macos", target_os = "windows", target_os = "ios", have_tls13_version))]
Tlsv13,
}

Expand Down

0 comments on commit 9490734

Please sign in to comment.