update validation of version negotiation

The negotiated_version parameter was recently moved from the
client_hello TLS handshake message to the encrypted_extensions.
This commit is contained in:
Marten Seemann
2017-12-05 10:04:44 +07:00
parent ccd91a36b7
commit 7c8715616e
5 changed files with 40 additions and 33 deletions

View File

@@ -45,9 +45,8 @@ func (h *extensionHandlerClient) Send(hType mint.HandshakeType, el *mint.Extensi
}
data, err := syntax.Marshal(clientHelloTransportParameters{
NegotiatedVersion: uint32(h.version),
InitialVersion: uint32(h.initialVersion),
Parameters: h.params.getTransportParameters(),
InitialVersion: uint32(h.initialVersion),
Parameters: h.params.getTransportParameters(),
})
if err != nil {
return err
@@ -84,6 +83,10 @@ func (h *extensionHandlerClient) Receive(hType mint.HandshakeType, el *mint.Exte
for i, v := range eetp.SupportedVersions {
serverSupportedVersions[i] = protocol.VersionNumber(v)
}
// check that the negotiated_version is the current version
if protocol.VersionNumber(eetp.NegotiatedVersion) != h.version {
return qerr.Error(qerr.VersionNegotiationMismatch, "current version doesn't match negotiated_version")
}
// check that the current version is included in the supported versions
if !protocol.IsSupportedVersion(serverSupportedVersions, h.version) {
return qerr.Error(qerr.VersionNegotiationMismatch, "current version not included in the supported versions")