Fix malformed key generation message

Make nullTerminated argument explicit, easier to debug.

Fixes #67
This commit is contained in:
Davide De Rosa 2019-04-13 23:31:26 +02:00
parent 0a956f5b9f
commit 322242de5c
4 changed files with 8 additions and 4 deletions

View File

@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Make `hostname` optional and pick `resolvedAddresses` if nil. - Make `hostname` optional and pick `resolvedAddresses` if nil.
### Fixed
- Negotiation times out with SoftEther. [#67](https://github.com/keeshux/tunnelkit/issues/67)
## 1.6.1 (2019-04-07) ## 1.6.1 (2019-04-07)
### Fixed ### Fixed

View File

@ -94,7 +94,7 @@ extension SessionProxy {
raw.append(random1) raw.append(random1)
raw.append(random2) raw.append(random2)
// opts // opts (empty string)
raw.appendSized(Z(UInt8(0))) raw.appendSized(Z(UInt8(0)))
// credentials // credentials
@ -107,7 +107,7 @@ extension SessionProxy {
} }
// peer info // peer info
raw.appendSized(Z(CoreConfiguration.peerInfo)) raw.appendSized(Z(CoreConfiguration.peerInfo, nullTerminated: true))
if CoreConfiguration.logsSensitiveData { if CoreConfiguration.logsSensitiveData {
log.debug("TLS.auth: Put plaintext (\(raw.count) bytes): \(raw.toHex())") log.debug("TLS.auth: Put plaintext (\(raw.count) bytes): \(raw.toHex())")

View File

@ -71,7 +71,7 @@ extension SessionProxy {
_ serverSessionId: Data?, _ serverSessionId: Data?,
_ size: Int) throws -> ZeroingData { _ size: Int) throws -> ZeroingData {
let seed = Z(label) let seed = Z(label, nullTerminated: false)
seed.append(clientSeed) seed.append(clientSeed)
seed.append(serverSeed) seed.append(serverSeed)
if let csi = clientSessionId { if let csi = clientSessionId {

View File

@ -66,6 +66,6 @@ func Z(_ data: Data) -> ZeroingData {
// return ZeroingData(data: data, offset: offset, count: count) // return ZeroingData(data: data, offset: offset, count: count)
//} //}
func Z(_ string: String, nullTerminated: Bool = false) -> ZeroingData { func Z(_ string: String, nullTerminated: Bool) -> ZeroingData {
return ZeroingData(string: string, nullTerminated: nullTerminated) return ZeroingData(string: string, nullTerminated: nullTerminated)
} }