Skip to content

Commit

Permalink
Use the hole changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bragelbytes committed Apr 20, 2022
1 parent aea7308 commit edbcf45
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Sources/ShadowSwift/DarkStarServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,29 +197,37 @@ public class DarkStarServer
{
print("DarkStarServer received an invalid client confirmation code.")

// FIXME: Use the hole :)
let transport = TransmissionToTransportConnection({return connection})
let _ = BlackHole(timeoutDelaySeconds: 30, socket: transport)

return nil
}

// Send server ephemeral key
guard let (serverEphemeralPrivateKey, _) = DarkStar.handleServerEphemeralKey(connection: connection) else
{
// FIXME: Use the hole :)
let transport = TransmissionToTransportConnection({return connection})
let _ = BlackHole(timeoutDelaySeconds: 30, socket: transport)

return nil
}

// Create shared key
guard let serverToClientSharedKey = DarkStarServer.createServerToClientSharedKey(serverPersistentPrivateKey: serverPersistentPrivateKey, serverEphemeralPrivateKey: serverEphemeralPrivateKey, clientEphemeralPublicKey: clientEphemeralPublicKey, serverEndpoint: endpoint) else
{
// FIXME: Use the hole :)
let transport = TransmissionToTransportConnection({return connection})
let _ = BlackHole(timeoutDelaySeconds: 30, socket: transport)

return nil
}

self.serverToClientSharedKey = serverToClientSharedKey

guard let clientToServerSharedKey = DarkStarServer.createClientToServerSharedKey(serverPersistentPrivateKey: serverPersistentPrivateKey, serverEphemeralPrivateKey: serverEphemeralPrivateKey, clientEphemeralPublicKey: clientEphemeralPublicKey, serverEndpoint: endpoint) else
{
// FIXME: Use the hole :)
let transport = TransmissionToTransportConnection({return connection})
let _ = BlackHole(timeoutDelaySeconds: 30, socket: transport)

return nil
}

Expand All @@ -228,7 +236,9 @@ public class DarkStarServer
// Send server confirmation code
guard DarkStarServer.handleServerConfirmationCode(connection: connection, endpoint: endpoint, serverStaticPrivateKey: serverPersistentPrivateKey, serverEphemeralPrivateKey: serverEphemeralPrivateKey, clientEphemeralPublicKey: clientEphemeralPublicKey) else
{
// FIXME: Use the hole :)
let transport = TransmissionToTransportConnection({return connection})
let _ = BlackHole(timeoutDelaySeconds: 30, socket: transport)

return nil
}
}
Expand Down
3 changes: 3 additions & 0 deletions Tests/ShadowSwiftTests/ShadowSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -764,5 +764,8 @@ class ShadowSwiftTests: XCTestCase
return
}
}

/// possible test?
// func testBlackHole()
}

0 comments on commit edbcf45

Please sign in to comment.