Skip to content

Commit

Permalink
Use rustls for Swift to support TLS 1.3
Browse files Browse the repository at this point in the history
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
  • Loading branch information
csett86 committed Feb 8, 2024
1 parent 9bf48ef commit 26ee6b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bindings/matrix-sdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 26ee6b6

Please sign in to comment.