From 26ee6b68411487381786a0c80fa9e2c7d0c9fd6c Mon Sep 17 00:00:00 2001 From: Christoph Settgast Date: Thu, 8 Feb 2024 18:37:18 +0100 Subject: [PATCH] Use rustls for Swift to support TLS 1.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently Element X iOS does not support TLS 1.3, this PR shall fix that. Explanation: There is an official recommendation from Apple, that boils down to the following if you use cross-platform code with sockets (as we do with the rust sdk): > To use TLS in that case [BSD Sockets], add your own TLS implementation. > Don’t use Secure Transport for your TLS implementation. It’s been deprecated since 2019 > and doesn’t support TLS 1.3. If you have existing code that uses Secure Transport, make > a plan to migrate off it. Modern TLS implementations including TLS 1.3 on macOS are only available as a builtin via the Apple-specific URLSession / Network framework APIs, so APIs where you feed in an URL and get the response back. They are not available in combination with a generic sockets-based cross-platform code. With that in mind, there is currently no hope that rust-native-tls would support TLS 1.3 in the forseeable future as there is simply no native TLS implementation in current macOS/iOS that could be used by rust-native-tls. See https://developer.apple.com/documentation/technotes/tn3151-choosing-the-right-networking-api#TLS-best-practices Fixes: element-hq/element-x-ios#786 --- bindings/matrix-sdk-ffi/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/matrix-sdk-ffi/Cargo.toml b/bindings/matrix-sdk-ffi/Cargo.toml index 4ca3307e2e4..8c8b3930480 100644 --- a/bindings/matrix-sdk-ffi/Cargo.toml +++ b/bindings/matrix-sdk-ffi/Cargo.toml @@ -57,7 +57,7 @@ language-tags = "0.3.2" log-panics = { version = "2", features = ["with-backtrace"] } paranoid-android = "0.2.1" -[target.'cfg(target_os = "android")'.dependencies.matrix-sdk] +[target.'cfg(any(target_os = "android", target_os = "ios", target_os = "macos"))'.dependencies.matrix-sdk] workspace = true features = [ "anyhow", @@ -72,7 +72,7 @@ features = [ "uniffi", ] -[target.'cfg(not(target_os = "android"))'.dependencies.matrix-sdk] +[target.'cfg(not(any(target_os = "android", target_os = "ios", target_os = "macos"))'.dependencies.matrix-sdk] workspace = true features = [ "anyhow",