From 4d03df7066ae980d0421c9e97cb287e3988ff31e Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 23 Aug 2018 12:07:55 +0200 Subject: [PATCH] Finish up renaming in headers and prefixes --- TunnelKit.xcodeproj/project.pbxproj | 36 +++++------ .../AppExtension/ConnectionStrategy.swift | 12 ++-- .../Sources/AppExtension/DNSResolver.swift | 2 +- .../Sources/AppExtension/GenericSocket.swift | 2 +- .../AppExtension/InterfaceObserver.swift | 2 +- TunnelKit/Sources/AppExtension/Keychain.swift | 2 +- .../AppExtension/MemoryDestination.swift | 2 +- .../Transport/LinkInterface+Strategy.swift | 2 +- .../Transport/NETCPInterface.swift | 2 +- .../Transport/NETunnelInterface.swift | 2 +- .../Transport/NEUDPInterface.swift | 2 +- .../NWTCPConnectionState+Description.swift | 2 +- .../NWUDPSessionState+Description.swift | 2 +- ... => TunnelKitProvider+Configuration.swift} | 62 +++++++++---------- ...ft => TunnelKitProvider+Interaction.swift} | 12 ++-- ...Provider.swift => TunnelKitProvider.swift} | 14 ++--- TunnelKit/Sources/AppExtension/Utils.swift | 2 +- TunnelKit/Sources/Core/Allocation.h | 2 +- TunnelKit/Sources/Core/Allocation.m | 2 +- TunnelKit/Sources/Core/Authenticator.swift | 2 +- .../Sources/Core/CommunicationType.swift | 2 +- .../Sources/Core/CoreConfiguration.swift | 2 +- TunnelKit/Sources/Core/CryptoAEAD.h | 2 +- TunnelKit/Sources/Core/CryptoAEAD.m | 28 ++++----- TunnelKit/Sources/Core/CryptoBox.h | 2 +- TunnelKit/Sources/Core/CryptoBox.m | 16 ++--- TunnelKit/Sources/Core/CryptoCBC.h | 2 +- TunnelKit/Sources/Core/CryptoCBC.m | 38 ++++++------ TunnelKit/Sources/Core/CryptoMacros.h | 10 +-- .../Sources/Core/Data+Manipulation.swift | 2 +- TunnelKit/Sources/Core/DataPath.h | 2 +- TunnelKit/Sources/Core/DataPath.m | 6 +- TunnelKit/Sources/Core/DataPathEncryption.h | 2 +- TunnelKit/Sources/Core/Encryption.h | 2 +- TunnelKit/Sources/Core/EncryptionProxy.swift | 2 +- TunnelKit/Sources/Core/Errors.h | 28 ++++----- TunnelKit/Sources/Core/Errors.m | 4 +- TunnelKit/Sources/Core/IOInterface.swift | 2 +- TunnelKit/Sources/Core/LinkInterface.swift | 2 +- TunnelKit/Sources/Core/MSS.h | 2 +- TunnelKit/Sources/Core/MSS.m | 2 +- TunnelKit/Sources/Core/Packet.swift | 2 +- TunnelKit/Sources/Core/PacketMacros.h | 2 +- TunnelKit/Sources/Core/PacketMacros.m | 2 +- TunnelKit/Sources/Core/ProtocolMacros.swift | 2 +- TunnelKit/Sources/Core/PushReply.swift | 2 +- TunnelKit/Sources/Core/ReplayProtector.h | 2 +- TunnelKit/Sources/Core/ReplayProtector.m | 2 +- TunnelKit/Sources/Core/SecureRandom.swift | 2 +- TunnelKit/Sources/Core/SessionKey.swift | 2 +- TunnelKit/Sources/Core/SessionProxy.swift | 4 +- TunnelKit/Sources/Core/TLSBox.h | 2 +- TunnelKit/Sources/Core/TLSBox.m | 14 ++--- TunnelKit/Sources/Core/TunnelInterface.swift | 2 +- TunnelKit/Sources/Core/TunnelSettings.swift | 2 +- TunnelKit/Sources/Core/ZeroingData.h | 2 +- TunnelKit/Sources/Core/ZeroingData.m | 2 +- TunnelKit/Sources/Core/ZeroingData.swift | 2 +- TunnelKitHost/AppDelegate.swift | 2 +- TunnelKitHost/ViewController.swift | 2 +- TunnelKitTests/AppExtensionTests.swift | 12 ++-- TunnelKitTests/DataManipulationTests.swift | 2 +- TunnelKitTests/DataPathEncryptionTests.swift | 2 +- TunnelKitTests/DataPathPerformanceTests.swift | 2 +- .../EncryptionPerformanceTests.swift | 2 +- TunnelKitTests/EncryptionTests.swift | 2 +- TunnelKitTests/LinkTests.swift | 2 +- TunnelKitTests/RandomTests.swift | 2 +- TunnelKitTests/RawPerformanceTests.swift | 2 +- TunnelKitTests/TestUtils.swift | 2 +- 70 files changed, 203 insertions(+), 203 deletions(-) rename TunnelKit/Sources/AppExtension/{PIATunnelProvider+Configuration.swift => TunnelKitProvider+Configuration.swift} (91%) rename TunnelKit/Sources/AppExtension/{PIATunnelProvider+Interaction.swift => TunnelKitProvider+Interaction.swift} (88%) rename TunnelKit/Sources/AppExtension/{PIATunnelProvider.swift => TunnelKitProvider.swift} (98%) diff --git a/TunnelKit.xcodeproj/project.pbxproj b/TunnelKit.xcodeproj/project.pbxproj index bdd7fe5..4288874 100644 --- a/TunnelKit.xcodeproj/project.pbxproj +++ b/TunnelKit.xcodeproj/project.pbxproj @@ -111,15 +111,15 @@ 0EFEB4742006D3C800F81029 /* CoreConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44A2006D3C800F81029 /* CoreConfiguration.swift */; }; 0EFEB4752006D3C800F81029 /* Errors.m in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44B2006D3C800F81029 /* Errors.m */; }; 0EFEB4762006D3C800F81029 /* DataPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44C2006D3C800F81029 /* DataPath.m */; }; - 0EFEB4782006D3C800F81029 /* PIATunnelProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44F2006D3C800F81029 /* PIATunnelProvider+Configuration.swift */; }; - 0EFEB4792006D3C800F81029 /* PIATunnelProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4502006D3C800F81029 /* PIATunnelProvider+Interaction.swift */; }; - 0EFEB47B2006D3C800F81029 /* PIATunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4522006D3C800F81029 /* PIATunnelProvider.swift */; }; + 0EFEB4782006D3C800F81029 /* TunnelKitProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44F2006D3C800F81029 /* TunnelKitProvider+Configuration.swift */; }; + 0EFEB4792006D3C800F81029 /* TunnelKitProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4502006D3C800F81029 /* TunnelKitProvider+Interaction.swift */; }; + 0EFEB47B2006D3C800F81029 /* TunnelKitProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4522006D3C800F81029 /* TunnelKitProvider.swift */; }; 0EFEB4832006D3D000F81029 /* PIA-RSA-3072.pem in Resources */ = {isa = PBXBuildFile; fileRef = 0EFEB4802006D3D000F81029 /* PIA-RSA-3072.pem */; }; 0EFEB4842006D3D000F81029 /* PIA-RSA-4096.pem in Resources */ = {isa = PBXBuildFile; fileRef = 0EFEB4812006D3D000F81029 /* PIA-RSA-4096.pem */; }; 0EFEB4852006D3D000F81029 /* PIA-RSA-2048.pem in Resources */ = {isa = PBXBuildFile; fileRef = 0EFEB4822006D3D000F81029 /* PIA-RSA-2048.pem */; }; - 0EFEB4872006D7C400F81029 /* PIATunnelProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44F2006D3C800F81029 /* PIATunnelProvider+Configuration.swift */; }; - 0EFEB4882006D7C400F81029 /* PIATunnelProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4502006D3C800F81029 /* PIATunnelProvider+Interaction.swift */; }; - 0EFEB48A2006D7C400F81029 /* PIATunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4522006D3C800F81029 /* PIATunnelProvider.swift */; }; + 0EFEB4872006D7C400F81029 /* TunnelKitProvider+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB44F2006D3C800F81029 /* TunnelKitProvider+Configuration.swift */; }; + 0EFEB4882006D7C400F81029 /* TunnelKitProvider+Interaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4502006D3C800F81029 /* TunnelKitProvider+Interaction.swift */; }; + 0EFEB48A2006D7C400F81029 /* TunnelKitProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB4522006D3C800F81029 /* TunnelKitProvider.swift */; }; 0EFEB48D2006D7F300F81029 /* EncryptionProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB42A2006D3C800F81029 /* EncryptionProxy.swift */; }; 0EFEB48E2006D7F300F81029 /* SessionKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB42B2006D3C800F81029 /* SessionKey.swift */; }; 0EFEB4902006D7F300F81029 /* TunnelInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEB42F2006D3C800F81029 /* TunnelInterface.swift */; }; @@ -257,9 +257,9 @@ 0EFEB44A2006D3C800F81029 /* CoreConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreConfiguration.swift; sourceTree = ""; }; 0EFEB44B2006D3C800F81029 /* Errors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Errors.m; sourceTree = ""; }; 0EFEB44C2006D3C800F81029 /* DataPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DataPath.m; sourceTree = ""; }; - 0EFEB44F2006D3C800F81029 /* PIATunnelProvider+Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PIATunnelProvider+Configuration.swift"; sourceTree = ""; }; - 0EFEB4502006D3C800F81029 /* PIATunnelProvider+Interaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PIATunnelProvider+Interaction.swift"; sourceTree = ""; }; - 0EFEB4522006D3C800F81029 /* PIATunnelProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PIATunnelProvider.swift; sourceTree = ""; }; + 0EFEB44F2006D3C800F81029 /* TunnelKitProvider+Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TunnelKitProvider+Configuration.swift"; sourceTree = ""; }; + 0EFEB4502006D3C800F81029 /* TunnelKitProvider+Interaction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TunnelKitProvider+Interaction.swift"; sourceTree = ""; }; + 0EFEB4522006D3C800F81029 /* TunnelKitProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TunnelKitProvider.swift; sourceTree = ""; }; 0EFEB4802006D3D000F81029 /* PIA-RSA-3072.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "PIA-RSA-3072.pem"; sourceTree = ""; }; 0EFEB4812006D3D000F81029 /* PIA-RSA-4096.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "PIA-RSA-4096.pem"; sourceTree = ""; }; 0EFEB4822006D3D000F81029 /* PIA-RSA-2048.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "PIA-RSA-2048.pem"; sourceTree = ""; }; @@ -477,9 +477,9 @@ 0EFEB4AA200760EC00F81029 /* InterfaceObserver.swift */, 0EFEB4AD2007625E00F81029 /* Keychain.swift */, 0EFEB4A9200760EB00F81029 /* MemoryDestination.swift */, - 0EFEB4522006D3C800F81029 /* PIATunnelProvider.swift */, - 0EFEB44F2006D3C800F81029 /* PIATunnelProvider+Configuration.swift */, - 0EFEB4502006D3C800F81029 /* PIATunnelProvider+Interaction.swift */, + 0EFEB4522006D3C800F81029 /* TunnelKitProvider.swift */, + 0EFEB44F2006D3C800F81029 /* TunnelKitProvider+Configuration.swift */, + 0EFEB4502006D3C800F81029 /* TunnelKitProvider+Interaction.swift */, 0EEC49DB20B5E732008FEB91 /* Utils.swift */, ); path = AppExtension; @@ -900,7 +900,7 @@ 0EFEB4632006D3C800F81029 /* ProtocolMacros.swift in Sources */, 0EFEB4AC200760EC00F81029 /* InterfaceObserver.swift in Sources */, 0EFEB46D2006D3C800F81029 /* Data+Manipulation.swift in Sources */, - 0EFEB47B2006D3C800F81029 /* PIATunnelProvider.swift in Sources */, + 0EFEB47B2006D3C800F81029 /* TunnelKitProvider.swift in Sources */, 0EFEB4742006D3C800F81029 /* CoreConfiguration.swift in Sources */, 0E07595F20EF6D1400F38FD8 /* CryptoCBC.m in Sources */, 0EC1BBA820D7D803007C4C7B /* ConnectionStrategy.swift in Sources */, @@ -910,12 +910,12 @@ 0EBBF2F3208505D300E36B40 /* NEUDPInterface.swift in Sources */, 0EFEB4682006D3C800F81029 /* MSS.m in Sources */, 0EFEB45B2006D3C800F81029 /* TLSBox.m in Sources */, - 0EFEB4792006D3C800F81029 /* PIATunnelProvider+Interaction.swift in Sources */, + 0EFEB4792006D3C800F81029 /* TunnelKitProvider+Interaction.swift in Sources */, 0EFEB4702006D3C800F81029 /* Allocation.m in Sources */, 0EFEB4672006D3C800F81029 /* SessionProxy.swift in Sources */, 0EFEB4722006D3C800F81029 /* ReplayProtector.m in Sources */, 0EFEB4712006D3C800F81029 /* TunnelSettings.swift in Sources */, - 0EFEB4782006D3C800F81029 /* PIATunnelProvider+Configuration.swift in Sources */, + 0EFEB4782006D3C800F81029 /* TunnelKitProvider+Configuration.swift in Sources */, 0E3E0F212108A8CC00B371C1 /* PushReply.swift in Sources */, 0EFEB4752006D3C800F81029 /* Errors.m in Sources */, 0EBBF2E52084FE6F00E36B40 /* GenericSocket.swift in Sources */, @@ -932,9 +932,9 @@ 0EBBF2F6208505D700E36B40 /* NETunnelInterface.swift in Sources */, 0EAAD70A20E4F2BC0088754A /* CommunicationType.swift in Sources */, 0EFEB4A12006D7F300F81029 /* LinkInterface.swift in Sources */, - 0EFEB4872006D7C400F81029 /* PIATunnelProvider+Configuration.swift in Sources */, + 0EFEB4872006D7C400F81029 /* TunnelKitProvider+Configuration.swift in Sources */, 0EBBF2F7208505DD00E36B40 /* NWUDPSessionState+Description.swift in Sources */, - 0EFEB4882006D7C400F81029 /* PIATunnelProvider+Interaction.swift in Sources */, + 0EFEB4882006D7C400F81029 /* TunnelKitProvider+Interaction.swift in Sources */, 0EE7A79920F6296F00B42E6A /* PacketMacros.m in Sources */, 0EEC49DD20B5E732008FEB91 /* Utils.swift in Sources */, 0EAAD70D20E4F85A0088754A /* LinkInterface+Strategy.swift in Sources */, @@ -945,7 +945,7 @@ 0EBBF3012085196000E36B40 /* NWTCPConnectionState+Description.swift in Sources */, 0EFEB4962006D7F300F81029 /* ProtocolMacros.swift in Sources */, 0EE7A79620F61EDC00B42E6A /* PacketMacros.h in Sources */, - 0EFEB48A2006D7C400F81029 /* PIATunnelProvider.swift in Sources */, + 0EFEB48A2006D7C400F81029 /* TunnelKitProvider.swift in Sources */, 0EBBF2FB2085061600E36B40 /* NETCPInterface.swift in Sources */, 0EFEB4982006D7F300F81029 /* ZeroingData.swift in Sources */, 0EFEB4A32006D7F300F81029 /* Errors.m in Sources */, diff --git a/TunnelKit/Sources/AppExtension/ConnectionStrategy.swift b/TunnelKit/Sources/AppExtension/ConnectionStrategy.swift index 1576589..5077d5b 100644 --- a/TunnelKit/Sources/AppExtension/ConnectionStrategy.swift +++ b/TunnelKit/Sources/AppExtension/ConnectionStrategy.swift @@ -1,6 +1,6 @@ // // ConnectionStrategy.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 6/18/18. // Copyright © 2018 London Trust Media. All rights reserved. @@ -19,11 +19,11 @@ class ConnectionStrategy { private var resolvedAddresses: [String]? - private let endpointProtocols: [PIATunnelProvider.EndpointProtocol] + private let endpointProtocols: [TunnelKitProvider.EndpointProtocol] private var currentProtocolIndex = 0 - init(hostname: String, configuration: PIATunnelProvider.Configuration) { + init(hostname: String, configuration: TunnelKitProvider.Configuration) { precondition(!configuration.prefersResolvedAddresses || !(configuration.resolvedAddresses?.isEmpty ?? true)) self.hostname = hostname @@ -70,7 +70,7 @@ class ConnectionStrategy { guard let targetAddress = self.resolvedAddress(from: addresses) else { log.error("No resolved or fallback address available") - completionHandler(nil, PIATunnelProvider.ProviderError.dnsFailure) + completionHandler(nil, TunnelKitProvider.ProviderError.dnsFailure) return } @@ -90,7 +90,7 @@ class ConnectionStrategy { return true } - private func currentProtocol() -> PIATunnelProvider.EndpointProtocol { + private func currentProtocol() -> TunnelKitProvider.EndpointProtocol { return endpointProtocols[currentProtocolIndex] } @@ -111,7 +111,7 @@ class ConnectionStrategy { } private extension NEProvider { - func createSocket(to address: String, protocol endpointProtocol: PIATunnelProvider.EndpointProtocol) -> GenericSocket { + func createSocket(to address: String, protocol endpointProtocol: TunnelKitProvider.EndpointProtocol) -> GenericSocket { let endpoint = NWHostEndpoint(hostname: address, port: "\(endpointProtocol.port)") switch endpointProtocol.socketType { case .udp: diff --git a/TunnelKit/Sources/AppExtension/DNSResolver.swift b/TunnelKit/Sources/AppExtension/DNSResolver.swift index ffc2136..3f7c339 100644 --- a/TunnelKit/Sources/AppExtension/DNSResolver.swift +++ b/TunnelKit/Sources/AppExtension/DNSResolver.swift @@ -1,6 +1,6 @@ // // DNSResolver.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 12/15/17. // Copyright © 2017 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/GenericSocket.swift b/TunnelKit/Sources/AppExtension/GenericSocket.swift index a1df045..58eddb7 100644 --- a/TunnelKit/Sources/AppExtension/GenericSocket.swift +++ b/TunnelKit/Sources/AppExtension/GenericSocket.swift @@ -1,6 +1,6 @@ // // GenericSocket.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 4/16/18. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/InterfaceObserver.swift b/TunnelKit/Sources/AppExtension/InterfaceObserver.swift index 854210f..d0c068c 100644 --- a/TunnelKit/Sources/AppExtension/InterfaceObserver.swift +++ b/TunnelKit/Sources/AppExtension/InterfaceObserver.swift @@ -1,6 +1,6 @@ // // InterfaceObserver.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 6/14/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/Keychain.swift b/TunnelKit/Sources/AppExtension/Keychain.swift index 7dfbde0..63f879e 100644 --- a/TunnelKit/Sources/AppExtension/Keychain.swift +++ b/TunnelKit/Sources/AppExtension/Keychain.swift @@ -1,6 +1,6 @@ // // Keychain.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/12/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/MemoryDestination.swift b/TunnelKit/Sources/AppExtension/MemoryDestination.swift index 9ed3624..8b36caf 100644 --- a/TunnelKit/Sources/AppExtension/MemoryDestination.swift +++ b/TunnelKit/Sources/AppExtension/MemoryDestination.swift @@ -1,6 +1,6 @@ // // MemoryDestination.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 7/26/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/Transport/LinkInterface+Strategy.swift b/TunnelKit/Sources/AppExtension/Transport/LinkInterface+Strategy.swift index 5f58c3c..1d9fd0d 100644 --- a/TunnelKit/Sources/AppExtension/Transport/LinkInterface+Strategy.swift +++ b/TunnelKit/Sources/AppExtension/Transport/LinkInterface+Strategy.swift @@ -1,6 +1,6 @@ // // LinkInterface+Strategy.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 6/28/18. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/Transport/NETCPInterface.swift b/TunnelKit/Sources/AppExtension/Transport/NETCPInterface.swift index 2584946..42d45f0 100644 --- a/TunnelKit/Sources/AppExtension/Transport/NETCPInterface.swift +++ b/TunnelKit/Sources/AppExtension/Transport/NETCPInterface.swift @@ -1,6 +1,6 @@ // // NETCPInterface.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 4/15/18. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/Transport/NETunnelInterface.swift b/TunnelKit/Sources/AppExtension/Transport/NETunnelInterface.swift index 1e57efd..8141df9 100644 --- a/TunnelKit/Sources/AppExtension/Transport/NETunnelInterface.swift +++ b/TunnelKit/Sources/AppExtension/Transport/NETunnelInterface.swift @@ -1,6 +1,6 @@ // // NETunnelInterface.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 8/27/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/Transport/NEUDPInterface.swift b/TunnelKit/Sources/AppExtension/Transport/NEUDPInterface.swift index e740eac..3dc8f6d 100644 --- a/TunnelKit/Sources/AppExtension/Transport/NEUDPInterface.swift +++ b/TunnelKit/Sources/AppExtension/Transport/NEUDPInterface.swift @@ -1,6 +1,6 @@ // // NEUDPInterface.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 8/27/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/Transport/NWTCPConnectionState+Description.swift b/TunnelKit/Sources/AppExtension/Transport/NWTCPConnectionState+Description.swift index 8459eff..5f5e4fe 100644 --- a/TunnelKit/Sources/AppExtension/Transport/NWTCPConnectionState+Description.swift +++ b/TunnelKit/Sources/AppExtension/Transport/NWTCPConnectionState+Description.swift @@ -1,6 +1,6 @@ // // NWTCPConnectionState+Description.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 4/16/18. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/Transport/NWUDPSessionState+Description.swift b/TunnelKit/Sources/AppExtension/Transport/NWUDPSessionState+Description.swift index d4f454c..92df0b6 100644 --- a/TunnelKit/Sources/AppExtension/Transport/NWUDPSessionState+Description.swift +++ b/TunnelKit/Sources/AppExtension/Transport/NWUDPSessionState+Description.swift @@ -1,6 +1,6 @@ // // NWUDPSessionState+Description.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 9/24/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/AppExtension/PIATunnelProvider+Configuration.swift b/TunnelKit/Sources/AppExtension/TunnelKitProvider+Configuration.swift similarity index 91% rename from TunnelKit/Sources/AppExtension/PIATunnelProvider+Configuration.swift rename to TunnelKit/Sources/AppExtension/TunnelKitProvider+Configuration.swift index 7b2e766..e6f6bc8 100644 --- a/TunnelKit/Sources/AppExtension/PIATunnelProvider+Configuration.swift +++ b/TunnelKit/Sources/AppExtension/TunnelKitProvider+Configuration.swift @@ -1,6 +1,6 @@ // -// PIATunnelProvider+Configuration.swift -// PIATunnel +// TunnelKitProvider+Configuration.swift +// TunnelKit // // Created by Davide De Rosa on 10/23/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -12,7 +12,7 @@ import SwiftyBeaver private let log = SwiftyBeaver.self -extension PIATunnelProvider { +extension TunnelKitProvider { // MARK: Cryptography @@ -94,7 +94,7 @@ extension PIATunnelProvider { return } - let bundle = Bundle(for: PIATunnelProvider.self) + let bundle = Bundle(for: TunnelKitProvider.self) let certName = "PIA-\(rawValue)" guard let certUrl = bundle.url(forResource: certName, withExtension: "pem") else { fatalError("Could not find \(certName) TLS certificate") @@ -105,7 +105,7 @@ extension PIATunnelProvider { } } -extension PIATunnelProvider { +extension TunnelKitProvider { // MARK: Configuration @@ -192,7 +192,7 @@ extension PIATunnelProvider { } } - /// The way to create a `PIATunnelProvider.Configuration` object for the tunnel profile. + /// The way to create a `TunnelKitProvider.Configuration` object for the tunnel profile. public struct ConfigurationBuilder { // MARK: App group @@ -341,9 +341,9 @@ extension PIATunnelProvider { } /** - Builds a `PIATunnelProvider.Configuration` object that will connect to the provided endpoint. + Builds a `TunnelKitProvider.Configuration` object that will connect to the provided endpoint. - - Returns: A `PIATunnelProvider.Configuration` object with this builder and the additional method parameters. + - Returns: A `TunnelKitProvider.Configuration` object with this builder and the additional method parameters. */ public func build() -> Configuration { return Configuration( @@ -364,7 +364,7 @@ extension PIATunnelProvider { } } - /// Offers a bridge between the abstract `PIATunnelProvider.ConfigurationBuilder` and a concrete `NETunnelProviderProtocol` profile. + /// Offers a bridge between the abstract `TunnelKitProvider.ConfigurationBuilder` and a concrete `NETunnelProviderProtocol` profile. public struct Configuration { struct Keys { static let appGroup = "AppGroup" @@ -394,43 +394,43 @@ extension PIATunnelProvider { static let debugLogFormat = "DebugLogFormat" } - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.appGroup` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.appGroup` public let appGroup: String - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.prefersResolvedAddresses` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.prefersResolvedAddresses` public let prefersResolvedAddresses: Bool - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.resolvedAddresses` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.resolvedAddresses` public let resolvedAddresses: [String]? - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.endpointProtocols` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.endpointProtocols` public let endpointProtocols: [EndpointProtocol] - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.cipher` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.cipher` public let cipher: Cipher - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.digest` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.digest` public let digest: Digest - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.handshake` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.handshake` public let handshake: Handshake - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.ca` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.ca` public let ca: String? - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.mtu` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.mtu` public let mtu: NSNumber - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.renegotiatesAfterSeconds` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.renegotiatesAfterSeconds` public let renegotiatesAfterSeconds: Int? - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.shouldDebug` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.shouldDebug` public let shouldDebug: Bool - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.debugLogKey` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.debugLogKey` public let debugLogKey: String? - /// - Seealso: `PIATunnelProvider.ConfigurationBuilder.debugLogFormat` + /// - Seealso: `TunnelKitProvider.ConfigurationBuilder.debugLogFormat` public let debugLogFormat: String? // MARK: Shortcuts @@ -449,10 +449,10 @@ extension PIATunnelProvider { // MARK: API /** - Parses a new `PIATunnelProvider.Configuration` object from a provider configuration map. + Parses a new `TunnelKitProvider.Configuration` object from a provider configuration map. - Parameter from: The map to parse. - - Returns: The parsed `PIATunnelProvider.Configuration` object. + - Returns: The parsed `TunnelKitProvider.Configuration` object. - Throws: `ProviderError.configuration` if `providerConfiguration` is incomplete. */ public static func parsed(from providerConfiguration: [String: Any]) throws -> Configuration { @@ -502,7 +502,7 @@ extension PIATunnelProvider { Generates a `NETunnelProviderProtocol` from this configuration. - Parameter bundleIdentifier: The provider bundle identifier required to locate the tunnel extension. - - Parameter endpoint: The `PIATunnelProvider.AuthenticatedEndpoint` the tunnel will connect to. + - Parameter endpoint: The `TunnelKitProvider.AuthenticatedEndpoint` the tunnel will connect to. - Returns: The generated `NETunnelProviderProtocol` object. - Throws: `ProviderError.configuration` if unable to store the `endpoint.password` to the `appGroup` keychain. */ @@ -548,15 +548,15 @@ extension PIATunnelProvider { // MARK: Modification -extension PIATunnelProvider.Configuration: Equatable { +extension TunnelKitProvider.Configuration: Equatable { /** - Returns a `PIATunnelProvider.ConfigurationBuilder` to use this configuration as a starting point for a new one. + Returns a `TunnelKitProvider.ConfigurationBuilder` to use this configuration as a starting point for a new one. - - Returns: An editable `PIATunnelProvider.ConfigurationBuilder` initialized with this configuration. + - Returns: An editable `TunnelKitProvider.ConfigurationBuilder` initialized with this configuration. */ - public func builder() -> PIATunnelProvider.ConfigurationBuilder { - var builder = PIATunnelProvider.ConfigurationBuilder(appGroup: appGroup) + public func builder() -> TunnelKitProvider.ConfigurationBuilder { + var builder = TunnelKitProvider.ConfigurationBuilder(appGroup: appGroup) builder.endpointProtocols = endpointProtocols builder.cipher = cipher builder.digest = digest @@ -569,7 +569,7 @@ extension PIATunnelProvider.Configuration: Equatable { } /// :nodoc: - public static func ==(lhs: PIATunnelProvider.Configuration, rhs: PIATunnelProvider.Configuration) -> Bool { + public static func ==(lhs: TunnelKitProvider.Configuration, rhs: TunnelKitProvider.Configuration) -> Bool { return ( (lhs.endpointProtocols == rhs.endpointProtocols) && (lhs.cipher == rhs.cipher) && diff --git a/TunnelKit/Sources/AppExtension/PIATunnelProvider+Interaction.swift b/TunnelKit/Sources/AppExtension/TunnelKitProvider+Interaction.swift similarity index 88% rename from TunnelKit/Sources/AppExtension/PIATunnelProvider+Interaction.swift rename to TunnelKit/Sources/AppExtension/TunnelKitProvider+Interaction.swift index 2f18c00..5afc85a 100644 --- a/TunnelKit/Sources/AppExtension/PIATunnelProvider+Interaction.swift +++ b/TunnelKit/Sources/AppExtension/TunnelKitProvider+Interaction.swift @@ -1,6 +1,6 @@ // -// PIATunnelProvider+Interaction.swift -// PIATunnel +// TunnelKitProvider+Interaction.swift +// TunnelKit // // Created by Davide De Rosa on 9/24/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -8,11 +8,11 @@ import Foundation -extension PIATunnelProvider { +extension TunnelKitProvider { // MARK: Interaction - /// The messages accepted by `PIATunnelProvider`. + /// The messages accepted by `TunnelKitProvider`. public class Message: Equatable { /// Requests a snapshot of the latest debug log. Returns the log data decoded from UTF-8. @@ -42,10 +42,10 @@ extension PIATunnelProvider { } } - /// The errors raised by `PIATunnelProvider`. + /// The errors raised by `TunnelKitProvider`. public enum ProviderError: Error { - /// The `PIATunnelProvider.Configuration` provided is incorrect or incomplete. + /// The `TunnelKitProvider.Configuration` provided is incorrect or incomplete. case configuration(field: String) /// Credentials are missing or protected (e.g. device locked). diff --git a/TunnelKit/Sources/AppExtension/PIATunnelProvider.swift b/TunnelKit/Sources/AppExtension/TunnelKitProvider.swift similarity index 98% rename from TunnelKit/Sources/AppExtension/PIATunnelProvider.swift rename to TunnelKit/Sources/AppExtension/TunnelKitProvider.swift index 1d1f328..b3b09be 100644 --- a/TunnelKit/Sources/AppExtension/PIATunnelProvider.swift +++ b/TunnelKit/Sources/AppExtension/TunnelKitProvider.swift @@ -1,6 +1,6 @@ // -// PIATunnelProvider.swift -// PIATunnel +// TunnelKitProvider.swift +// TunnelKit // // Created by Davide De Rosa on 2/1/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -15,7 +15,7 @@ private let log = SwiftyBeaver.self Provides an all-in-one `NEPacketTunnelProvider` implementation for use in a Packet Tunnel Provider extension both on iOS and macOS. */ -open class PIATunnelProvider: NEPacketTunnelProvider { +open class TunnelKitProvider: NEPacketTunnelProvider { // MARK: Tweaks @@ -49,7 +49,7 @@ open class PIATunnelProvider: NEPacketTunnelProvider { private let observer = InterfaceObserver() - private let tunnelQueue = DispatchQueue(label: PIATunnelProvider.description()) + private let tunnelQueue = DispatchQueue(label: TunnelKitProvider.description()) private let prngSeedLength = 64 @@ -305,7 +305,7 @@ open class PIATunnelProvider: NEPacketTunnelProvider { } } -extension PIATunnelProvider: GenericSocketDelegate { +extension TunnelKitProvider: GenericSocketDelegate { // MARK: GenericSocketDelegate (tunnel queue) @@ -380,7 +380,7 @@ extension PIATunnelProvider: GenericSocketDelegate { } } -extension PIATunnelProvider: SessionProxyDelegate { +extension TunnelKitProvider: SessionProxyDelegate { // MARK: SessionProxyDelegate (tunnel queue) @@ -444,7 +444,7 @@ extension PIATunnelProvider: SessionProxyDelegate { } } -extension PIATunnelProvider { +extension TunnelKitProvider { // MARK: Helpers diff --git a/TunnelKit/Sources/AppExtension/Utils.swift b/TunnelKit/Sources/AppExtension/Utils.swift index 57a2db9..53c43d3 100644 --- a/TunnelKit/Sources/AppExtension/Utils.swift +++ b/TunnelKit/Sources/AppExtension/Utils.swift @@ -1,6 +1,6 @@ // // Utils.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 5/23/18. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/Allocation.h b/TunnelKit/Sources/Core/Allocation.h index 61fc539..d92f526 100644 --- a/TunnelKit/Sources/Core/Allocation.h +++ b/TunnelKit/Sources/Core/Allocation.h @@ -1,6 +1,6 @@ // // Allocation.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 5/5/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/Allocation.m b/TunnelKit/Sources/Core/Allocation.m index 421439d..dfa3d8f 100644 --- a/TunnelKit/Sources/Core/Allocation.m +++ b/TunnelKit/Sources/Core/Allocation.m @@ -1,6 +1,6 @@ // // Allocation.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 5/5/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/Authenticator.swift b/TunnelKit/Sources/Core/Authenticator.swift index 78c80b6..e6e4cc3 100644 --- a/TunnelKit/Sources/Core/Authenticator.swift +++ b/TunnelKit/Sources/Core/Authenticator.swift @@ -1,6 +1,6 @@ // // Authenticator.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/9/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/CommunicationType.swift b/TunnelKit/Sources/Core/CommunicationType.swift index 79c1808..16cf28b 100644 --- a/TunnelKit/Sources/Core/CommunicationType.swift +++ b/TunnelKit/Sources/Core/CommunicationType.swift @@ -1,6 +1,6 @@ // // CommunicationType.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 6/28/18. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/CoreConfiguration.swift b/TunnelKit/Sources/Core/CoreConfiguration.swift index ba032a4..d449be4 100644 --- a/TunnelKit/Sources/Core/CoreConfiguration.swift +++ b/TunnelKit/Sources/Core/CoreConfiguration.swift @@ -1,6 +1,6 @@ // // CoreConfiguration.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 9/1/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/CryptoAEAD.h b/TunnelKit/Sources/Core/CryptoAEAD.h index 498086a..4dce20a 100644 --- a/TunnelKit/Sources/Core/CryptoAEAD.h +++ b/TunnelKit/Sources/Core/CryptoAEAD.h @@ -1,6 +1,6 @@ // // CryptoAEAD.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 06/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/CryptoAEAD.m b/TunnelKit/Sources/Core/CryptoAEAD.m index f521949..5fa1d16 100644 --- a/TunnelKit/Sources/Core/CryptoAEAD.m +++ b/TunnelKit/Sources/Core/CryptoAEAD.m @@ -1,6 +1,6 @@ // // CryptoAEAD.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 06/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. @@ -110,11 +110,11 @@ const NSInteger CryptoAEADTagLength = 16; assert(self.extraLength >= PacketIdLength); memcpy(self.cipherIVEnc, extra + self.extraPacketIdOffset, PacketIdLength); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxEnc, NULL, NULL, self.cipherIVEnc, -1); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, NULL, &x, extra, self.extraLength); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, dest + CryptoAEADTagLength, &l1, bytes, (int)length); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxEnc, dest + CryptoAEADTagLength + l1, &l2); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CIPHER_CTX_ctrl(self.cipherCtxEnc, EVP_CTRL_GCM_GET_TAG, CryptoAEADTagLength, dest); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxEnc, NULL, NULL, self.cipherIVEnc, -1); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, NULL, &x, extra, self.extraLength); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, dest + CryptoAEADTagLength, &l1, bytes, (int)length); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxEnc, dest + CryptoAEADTagLength + l1, &l2); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CIPHER_CTX_ctrl(self.cipherCtxEnc, EVP_CTRL_GCM_GET_TAG, CryptoAEADTagLength, dest); *destLength = CryptoAEADTagLength + l1 + l2; @@ -124,7 +124,7 @@ const NSInteger CryptoAEADTagLength = 16; // NSLog(@">>> ENC tag: %@", [NSData dataWithBytes:dest length:CryptoAEADTagLength]); // NSLog(@">>> ENC dest: %@", [NSData dataWithBytes:dest + CryptoAEADTagLength length:*destLength - CryptoAEADTagLength]); - PIA_CRYPTO_RETURN_STATUS(code) + TUNNEL_CRYPTO_RETURN_STATUS(code) } - (id)dataPathEncrypter @@ -173,11 +173,11 @@ const NSInteger CryptoAEADTagLength = 16; assert(self.extraLength >= PacketIdLength); memcpy(self.cipherIVDec, extra + self.extraPacketIdOffset, PacketIdLength); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxDec, NULL, NULL, self.cipherIVDec, -1); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CIPHER_CTX_ctrl(self.cipherCtxDec, EVP_CTRL_GCM_SET_TAG, CryptoAEADTagLength, (uint8_t *)bytes); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, NULL, &x, extra, self.extraLength); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, dest, &l1, bytes + CryptoAEADTagLength, (int)length - CryptoAEADTagLength); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxDec, dest + l1, &l2); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxDec, NULL, NULL, self.cipherIVDec, -1); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CIPHER_CTX_ctrl(self.cipherCtxDec, EVP_CTRL_GCM_SET_TAG, CryptoAEADTagLength, (uint8_t *)bytes); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, NULL, &x, extra, self.extraLength); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, dest, &l1, bytes + CryptoAEADTagLength, (int)length - CryptoAEADTagLength); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxDec, dest + l1, &l2); *destLength = l1 + l2; @@ -187,7 +187,7 @@ const NSInteger CryptoAEADTagLength = 16; // NSLog(@">>> DEC tag: %@", [NSData dataWithBytes:bytes length:CryptoAEADTagLength]); // NSLog(@">>> DEC dest: %@", [NSData dataWithBytes:dest length:*destLength]); - PIA_CRYPTO_RETURN_STATUS(code) + TUNNEL_CRYPTO_RETURN_STATUS(code) } - (id)dataPathDecrypter @@ -321,7 +321,7 @@ const NSInteger CryptoAEADTagLength = 16; } if (self.checkPeerId && !self.checkPeerId(packet.bytes)) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeDataPathPeerIdMismatch); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeDataPathPeerIdMismatch); } return NO; } diff --git a/TunnelKit/Sources/Core/CryptoBox.h b/TunnelKit/Sources/Core/CryptoBox.h index 616f239..3ecba5a 100644 --- a/TunnelKit/Sources/Core/CryptoBox.h +++ b/TunnelKit/Sources/Core/CryptoBox.h @@ -1,6 +1,6 @@ // // CryptoBox.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/4/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/CryptoBox.m b/TunnelKit/Sources/Core/CryptoBox.m index b260def..a72953f 100644 --- a/TunnelKit/Sources/Core/CryptoBox.m +++ b/TunnelKit/Sources/Core/CryptoBox.m @@ -1,6 +1,6 @@ // // CryptoBox.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/4/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -78,7 +78,7 @@ if ([self.cipherAlgorithm hasSuffix:@"-cbc"]) { if (!self.digestAlgorithm) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxAlgorithm); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxAlgorithm); } return NO; } @@ -95,7 +95,7 @@ // not supported else { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxAlgorithm); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxAlgorithm); } return NO; } @@ -123,15 +123,15 @@ int code = 1; HMAC_CTX *ctx = HMAC_CTX_new(); - PIA_CRYPTO_TRACK_STATUS(code) HMAC_CTX_reset(ctx); - PIA_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(ctx, secret, (int)secretLength, EVP_get_digestbyname([digestName cStringUsingEncoding:NSASCIIStringEncoding]), NULL); - PIA_CRYPTO_TRACK_STATUS(code) HMAC_Update(ctx, data, dataLength); - PIA_CRYPTO_TRACK_STATUS(code) HMAC_Final(ctx, hmac, &l); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_CTX_reset(ctx); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(ctx, secret, (int)secretLength, EVP_get_digestbyname([digestName cStringUsingEncoding:NSASCIIStringEncoding]), NULL); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Update(ctx, data, dataLength); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Final(ctx, hmac, &l); HMAC_CTX_free(ctx); *hmacLength = l; - PIA_CRYPTO_RETURN_STATUS(code) + TUNNEL_CRYPTO_RETURN_STATUS(code) } @end diff --git a/TunnelKit/Sources/Core/CryptoCBC.h b/TunnelKit/Sources/Core/CryptoCBC.h index 717b50e..f865221 100644 --- a/TunnelKit/Sources/Core/CryptoCBC.h +++ b/TunnelKit/Sources/Core/CryptoCBC.h @@ -1,6 +1,6 @@ // // CryptoCBC.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 06/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/CryptoCBC.m b/TunnelKit/Sources/Core/CryptoCBC.m index 4004f90..d0cd92b 100644 --- a/TunnelKit/Sources/Core/CryptoCBC.m +++ b/TunnelKit/Sources/Core/CryptoCBC.m @@ -1,6 +1,6 @@ // // CryptoCBC.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 06/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. @@ -120,22 +120,22 @@ const NSInteger CryptoCBCMaxHMACLength = 100; if (RAND_bytes(outIV, self.cipherIVLength) != 1) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxRandomGenerator); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxRandomGenerator); } return NO; } - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxEnc, NULL, NULL, outIV, -1); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, outEncrypted, &l1, bytes, (int)length); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxEnc, outEncrypted + l1, &l2); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxEnc, NULL, NULL, outIV, -1); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxEnc, outEncrypted, &l1, bytes, (int)length); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxEnc, outEncrypted + l1, &l2); - PIA_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(self.hmacCtxEnc, NULL, 0, NULL, NULL); - PIA_CRYPTO_TRACK_STATUS(code) HMAC_Update(self.hmacCtxEnc, outIV, l1 + l2 + self.cipherIVLength); - PIA_CRYPTO_TRACK_STATUS(code) HMAC_Final(self.hmacCtxEnc, dest, &l3); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(self.hmacCtxEnc, NULL, 0, NULL, NULL); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Update(self.hmacCtxEnc, outIV, l1 + l2 + self.cipherIVLength); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Final(self.hmacCtxEnc, dest, &l3); *destLength = l1 + l2 + self.cipherIVLength + self.digestLength; - PIA_CRYPTO_RETURN_STATUS(code) + TUNNEL_CRYPTO_RETURN_STATUS(code) } - (id)dataPathEncrypter @@ -180,24 +180,24 @@ const NSInteger CryptoCBCMaxHMACLength = 100; int l1 = 0, l2 = 0; int code = 1; - PIA_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(self.hmacCtxDec, NULL, 0, NULL, NULL); - PIA_CRYPTO_TRACK_STATUS(code) HMAC_Update(self.hmacCtxDec, bytes + self.digestLength, length - self.digestLength); - PIA_CRYPTO_TRACK_STATUS(code) HMAC_Final(self.hmacCtxDec, self.bufferDecHMAC, (unsigned *)&l1); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Init_ex(self.hmacCtxDec, NULL, 0, NULL, NULL); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Update(self.hmacCtxDec, bytes + self.digestLength, length - self.digestLength); + TUNNEL_CRYPTO_TRACK_STATUS(code) HMAC_Final(self.hmacCtxDec, self.bufferDecHMAC, (unsigned *)&l1); - if (PIA_CRYPTO_SUCCESS(code) && CRYPTO_memcmp(self.bufferDecHMAC, bytes, self.digestLength) != 0) { + if (TUNNEL_CRYPTO_SUCCESS(code) && CRYPTO_memcmp(self.bufferDecHMAC, bytes, self.digestLength) != 0) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxHMAC); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxHMAC); } return NO; } - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxDec, NULL, NULL, iv, -1); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, dest, &l1, encrypted, (int)length - self.digestLength - self.cipherIVLength); - PIA_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxDec, dest + l1, &l2); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherInit(self.cipherCtxDec, NULL, NULL, iv, -1); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherUpdate(self.cipherCtxDec, dest, &l1, encrypted, (int)length - self.digestLength - self.cipherIVLength); + TUNNEL_CRYPTO_TRACK_STATUS(code) EVP_CipherFinal(self.cipherCtxDec, dest + l1, &l2); *destLength = l1 + l2; - PIA_CRYPTO_RETURN_STATUS(code) + TUNNEL_CRYPTO_RETURN_STATUS(code) } - (id)dataPathDecrypter @@ -308,7 +308,7 @@ const NSInteger CryptoCBCMaxHMACLength = 100; } if (self.checkPeerId && !self.checkPeerId(packet.bytes)) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeDataPathPeerIdMismatch); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeDataPathPeerIdMismatch); } return NO; } diff --git a/TunnelKit/Sources/Core/CryptoMacros.h b/TunnelKit/Sources/Core/CryptoMacros.h index a68aeda..73184df 100644 --- a/TunnelKit/Sources/Core/CryptoMacros.h +++ b/TunnelKit/Sources/Core/CryptoMacros.h @@ -1,6 +1,6 @@ // // CryptoMacros.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 06/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. @@ -8,12 +8,12 @@ #import -#define PIA_CRYPTO_SUCCESS(ret) (ret > 0) -#define PIA_CRYPTO_TRACK_STATUS(ret) if (ret > 0) ret = -#define PIA_CRYPTO_RETURN_STATUS(ret)\ +#define TUNNEL_CRYPTO_SUCCESS(ret) (ret > 0) +#define TUNNEL_CRYPTO_TRACK_STATUS(ret) if (ret > 0) ret = +#define TUNNEL_CRYPTO_RETURN_STATUS(ret)\ if (ret <= 0) {\ if (error) {\ - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeCryptoBoxEncryption);\ + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeCryptoBoxEncryption);\ }\ return NO;\ }\ diff --git a/TunnelKit/Sources/Core/Data+Manipulation.swift b/TunnelKit/Sources/Core/Data+Manipulation.swift index dccd727..08b9790 100644 --- a/TunnelKit/Sources/Core/Data+Manipulation.swift +++ b/TunnelKit/Sources/Core/Data+Manipulation.swift @@ -1,6 +1,6 @@ // // Data+Manipulation.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/3/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/DataPath.h b/TunnelKit/Sources/Core/DataPath.h index 97e436d..18f852d 100644 --- a/TunnelKit/Sources/Core/DataPath.h +++ b/TunnelKit/Sources/Core/DataPath.h @@ -1,6 +1,6 @@ // // DataPath.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 3/2/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/DataPath.m b/TunnelKit/Sources/Core/DataPath.m index 644fbc4..52523ee 100644 --- a/TunnelKit/Sources/Core/DataPath.m +++ b/TunnelKit/Sources/Core/DataPath.m @@ -1,6 +1,6 @@ // // DataPath.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 3/2/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -140,7 +140,7 @@ if (self.outPacketId > self.maxPacketId) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeDataPathOverflow); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeDataPathOverflow); } return nil; } @@ -202,7 +202,7 @@ } if (packetId > self.maxPacketId) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeDataPathOverflow); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeDataPathOverflow); } return nil; } diff --git a/TunnelKit/Sources/Core/DataPathEncryption.h b/TunnelKit/Sources/Core/DataPathEncryption.h index b48239c..e6a1840 100644 --- a/TunnelKit/Sources/Core/DataPathEncryption.h +++ b/TunnelKit/Sources/Core/DataPathEncryption.h @@ -1,6 +1,6 @@ // // DataPathEncryption.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 11/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/Encryption.h b/TunnelKit/Sources/Core/Encryption.h index ab87ad6..3000efb 100644 --- a/TunnelKit/Sources/Core/Encryption.h +++ b/TunnelKit/Sources/Core/Encryption.h @@ -1,6 +1,6 @@ // // Encryption.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 3/3/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/EncryptionProxy.swift b/TunnelKit/Sources/Core/EncryptionProxy.swift index e55511a..b832c37 100644 --- a/TunnelKit/Sources/Core/EncryptionProxy.swift +++ b/TunnelKit/Sources/Core/EncryptionProxy.swift @@ -1,6 +1,6 @@ // // EncryptionProxy.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/8/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/Errors.h b/TunnelKit/Sources/Core/Errors.h index f177d22..ab15ac2 100644 --- a/TunnelKit/Sources/Core/Errors.h +++ b/TunnelKit/Sources/Core/Errors.h @@ -1,6 +1,6 @@ // // Errors.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 10/10/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -8,20 +8,20 @@ #import -extern NSString *const PIATunnelErrorDomain; +extern NSString *const TunnelKitErrorDomain; -typedef NS_ENUM(NSInteger, PIATunnelErrorCode) { - PIATunnelErrorCodeCryptoBoxRandomGenerator = 101, - PIATunnelErrorCodeCryptoBoxHMAC, - PIATunnelErrorCodeCryptoBoxEncryption, - PIATunnelErrorCodeCryptoBoxAlgorithm, - PIATunnelErrorCodeTLSBoxCA = 201, - PIATunnelErrorCodeTLSBoxHandshake, - PIATunnelErrorCodeTLSBoxGeneric, - PIATunnelErrorCodeDataPathOverflow = 301, - PIATunnelErrorCodeDataPathPeerIdMismatch +typedef NS_ENUM(NSInteger, TunnelKitErrorCode) { + TunnelKitErrorCodeCryptoBoxRandomGenerator = 101, + TunnelKitErrorCodeCryptoBoxHMAC, + TunnelKitErrorCodeCryptoBoxEncryption, + TunnelKitErrorCodeCryptoBoxAlgorithm, + TunnelKitErrorCodeTLSBoxCA = 201, + TunnelKitErrorCodeTLSBoxHandshake, + TunnelKitErrorCodeTLSBoxGeneric, + TunnelKitErrorCodeDataPathOverflow = 301, + TunnelKitErrorCodeDataPathPeerIdMismatch }; -static inline NSError *PIATunnelErrorWithCode(PIATunnelErrorCode code) { - return [NSError errorWithDomain:PIATunnelErrorDomain code:code userInfo:nil]; +static inline NSError *TunnelKitErrorWithCode(TunnelKitErrorCode code) { + return [NSError errorWithDomain:TunnelKitErrorDomain code:code userInfo:nil]; } diff --git a/TunnelKit/Sources/Core/Errors.m b/TunnelKit/Sources/Core/Errors.m index bf57146..70907b3 100644 --- a/TunnelKit/Sources/Core/Errors.m +++ b/TunnelKit/Sources/Core/Errors.m @@ -1,6 +1,6 @@ // // Errors.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 10/10/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -8,4 +8,4 @@ #import "Errors.h" -NSString *const PIATunnelErrorDomain = @"PIATunnelNative"; +NSString *const TunnelKitErrorDomain = @"TunnelKitNative"; diff --git a/TunnelKit/Sources/Core/IOInterface.swift b/TunnelKit/Sources/Core/IOInterface.swift index a5f14a3..bc91902 100644 --- a/TunnelKit/Sources/Core/IOInterface.swift +++ b/TunnelKit/Sources/Core/IOInterface.swift @@ -1,6 +1,6 @@ // // IOInterface.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 8/27/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/LinkInterface.swift b/TunnelKit/Sources/Core/LinkInterface.swift index e5582de..f8fb3ad 100644 --- a/TunnelKit/Sources/Core/LinkInterface.swift +++ b/TunnelKit/Sources/Core/LinkInterface.swift @@ -1,6 +1,6 @@ // // LinkInterface.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 8/27/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/MSS.h b/TunnelKit/Sources/Core/MSS.h index 4161f32..5d6b5a4 100644 --- a/TunnelKit/Sources/Core/MSS.h +++ b/TunnelKit/Sources/Core/MSS.h @@ -1,6 +1,6 @@ // // MSS.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/7/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/MSS.m b/TunnelKit/Sources/Core/MSS.m index cee9f24..10db1b0 100644 --- a/TunnelKit/Sources/Core/MSS.m +++ b/TunnelKit/Sources/Core/MSS.m @@ -1,6 +1,6 @@ // // MSS.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/7/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/Packet.swift b/TunnelKit/Sources/Core/Packet.swift index 6718ef5..6671511 100644 --- a/TunnelKit/Sources/Core/Packet.swift +++ b/TunnelKit/Sources/Core/Packet.swift @@ -1,6 +1,6 @@ // // Packet.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/3/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/PacketMacros.h b/TunnelKit/Sources/Core/PacketMacros.h index 06e848b..2a74b71 100644 --- a/TunnelKit/Sources/Core/PacketMacros.h +++ b/TunnelKit/Sources/Core/PacketMacros.h @@ -1,6 +1,6 @@ // // PacketMacros.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 11/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/PacketMacros.m b/TunnelKit/Sources/Core/PacketMacros.m index 866ed81..285aaf3 100644 --- a/TunnelKit/Sources/Core/PacketMacros.m +++ b/TunnelKit/Sources/Core/PacketMacros.m @@ -1,6 +1,6 @@ // // PacketMacros.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 11/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/ProtocolMacros.swift b/TunnelKit/Sources/Core/ProtocolMacros.swift index 7aa3186..3b4a184 100644 --- a/TunnelKit/Sources/Core/ProtocolMacros.swift +++ b/TunnelKit/Sources/Core/ProtocolMacros.swift @@ -1,6 +1,6 @@ // // ProtocolMacros.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/8/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/PushReply.swift b/TunnelKit/Sources/Core/PushReply.swift index e5b7719..ddb248a 100644 --- a/TunnelKit/Sources/Core/PushReply.swift +++ b/TunnelKit/Sources/Core/PushReply.swift @@ -1,6 +1,6 @@ // // PushReply.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 25/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/ReplayProtector.h b/TunnelKit/Sources/Core/ReplayProtector.h index 808e102..0a04dc0 100644 --- a/TunnelKit/Sources/Core/ReplayProtector.h +++ b/TunnelKit/Sources/Core/ReplayProtector.h @@ -1,6 +1,6 @@ // // ReplayProtector.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/17/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/ReplayProtector.m b/TunnelKit/Sources/Core/ReplayProtector.m index 4bcea1b..a8f8cae 100644 --- a/TunnelKit/Sources/Core/ReplayProtector.m +++ b/TunnelKit/Sources/Core/ReplayProtector.m @@ -1,6 +1,6 @@ // // ReplayProtector.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/17/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/SecureRandom.swift b/TunnelKit/Sources/Core/SecureRandom.swift index bf53427..72e73d3 100644 --- a/TunnelKit/Sources/Core/SecureRandom.swift +++ b/TunnelKit/Sources/Core/SecureRandom.swift @@ -1,6 +1,6 @@ // // SecureRandom.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/3/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/SessionKey.swift b/TunnelKit/Sources/Core/SessionKey.swift index 04f1a52..5380bf4 100644 --- a/TunnelKit/Sources/Core/SessionKey.swift +++ b/TunnelKit/Sources/Core/SessionKey.swift @@ -1,6 +1,6 @@ // // SessionKey.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 4/12/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/SessionProxy.swift b/TunnelKit/Sources/Core/SessionProxy.swift index 82be3f7..e2852a3 100644 --- a/TunnelKit/Sources/Core/SessionProxy.swift +++ b/TunnelKit/Sources/Core/SessionProxy.swift @@ -1,6 +1,6 @@ // // SessionProxy.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/3/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -15,7 +15,7 @@ private let log = SwiftyBeaver.self private extension Error { func isDataPathOverflow() -> Bool { let te = self as NSError - return te.domain == PIATunnelErrorDomain && te.code == PIATunnelErrorCode.dataPathOverflow.rawValue + return te.domain == TunnelKitErrorDomain && te.code == TunnelKitErrorCode.dataPathOverflow.rawValue } } diff --git a/TunnelKit/Sources/Core/TLSBox.h b/TunnelKit/Sources/Core/TLSBox.h index 6370874..7e92c73 100644 --- a/TunnelKit/Sources/Core/TLSBox.h +++ b/TunnelKit/Sources/Core/TLSBox.h @@ -1,6 +1,6 @@ // // TLSBox.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/3/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/TLSBox.m b/TunnelKit/Sources/Core/TLSBox.m index 2fe6fc2..cac4f96 100644 --- a/TunnelKit/Sources/Core/TLSBox.m +++ b/TunnelKit/Sources/Core/TLSBox.m @@ -1,6 +1,6 @@ // // TLSBox.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/3/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -89,7 +89,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) { if (!SSL_CTX_load_verify_locations(self.ctx, [self.caPath cStringUsingEncoding:NSASCIIStringEncoding], NULL)) { ERR_print_errors_fp(stdout); if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxCA); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxCA); } return NO; } @@ -112,7 +112,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) { if (!SSL_do_handshake(self.ssl)) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxHandshake); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxHandshake); } return NO; } @@ -135,7 +135,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) { } if ((ret < 0) && !BIO_should_retry(self.bioCipherTextOut)) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxGeneric); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxGeneric); } } return nil; @@ -153,7 +153,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) { } if ((ret < 0) && !BIO_should_retry(self.bioPlainText)) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxGeneric); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxGeneric); } } return NO; @@ -175,7 +175,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) { const int ret = BIO_write(self.bioCipherTextIn, text, (int)length); if (ret != length) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxGeneric); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxGeneric); } return NO; } @@ -196,7 +196,7 @@ int TLSBoxVerifyPeer(int ok, X509_STORE_CTX *ctx) { const int ret = BIO_write(self.bioPlainText, text, (int)length); if (ret != length) { if (error) { - *error = PIATunnelErrorWithCode(PIATunnelErrorCodeTLSBoxGeneric); + *error = TunnelKitErrorWithCode(TunnelKitErrorCodeTLSBoxGeneric); } return NO; } diff --git a/TunnelKit/Sources/Core/TunnelInterface.swift b/TunnelKit/Sources/Core/TunnelInterface.swift index a8369ff..509edf4 100644 --- a/TunnelKit/Sources/Core/TunnelInterface.swift +++ b/TunnelKit/Sources/Core/TunnelInterface.swift @@ -1,6 +1,6 @@ // // TunnelInterface.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 8/27/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/TunnelSettings.swift b/TunnelKit/Sources/Core/TunnelSettings.swift index d94ba1a..647814f 100644 --- a/TunnelKit/Sources/Core/TunnelSettings.swift +++ b/TunnelKit/Sources/Core/TunnelSettings.swift @@ -1,6 +1,6 @@ // // TunnelSettings.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 2/7/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/ZeroingData.h b/TunnelKit/Sources/Core/ZeroingData.h index 34c6d87..b783491 100644 --- a/TunnelKit/Sources/Core/ZeroingData.h +++ b/TunnelKit/Sources/Core/ZeroingData.h @@ -1,6 +1,6 @@ // // ZeroingData.h -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 4/28/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/ZeroingData.m b/TunnelKit/Sources/Core/ZeroingData.m index e31267d..426e45c 100644 --- a/TunnelKit/Sources/Core/ZeroingData.m +++ b/TunnelKit/Sources/Core/ZeroingData.m @@ -1,6 +1,6 @@ // // ZeroingData.m -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 4/28/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKit/Sources/Core/ZeroingData.swift b/TunnelKit/Sources/Core/ZeroingData.swift index 793bbdc..595380a 100644 --- a/TunnelKit/Sources/Core/ZeroingData.swift +++ b/TunnelKit/Sources/Core/ZeroingData.swift @@ -1,6 +1,6 @@ // // ZeroingData.swift -// PIATunnel +// TunnelKit // // Created by Davide De Rosa on 4/27/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitHost/AppDelegate.swift b/TunnelKitHost/AppDelegate.swift index 015c0eb..e6552f0 100644 --- a/TunnelKitHost/AppDelegate.swift +++ b/TunnelKitHost/AppDelegate.swift @@ -1,6 +1,6 @@ // // AppDelegate.swift -// PIATunnelHost +// TunnelKitHost // // Created by Davide De Rosa on 9/24/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitHost/ViewController.swift b/TunnelKitHost/ViewController.swift index c9db307..4262624 100644 --- a/TunnelKitHost/ViewController.swift +++ b/TunnelKitHost/ViewController.swift @@ -1,6 +1,6 @@ // // ViewController.swift -// PIATunnelHost +// TunnelKitHost // // Created by Davide De Rosa on 9/24/17. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitTests/AppExtensionTests.swift b/TunnelKitTests/AppExtensionTests.swift index 4f5ad8f..37f0912 100644 --- a/TunnelKitTests/AppExtensionTests.swift +++ b/TunnelKitTests/AppExtensionTests.swift @@ -1,6 +1,6 @@ // // AppExtensionTests.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 10/23/17. // Copyright © 2018 London Trust Media. All rights reserved. @@ -23,18 +23,18 @@ class AppExtensionTests: XCTestCase { } func testConfiguration() { - var builder: PIATunnelProvider.ConfigurationBuilder! - var cfg: PIATunnelProvider.Configuration! + var builder: TunnelKitProvider.ConfigurationBuilder! + var cfg: TunnelKitProvider.Configuration! let identifier = "com.example.Provider" let appGroup = "group.com.algoritmico.TunnelKit" - let endpoint = PIATunnelProvider.AuthenticatedEndpoint( + let endpoint = TunnelKitProvider.AuthenticatedEndpoint( hostname: "example.com", username: "foo", password: "bar" ) - builder = PIATunnelProvider.ConfigurationBuilder(appGroup: appGroup) + builder = TunnelKitProvider.ConfigurationBuilder(appGroup: appGroup) XCTAssertNotNil(builder) builder.cipher = .aes128cbc @@ -54,7 +54,7 @@ class AppExtensionTests: XCTestCase { print("\(pc)") } - let K = PIATunnelProvider.Configuration.Keys.self + let K = TunnelKitProvider.Configuration.Keys.self XCTAssertEqual(proto?.providerConfiguration?[K.appGroup] as? String, cfg.appGroup) XCTAssertEqual(proto?.providerConfiguration?[K.cipherAlgorithm] as? String, cfg.cipher.rawValue) XCTAssertEqual(proto?.providerConfiguration?[K.digestAlgorithm] as? String, cfg.digest.rawValue) diff --git a/TunnelKitTests/DataManipulationTests.swift b/TunnelKitTests/DataManipulationTests.swift index 075b127..c0399e7 100644 --- a/TunnelKitTests/DataManipulationTests.swift +++ b/TunnelKitTests/DataManipulationTests.swift @@ -1,6 +1,6 @@ // // DataManipulationTests.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 07/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitTests/DataPathEncryptionTests.swift b/TunnelKitTests/DataPathEncryptionTests.swift index b621c69..c4d9dea 100644 --- a/TunnelKitTests/DataPathEncryptionTests.swift +++ b/TunnelKitTests/DataPathEncryptionTests.swift @@ -1,6 +1,6 @@ // // DataPathEncryptionTests.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 11/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitTests/DataPathPerformanceTests.swift b/TunnelKitTests/DataPathPerformanceTests.swift index 14808ee..e5b43fa 100644 --- a/TunnelKitTests/DataPathPerformanceTests.swift +++ b/TunnelKitTests/DataPathPerformanceTests.swift @@ -1,6 +1,6 @@ // // DataPathPerformanceTests.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 07/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitTests/EncryptionPerformanceTests.swift b/TunnelKitTests/EncryptionPerformanceTests.swift index 1c4a687..c298a4b 100644 --- a/TunnelKitTests/EncryptionPerformanceTests.swift +++ b/TunnelKitTests/EncryptionPerformanceTests.swift @@ -1,6 +1,6 @@ // // EncryptionPerformanceTests.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 07/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitTests/EncryptionTests.swift b/TunnelKitTests/EncryptionTests.swift index 8f4c396..fd153ab 100644 --- a/TunnelKitTests/EncryptionTests.swift +++ b/TunnelKitTests/EncryptionTests.swift @@ -1,6 +1,6 @@ // // EncryptionTests.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 07/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitTests/LinkTests.swift b/TunnelKitTests/LinkTests.swift index d3fc578..da03c71 100644 --- a/TunnelKitTests/LinkTests.swift +++ b/TunnelKitTests/LinkTests.swift @@ -1,6 +1,6 @@ // // LinkTests.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 07/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitTests/RandomTests.swift b/TunnelKitTests/RandomTests.swift index f2986e6..992b9b5 100644 --- a/TunnelKitTests/RandomTests.swift +++ b/TunnelKitTests/RandomTests.swift @@ -1,6 +1,6 @@ // // RandomTests.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 07/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitTests/RawPerformanceTests.swift b/TunnelKitTests/RawPerformanceTests.swift index 8a397e9..5187f41 100644 --- a/TunnelKitTests/RawPerformanceTests.swift +++ b/TunnelKitTests/RawPerformanceTests.swift @@ -1,6 +1,6 @@ // // RawPerformanceTests.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 07/07/2018. // Copyright © 2018 London Trust Media. All rights reserved. diff --git a/TunnelKitTests/TestUtils.swift b/TunnelKitTests/TestUtils.swift index 9e75756..b0fcbfa 100644 --- a/TunnelKitTests/TestUtils.swift +++ b/TunnelKitTests/TestUtils.swift @@ -1,6 +1,6 @@ // // TestUtils.swift -// PIATunnelTests +// TunnelKitTests // // Created by Davide De Rosa on 07/07/2018. // Copyright © 2018 London Trust Media. All rights reserved.