Skip to content

Commit 9490734

Browse files
committed
TLS 1.3 version support
1 parent 8986c3c commit 9490734

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

build.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ fn main() {
88
if version >= 0x1_01_00_00_0 {
99
println!("cargo:rustc-cfg=have_min_max_version");
1010
}
11+
12+
// TLS 1.3 requires openssl 1.1.1
13+
if version >= 0x1_01_01_00_0 {
14+
println!("cargo:rustc-cfg=have_tls13_version");
15+
}
1116
}
1217

1318
if let Ok(version) = env::var("DEP_OPENSSL_LIBRESSL_VERSION_NUMBER") {
@@ -16,5 +21,10 @@ fn main() {
1621
if version >= 0x2_06_01_00_0 {
1722
println!("cargo:rustc-cfg=have_min_max_version");
1823
}
24+
25+
// TLS 1.3 requires libressl 3.2
26+
if version >= 0x3_02_01_00_0 {
27+
println!("cargo:rustc-cfg=have_tls13_version");
28+
}
1929
}
2030
}

src/imp/openssl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ fn supported_protocols(
3232
Protocol::Tlsv10 => SslVersion::TLS1,
3333
Protocol::Tlsv11 => SslVersion::TLS1_1,
3434
Protocol::Tlsv12 => SslVersion::TLS1_2,
35+
#[cfg(have_tls13_version)]
3536
Protocol::Tlsv13 => SslVersion::TLS1_3,
3637
}
3738
}

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ pub enum Protocol {
323323
/// The TLS 1.2 protocol.
324324
Tlsv12,
325325
/// The TLS 1.3 protocol.
326+
#[cfg(any(target_os = "macos", target_os = "windows", target_os = "ios", have_tls13_version))]
326327
Tlsv13,
327328
}
328329

0 commit comments

Comments
 (0)