From 24599a89c0a94676ff86b42e8b9465a479ccfd1e Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 30 Jun 2016 18:56:53 -0400 Subject: [PATCH] Rename EncryptedExtensions in Go in preparation for TLS 1.3. TLS 1.3 defines its own EncryptedExtensions message. The existing one is for Channel ID which probably should not have tried to generalize itself. Change-Id: I4f48bece98510eb54e64fbf3df6c2a7332bc0261 Reviewed-on: https://boringssl-review.googlesource.com/8566 Reviewed-by: David Benjamin --- ssl/test/runner/common.go | 30 +++++++++++++-------------- ssl/test/runner/conn.go | 4 ++-- ssl/test/runner/handshake_client.go | 10 ++++----- ssl/test/runner/handshake_messages.go | 8 +++---- ssl/test/runner/handshake_server.go | 14 ++++++------- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ssl/test/runner/common.go b/ssl/test/runner/common.go index 95c54619..3db5d771 100644 --- a/ssl/test/runner/common.go +++ b/ssl/test/runner/common.go @@ -49,21 +49,21 @@ const ( // TLS handshake message types. const ( - typeHelloRequest uint8 = 0 - typeClientHello uint8 = 1 - typeServerHello uint8 = 2 - typeHelloVerifyRequest uint8 = 3 - typeNewSessionTicket uint8 = 4 - typeCertificate uint8 = 11 - typeServerKeyExchange uint8 = 12 - typeCertificateRequest uint8 = 13 - typeServerHelloDone uint8 = 14 - typeCertificateVerify uint8 = 15 - typeClientKeyExchange uint8 = 16 - typeFinished uint8 = 20 - typeCertificateStatus uint8 = 22 - typeNextProtocol uint8 = 67 // Not IANA assigned - typeEncryptedExtensions uint8 = 203 // Not IANA assigned + typeHelloRequest uint8 = 0 + typeClientHello uint8 = 1 + typeServerHello uint8 = 2 + typeHelloVerifyRequest uint8 = 3 + typeNewSessionTicket uint8 = 4 + typeCertificate uint8 = 11 + typeServerKeyExchange uint8 = 12 + typeCertificateRequest uint8 = 13 + typeServerHelloDone uint8 = 14 + typeCertificateVerify uint8 = 15 + typeClientKeyExchange uint8 = 16 + typeFinished uint8 = 20 + typeCertificateStatus uint8 = 22 + typeNextProtocol uint8 = 67 // Not IANA assigned + typeChannelID uint8 = 203 // Not IANA assigned ) // TLS compression types. diff --git a/ssl/test/runner/conn.go b/ssl/test/runner/conn.go index 8244a4c1..6c127e6a 100644 --- a/ssl/test/runner/conn.go +++ b/ssl/test/runner/conn.go @@ -1107,8 +1107,8 @@ func (c *Conn) readHandshake() (interface{}, error) { m = new(finishedMsg) case typeHelloVerifyRequest: m = new(helloVerifyRequestMsg) - case typeEncryptedExtensions: - m = new(encryptedExtensionsMsg) + case typeChannelID: + m = new(channelIDMsg) default: return nil, c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) } diff --git a/ssl/test/runner/handshake_client.go b/ssl/test/runner/handshake_client.go index 82558722..95304d70 100644 --- a/ssl/test/runner/handshake_client.go +++ b/ssl/test/runner/handshake_client.go @@ -880,7 +880,7 @@ func (hs *clientHandshakeState) sendFinished(out []byte, isResume bool) error { } if hs.serverHello.channelIDRequested { - encryptedExtensions := new(encryptedExtensionsMsg) + channelIDMsg := new(channelIDMsg) if c.config.ChannelID.Curve != elliptic.P256() { return fmt.Errorf("tls: Channel ID is not on P-256.") } @@ -897,14 +897,14 @@ func (hs *clientHandshakeState) sendFinished(out []byte, isResume bool) error { writeIntPadded(channelID[32:64], c.config.ChannelID.Y) writeIntPadded(channelID[64:96], r) writeIntPadded(channelID[96:128], s) - encryptedExtensions.channelID = channelID + channelIDMsg.channelID = channelID c.channelID = &c.config.ChannelID.PublicKey - encryptedExtensionsBytes := encryptedExtensions.marshal() - hs.writeHash(encryptedExtensionsBytes, seqno) + channelIDMsgBytes := channelIDMsg.marshal() + hs.writeHash(channelIDMsgBytes, seqno) seqno++ - postCCSBytes = append(postCCSBytes, encryptedExtensionsBytes...) + postCCSBytes = append(postCCSBytes, channelIDMsgBytes...) } finished := new(finishedMsg) diff --git a/ssl/test/runner/handshake_messages.go b/ssl/test/runner/handshake_messages.go index 9637e9a0..907ae9cb 100644 --- a/ssl/test/runner/handshake_messages.go +++ b/ssl/test/runner/handshake_messages.go @@ -1641,12 +1641,12 @@ func (m *helloVerifyRequestMsg) unmarshal(data []byte) bool { return true } -type encryptedExtensionsMsg struct { +type channelIDMsg struct { raw []byte channelID []byte } -func (m *encryptedExtensionsMsg) marshal() []byte { +func (m *channelIDMsg) marshal() []byte { if m.raw != nil { return m.raw } @@ -1654,7 +1654,7 @@ func (m *encryptedExtensionsMsg) marshal() []byte { length := 2 + 2 + len(m.channelID) x := make([]byte, 4+length) - x[0] = typeEncryptedExtensions + x[0] = typeChannelID x[1] = uint8(length >> 16) x[2] = uint8(length >> 8) x[3] = uint8(length) @@ -1667,7 +1667,7 @@ func (m *encryptedExtensionsMsg) marshal() []byte { return x } -func (m *encryptedExtensionsMsg) unmarshal(data []byte) bool { +func (m *channelIDMsg) unmarshal(data []byte) bool { if len(data) != 4+2+2+128 { return false } diff --git a/ssl/test/runner/handshake_server.go b/ssl/test/runner/handshake_server.go index d10c72ba..2d9db44d 100644 --- a/ssl/test/runner/handshake_server.go +++ b/ssl/test/runner/handshake_server.go @@ -793,15 +793,15 @@ func (hs *serverHandshakeState) readFinished(out []byte, isResume bool) error { if err != nil { return err } - encryptedExtensions, ok := msg.(*encryptedExtensionsMsg) + channelIDMsg, ok := msg.(*channelIDMsg) if !ok { c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(encryptedExtensions, msg) + return unexpectedMessageError(channelIDMsg, msg) } - x := new(big.Int).SetBytes(encryptedExtensions.channelID[0:32]) - y := new(big.Int).SetBytes(encryptedExtensions.channelID[32:64]) - r := new(big.Int).SetBytes(encryptedExtensions.channelID[64:96]) - s := new(big.Int).SetBytes(encryptedExtensions.channelID[96:128]) + x := new(big.Int).SetBytes(channelIDMsg.channelID[0:32]) + y := new(big.Int).SetBytes(channelIDMsg.channelID[32:64]) + r := new(big.Int).SetBytes(channelIDMsg.channelID[64:96]) + s := new(big.Int).SetBytes(channelIDMsg.channelID[96:128]) if !elliptic.P256().IsOnCurve(x, y) { return errors.New("tls: invalid channel ID public key") } @@ -815,7 +815,7 @@ func (hs *serverHandshakeState) readFinished(out []byte, isResume bool) error { } c.channelID = channelID - hs.writeClientHash(encryptedExtensions.marshal()) + hs.writeClientHash(channelIDMsg.marshal()) } msg, err := c.readHandshake()