Send extension indicating the TLS 1.3 draft version in Go.

Change-Id: I92425d7c72111623ddfbe8391f2d2fa88f101ef3
Reviewed-on: https://boringssl-review.googlesource.com/8818
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Nick Harper 2016-07-17 10:53:26 +02:00 committed by CQ bot account: commit-bot@chromium.org
parent 13f1ebe827
commit 4d90c1067c
2 changed files with 10 additions and 0 deletions

View File

@ -26,6 +26,10 @@ const (
VersionTLS13 = 0x0304 VersionTLS13 = 0x0304
) )
// The draft version of TLS 1.3 that is implemented here and sent in the draft
// indicator extension.
const tls13DraftVersion = 13
const ( const (
maxPlaintext = 16384 // maximum plaintext payload length maxPlaintext = 16384 // maximum plaintext payload length
maxCiphertext = 16384 + 2048 // maximum ciphertext payload length maxCiphertext = 16384 + 2048 // maximum ciphertext payload length
@ -92,6 +96,7 @@ const (
extensionCustom uint16 = 1234 // not IANA assigned extensionCustom uint16 = 1234 // not IANA assigned
extensionNextProtoNeg uint16 = 13172 // not IANA assigned extensionNextProtoNeg uint16 = 13172 // not IANA assigned
extensionRenegotiationInfo uint16 = 0xff01 extensionRenegotiationInfo uint16 = 0xff01
extensionTLS13Draft uint16 = 0xff02
extensionChannelID uint16 = 30032 // not IANA assigned extensionChannelID uint16 = 30032 // not IANA assigned
) )

View File

@ -379,6 +379,11 @@ func (m *clientHelloMsg) marshal() []byte {
customExt := extensions.addU16LengthPrefixed() customExt := extensions.addU16LengthPrefixed()
customExt.addBytes([]byte(m.customExtension)) customExt.addBytes([]byte(m.customExtension))
} }
if m.vers == VersionTLS13 {
extensions.addU16(extensionTLS13Draft)
extValue := extensions.addU16LengthPrefixed()
extValue.addU16(tls13DraftVersion)
}
if extensions.len() == 0 { if extensions.len() == 0 {
hello.discardChild() hello.discardChild()