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 <davidben@google.com>
diff --git a/ssl/test/runner/common.go b/ssl/test/runner/common.go
index 95c5461..3db5d77 100644
--- a/ssl/test/runner/common.go
+++ b/ssl/test/runner/common.go
@@ -49,21 +49,21 @@
// 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 8244a4c..6c127e6 100644
--- a/ssl/test/runner/conn.go
+++ b/ssl/test/runner/conn.go
@@ -1107,8 +1107,8 @@
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 8255872..95304d7 100644
--- a/ssl/test/runner/handshake_client.go
+++ b/ssl/test/runner/handshake_client.go
@@ -880,7 +880,7 @@
}
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 @@
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 9637e9a..907ae9c 100644
--- a/ssl/test/runner/handshake_messages.go
+++ b/ssl/test/runner/handshake_messages.go
@@ -1641,12 +1641,12 @@
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 @@
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 @@
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 d10c72b..2d9db44 100644
--- a/ssl/test/runner/handshake_server.go
+++ b/ssl/test/runner/handshake_server.go
@@ -793,15 +793,15 @@
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 @@
}
c.channelID = channelID
- hs.writeClientHash(encryptedExtensions.marshal())
+ hs.writeClientHash(channelIDMsg.marshal())
}
msg, err := c.readHandshake()