diff options
| author | Andrew Bulhak <andrew.bulhak@mullvad.net> | 2024-03-22 16:09:26 +0100 |
|---|---|---|
| committer | Andrew Bulhak <andrew.bulhak@mullvad.net> | 2024-03-22 16:09:26 +0100 |
| commit | eeb0da91dbfaf1ebced33ea89294d50c888cf4c9 (patch) | |
| tree | d00828fd52d7798b06e20d70543a256dd674a98c | |
| parent | 86a94969ff160c5c27363790f78e489556ff126c (diff) | |
| download | mullvadvpn-eeb0da91dbfaf1ebced33ea89294d50c888cf4c9.tar.xz mullvadvpn-eeb0da91dbfaf1ebced33ea89294d50c888cf4c9.zip | |
Rename .negotiatingKey to .negotiatingPostQuantumKey (cherry-pick)call-post-quantum-key-negotiation-method-from-ios-553
7 files changed, 10 insertions, 21 deletions
diff --git a/ios/PacketTunnel/PacketTunnelProvider/PacketTunnelProvider.swift b/ios/PacketTunnel/PacketTunnelProvider/PacketTunnelProvider.swift index 3adaa600d1..2951fd80dc 100644 --- a/ios/PacketTunnel/PacketTunnelProvider/PacketTunnelProvider.swift +++ b/ios/PacketTunnel/PacketTunnelProvider/PacketTunnelProvider.swift @@ -108,7 +108,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider { if connectionState.connectionAttemptCount > 1 { return } - case .negotiatingKey: + case .negotiatingPostQuantumKey: try await startPostQuantumKeyExchange() return default: diff --git a/ios/PacketTunnelCore/Actor/ObservedState.swift b/ios/PacketTunnelCore/Actor/ObservedState.swift index f28c551a97..1643e765b9 100644 --- a/ios/PacketTunnelCore/Actor/ObservedState.swift +++ b/ios/PacketTunnelCore/Actor/ObservedState.swift @@ -70,8 +70,6 @@ extension State { return .initial case let .connecting(connState): return .connecting(connState.observedConnectionState) - case let .negotiatingKey(connState): - return .negotiatingKey(connState.observedConnectionState) case let .connected(connState): return .connected(connState.observedConnectionState) case let .reconnecting(connState): diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ConnectionMonitoring.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ConnectionMonitoring.swift index 4bbbf2642d..09e9f87921 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ConnectionMonitoring.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ConnectionMonitoring.swift @@ -42,7 +42,7 @@ extension PacketTunnelActor { connState.connectionAttemptCount = 0 // TODO: switch here on whether we need to do PQ negotiation let isPostQuantum = true - state = isPostQuantum ? .negotiatingKey(connState) : .connected(connState) + state = isPostQuantum ? .negotiatingPostQuantumKey(connState) : .connected(connState) case .initial, .connected, .disconnecting, .disconnected, .error, .negotiatingPostQuantumKey: break @@ -52,7 +52,7 @@ extension PacketTunnelActor { /// Tell the tunnel to reconnect providing the correct reason to ensure that the attempt counter is incremented before reconnect. private func onHandleConnectionRecovery() async { switch state { - case .connecting, .reconnecting, .connected, .negotiatingKey: + case .connecting, .reconnecting, .connected: commandChannel.send(.reconnect(.random, reason: .connectionLoss)) case .initial, .disconnected, .disconnecting, .error, .negotiatingPostQuantumKey: diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift index 0802275f82..7595e8922d 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor+ErrorState.swift @@ -70,9 +70,6 @@ extension PacketTunnelActor { case let .connected(connState): return mapConnectionState(connState, reason: reason, priorState: .connected) - case let .negotiatingKey(connState): - return mapConnectionState(connState, reason: reason, priorState: .negotiatingKey) - case let .connecting(connState): return mapConnectionState(connState, reason: reason, priorState: .connecting) diff --git a/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift b/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift index d71b24ad6e..27d0c437ab 100644 --- a/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift +++ b/ios/PacketTunnelCore/Actor/PacketTunnelActor.swift @@ -155,9 +155,9 @@ extension PacketTunnelActor { private func stop() async { switch state { case let .connected(connState), - let .connecting(connState), - let .reconnecting(connState), - let .negotiatingPostQuantumKey(connState): + let .connecting(connState), + let .reconnecting(connState), + let .negotiatingPostQuantumKey(connState): state = .disconnecting(connState) tunnelMonitor.stop() diff --git a/ios/PacketTunnelCore/Actor/State+Extensions.swift b/ios/PacketTunnelCore/Actor/State+Extensions.swift index c2c391436b..050bf54cb3 100644 --- a/ios/PacketTunnelCore/Actor/State+Extensions.swift +++ b/ios/PacketTunnelCore/Actor/State+Extensions.swift @@ -21,7 +21,7 @@ extension State { case .connecting, .negotiatingPostQuantumKey: return .connecting - case .connected, .reconnecting, .negotiatingKey: + case .connected, .reconnecting: return .reconnecting case let .error(blockedState): @@ -41,10 +41,9 @@ extension State { func logFormat() -> String { switch self { - case let .connecting(connState), - let .connected(connState), - let .reconnecting(connState), - let .negotiatingKey(connState): + case let .connecting(connState), + let .connected(connState), + let .reconnecting(connState): let hostname = connState.selectedRelay.hostname return """ @@ -80,8 +79,6 @@ extension State { "Initial" case .error: "Error" - case .negotiatingKey: - "Negotiating key" } } diff --git a/ios/PacketTunnelCore/Actor/State.swift b/ios/PacketTunnelCore/Actor/State.swift index 2e8fb38e50..5415b11ce2 100644 --- a/ios/PacketTunnelCore/Actor/State.swift +++ b/ios/PacketTunnelCore/Actor/State.swift @@ -65,9 +65,6 @@ enum State: Equatable { /// The actor should remain in this state until the very first connection is established, i.e determined by tunnel monitor. case connecting(ConnectionData) - /// The postquantum key is in the process of being negotiated; there is a physical connection, but traffic is not being allowed beyond the key negotiation servers - case negotiatingKey(ConnectionData) - /// Tunnel is connected. case connected(ConnectionData) |
