Skip to content

Commit

Permalink
Implement PR feedback part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
buggmagnet committed May 10, 2024
1 parent ccbed23 commit 706162d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func tcpConnectionSend(
let tcpConnection = Unmanaged<NWTCPConnection>.fromOpaque(connection).takeUnretainedValue()
let rawData = Data(bytes: data, count: Int(dataLength))

// The guarantee that no more than 2 writes happen in parallel is done by virtue of not returning the execution context
// The guarantee that all writes are sequential is done by virtue of not returning the execution context
// to Rust before this closure is done executing.
tcpConnection.write(rawData, completionHandler: { maybeError in
if maybeError != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ void handle_recv(const uint8_t *data,
* Entry point for exchanging post quantum keys on iOS.
* The TCP connection must be created to go through the tunnel.
* # Safety
* This function is safe to call
* `public_key` and `ephemeral_key` must be valid respective `PublicKey` and `PrivateKey` types.
* They will not be valid after this function is called, and thus must be copied here.
* `packet_tunnel` and `tcp_connection` must be valid pointers to a packet tunnel and a TCP 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,
Expand Down
6 changes: 5 additions & 1 deletion talpid-tunnel-config-client/src/ios_ffi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ pub unsafe extern "C" fn handle_recv(data: *const u8, data_len: usize, sender: *
/// Entry point for exchanging post quantum keys on iOS.
/// The TCP connection must be created to go through the tunnel.
/// # Safety
/// This function is safe to call
/// `public_key` and `ephemeral_key` must be valid respective `PublicKey` and `PrivateKey` types.
/// They will not be valid after this function is called, and thus must be copied here.
/// `packet_tunnel` and `tcp_connection` must be valid pointers to a packet tunnel and a TCP connection
/// instances.
/// `cancel_token` should be owned by the caller of this function.
#[no_mangle]
pub unsafe extern "C" fn negotiate_post_quantum_key(
public_key: *const u8,
Expand Down

0 comments on commit 706162d

Please sign in to comment.