diff options
| author | Bug Magnet <marco.nikic@mullvad.net> | 2024-08-20 16:51:20 +0200 |
|---|---|---|
| committer | Emīls <emils@mullvad.net> | 2024-09-06 12:37:37 +0200 |
| commit | 678f65343910f55c2d15e6012fefe8c21a2e8ff2 (patch) | |
| tree | cf3cb0d89fc27de52b2a817e5621805441d4ebd3 /ios/MullvadRustRuntime/include | |
| parent | 50c9d86f2f802af421d8ca9a2a9278c3d1237940 (diff) | |
| download | mullvadvpn-678f65343910f55c2d15e6012fefe8c21a2e8ff2.tar.xz mullvadvpn-678f65343910f55c2d15e6012fefe8c21a2e8ff2.zip | |
Enable Daita in the PacketTunnel actor
Diffstat (limited to 'ios/MullvadRustRuntime/include')
| -rw-r--r-- | ios/MullvadRustRuntime/include/mullvad_rust_runtime.h | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/ios/MullvadRustRuntime/include/mullvad_rust_runtime.h b/ios/MullvadRustRuntime/include/mullvad_rust_runtime.h index 9b5c8bd4c1..c42d2ae840 100644 --- a/ios/MullvadRustRuntime/include/mullvad_rust_runtime.h +++ b/ios/MullvadRustRuntime/include/mullvad_rust_runtime.h @@ -5,9 +5,9 @@ #include <stdint.h> #include <stdlib.h> -typedef struct PostQuantumCancelToken { +typedef struct EphemeralPeerCancelToken { void *context; -} PostQuantumCancelToken; +} EphemeralPeerCancelToken; typedef struct ProxyHandle { void *context; @@ -17,28 +17,28 @@ typedef struct ProxyHandle { extern const uint16_t CONFIG_SERVICE_PORT; /** - * Called by the Swift side to signal that the quantum-secure key exchange should be cancelled. + * Called by the Swift side to signal that the ephemeral peer exchange should be cancelled. * After this call, the cancel token is no longer valid. * * # Safety - * `sender` must be pointing to a valid instance of a `PostQuantumCancelToken` created by the + * `sender` must be pointing to a valid instance of a `EphemeralPeerCancelToken` created by the * `PacketTunnelProvider`. */ -void cancel_post_quantum_key_exchange(const struct PostQuantumCancelToken *sender); +void cancel_ephemeral_peer_exchange(const struct EphemeralPeerCancelToken *sender); /** - * Called by the Swift side to signal that the Rust `PostQuantumCancelToken` can be safely dropped + * Called by the Swift side to signal that the Rust `EphemeralPeerCancelToken` can be safely dropped * from memory. * * # Safety - * `sender` must be pointing to a valid instance of a `PostQuantumCancelToken` created by the + * `sender` must be pointing to a valid instance of a `EphemeralPeerCancelToken` created by the * `PacketTunnelProvider`. */ -void drop_post_quantum_key_exchange_token(const struct PostQuantumCancelToken *sender); +void drop_ephemeral_peer_exchange_token(const struct EphemeralPeerCancelToken *sender); /** * Called by Swift whenever data has been written to the in-tunnel TCP connection when exchanging - * quantum-resistant pre shared keys. + * quantum-resistant pre shared keys, or ephemeral peers. * * If `bytes_sent` is 0, this indicates that the connection was closed or that an error occurred. * @@ -50,7 +50,7 @@ void handle_sent(uintptr_t bytes_sent, const void *sender); /** * Called by Swift whenever data has been read from the in-tunnel TCP connection when exchanging - * quantum-resistant pre shared keys. + * quantum-resistant pre shared keys, or ephemeral peers. * * If `data` is null or empty, this indicates that the connection was closed or that an error * occurred. An empty buffer is sent to the underlying reader to signal EOF. @@ -63,7 +63,7 @@ void handle_sent(uintptr_t bytes_sent, const void *sender); void handle_recv(const uint8_t *data, uintptr_t data_len, const void *sender); /** - * Entry point for exchanging post quantum keys on iOS. + * Entry point for requesting ephemeral peers on iOS. * The TCP connection must be created to go through the tunnel. * # Safety * `public_key` and `ephemeral_key` must be valid respective `PublicKey` and `PrivateKey` types. @@ -72,12 +72,14 @@ void handle_recv(const uint8_t *data, uintptr_t data_len, const void *sender); * connection instances. * `cancel_token` should be owned by the caller of this function. */ -int32_t negotiate_post_quantum_key(const uint8_t *public_key, - const uint8_t *ephemeral_key, - const void *packet_tunnel, - const void *tcp_connection, - struct PostQuantumCancelToken *cancel_token, - uint64_t post_quantum_key_exchange_timeout); +int32_t request_ephemeral_peer(const uint8_t *public_key, + const uint8_t *ephemeral_key, + const void *packet_tunnel, + const void *tcp_connection, + struct EphemeralPeerCancelToken *cancel_token, + uint64_t peer_exchange_timeout, + bool enable_post_quantum, + bool enable_daita); /** * Called when there is data to send on the TCP connection. @@ -95,12 +97,15 @@ extern void swift_nw_tcp_connection_send(const void *connection, extern void swift_nw_tcp_connection_read(const void *connection, const void *sender); /** - * Called when the preshared post quantum key is ready. - * `raw_preshared_key` might be NULL if the key negotiation failed. + * Called when the preshared post quantum key is ready, + * or when a Daita peer has been successfully requested. + * `raw_preshared_key` will be NULL if: + * - The post quantum key negotiation failed + * - A Daita peer has been requested without enabling post quantum keys. */ -extern void swift_post_quantum_key_ready(const void *raw_packet_tunnel, - const uint8_t *raw_preshared_key, - const uint8_t *raw_ephemeral_private_key); +extern void swift_ephemeral_peer_ready(const void *raw_packet_tunnel, + const uint8_t *raw_preshared_key, + const uint8_t *raw_ephemeral_private_key); /** * # Safety |
