1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
7 import "crypto/internal/boring"
22 "golang.org/x/crypto/chacha20poly1305"
25 // CipherSuite is a TLS cipher suite. Note that most functions in this package
26 // accept and expose cipher suite IDs instead of this type.
27 type CipherSuite struct {
31 // Supported versions is the list of TLS protocol versions that can
32 // negotiate this cipher suite.
33 SupportedVersions []uint16
35 // Insecure is true if the cipher suite has known security issues
36 // due to its primitives, design, or implementation.
41 supportedUpToTLS12 = []uint16{VersionTLS10, VersionTLS11, VersionTLS12}
42 supportedOnlyTLS12 = []uint16{VersionTLS12}
43 supportedOnlyTLS13 = []uint16{VersionTLS13}
46 // CipherSuites returns a list of cipher suites currently implemented by this
47 // package, excluding those with security issues, which are returned by
48 // InsecureCipherSuites.
50 // The list is sorted by ID. Note that the default cipher suites selected by
51 // this package might depend on logic that can't be captured by a static list.
52 func CipherSuites() []*CipherSuite {
53 return []*CipherSuite{
54 {TLS_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", supportedUpToTLS12, false},
55 {TLS_RSA_WITH_AES_128_CBC_SHA, "TLS_RSA_WITH_AES_128_CBC_SHA", supportedUpToTLS12, false},
56 {TLS_RSA_WITH_AES_256_CBC_SHA, "TLS_RSA_WITH_AES_256_CBC_SHA", supportedUpToTLS12, false},
57 {TLS_RSA_WITH_AES_128_GCM_SHA256, "TLS_RSA_WITH_AES_128_GCM_SHA256", supportedOnlyTLS12, false},
58 {TLS_RSA_WITH_AES_256_GCM_SHA384, "TLS_RSA_WITH_AES_256_GCM_SHA384", supportedOnlyTLS12, false},
60 {TLS_AES_128_GCM_SHA256, "TLS_AES_128_GCM_SHA256", supportedOnlyTLS13, false},
61 {TLS_AES_256_GCM_SHA384, "TLS_AES_256_GCM_SHA384", supportedOnlyTLS13, false},
62 {TLS_CHACHA20_POLY1305_SHA256, "TLS_CHACHA20_POLY1305_SHA256", supportedOnlyTLS13, false},
64 {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", supportedUpToTLS12, false},
65 {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", supportedUpToTLS12, false},
66 {TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", supportedUpToTLS12, false},
67 {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", supportedUpToTLS12, false},
68 {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", supportedUpToTLS12, false},
69 {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", supportedOnlyTLS12, false},
70 {TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", supportedOnlyTLS12, false},
71 {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", supportedOnlyTLS12, false},
72 {TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", supportedOnlyTLS12, false},
73 {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", supportedOnlyTLS12, false},
74 {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256", supportedOnlyTLS12, false},
78 // InsecureCipherSuites returns a list of cipher suites currently implemented by
79 // this package and which have security issues.
81 // Most applications should not use the cipher suites in this list, and should
82 // only use those returned by CipherSuites.
83 func InsecureCipherSuites() []*CipherSuite {
84 // RC4 suites are broken because RC4 is.
85 // CBC-SHA256 suites have no Lucky13 countermeasures.
86 return []*CipherSuite{
87 {TLS_RSA_WITH_RC4_128_SHA, "TLS_RSA_WITH_RC4_128_SHA", supportedUpToTLS12, true},
88 {TLS_RSA_WITH_AES_128_CBC_SHA256, "TLS_RSA_WITH_AES_128_CBC_SHA256", supportedOnlyTLS12, true},
89 {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", supportedUpToTLS12, true},
90 {TLS_ECDHE_RSA_WITH_RC4_128_SHA, "TLS_ECDHE_RSA_WITH_RC4_128_SHA", supportedUpToTLS12, true},
91 {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", supportedOnlyTLS12, true},
92 {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", supportedOnlyTLS12, true},
96 // CipherSuiteName returns the standard name for the passed cipher suite ID
97 // (e.g. "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"), or a fallback representation
98 // of the ID value if the cipher suite is not implemented by this package.
99 func CipherSuiteName(id uint16) string {
100 for _, c := range CipherSuites() {
105 for _, c := range InsecureCipherSuites() {
110 return fmt.Sprintf("0x%04X", id)
113 // a keyAgreement implements the client and server side of a TLS key agreement
114 // protocol by generating and processing key exchange messages.
115 type keyAgreement interface {
116 // On the server side, the first two methods are called in order.
118 // In the case that the key agreement protocol doesn't use a
119 // ServerKeyExchange message, generateServerKeyExchange can return nil,
121 generateServerKeyExchange(*Config, *Certificate, *clientHelloMsg, *serverHelloMsg) (*serverKeyExchangeMsg, error)
122 processClientKeyExchange(*Config, *Certificate, *clientKeyExchangeMsg, uint16) ([]byte, error)
124 // On the client side, the next two methods are called in order.
126 // This method may not be called if the server doesn't send a
127 // ServerKeyExchange message.
128 processServerKeyExchange(*Config, *clientHelloMsg, *serverHelloMsg, *x509.Certificate, *serverKeyExchangeMsg) error
129 generateClientKeyExchange(*Config, *clientHelloMsg, *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error)
133 // suiteECDHE indicates that the cipher suite involves elliptic curve
134 // Diffie-Hellman. This means that it should only be selected when the
135 // client indicates that it supports ECC with a curve and point format
136 // that we're happy with.
137 suiteECDHE = 1 << iota
138 // suiteECSign indicates that the cipher suite involves an ECDSA or
139 // EdDSA signature and therefore may only be selected when the server's
140 // certificate is ECDSA or EdDSA. If this is not set then the cipher suite
143 // suiteTLS12 indicates that the cipher suite should only be advertised
144 // and accepted when using TLS 1.2.
146 // suiteSHA384 indicates that the cipher suite uses SHA384 as the
149 // suiteDefaultOff indicates that this cipher suite is not included by
154 // A cipherSuite is a specific combination of key agreement, cipher and MAC function.
155 type cipherSuite struct {
157 // the lengths, in bytes, of the key material needed for each component.
161 ka func(version uint16) keyAgreement
162 // flags is a bitmask of the suite* values, above.
164 cipher func(key, iv []byte, isRead bool) interface{}
165 mac func(version uint16, macKey []byte) macFunction
166 aead func(key, fixedNonce []byte) aead
169 var cipherSuites = []*cipherSuite{
170 // Ciphersuite order is chosen so that ECDHE comes before plain RSA and
171 // AEADs are the top preference.
172 {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305, 32, 0, 12, ecdheRSAKA, suiteECDHE | suiteTLS12, nil, nil, aeadChaCha20Poly1305},
173 {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305, 32, 0, 12, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12, nil, nil, aeadChaCha20Poly1305},
174 {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12, nil, nil, aeadAESGCM},
175 {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12, nil, nil, aeadAESGCM},
176 {TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM},
177 {TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM},
178 {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, ecdheRSAKA, suiteECDHE | suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil},
179 {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil},
180 {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil},
181 {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECSign, cipherAES, macSHA1, nil},
182 {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil},
183 {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECSign, cipherAES, macSHA1, nil},
184 {TLS_RSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, rsaKA, suiteTLS12, nil, nil, aeadAESGCM},
185 {TLS_RSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, rsaKA, suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM},
186 {TLS_RSA_WITH_AES_128_CBC_SHA256, 16, 32, 16, rsaKA, suiteTLS12 | suiteDefaultOff, cipherAES, macSHA256, nil},
187 {TLS_RSA_WITH_AES_128_CBC_SHA, 16, 20, 16, rsaKA, 0, cipherAES, macSHA1, nil},
188 {TLS_RSA_WITH_AES_256_CBC_SHA, 32, 20, 16, rsaKA, 0, cipherAES, macSHA1, nil},
189 {TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, 24, 20, 8, ecdheRSAKA, suiteECDHE, cipher3DES, macSHA1, nil},
190 {TLS_RSA_WITH_3DES_EDE_CBC_SHA, 24, 20, 8, rsaKA, 0, cipher3DES, macSHA1, nil},
192 // RC4-based cipher suites are disabled by default.
193 {TLS_RSA_WITH_RC4_128_SHA, 16, 20, 0, rsaKA, suiteDefaultOff, cipherRC4, macSHA1, nil},
194 {TLS_ECDHE_RSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheRSAKA, suiteECDHE | suiteDefaultOff, cipherRC4, macSHA1, nil},
195 {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheECDSAKA, suiteECDHE | suiteECSign | suiteDefaultOff, cipherRC4, macSHA1, nil},
198 // selectCipherSuite returns the first cipher suite from ids which is also in
199 // supportedIDs and passes the ok filter.
200 func selectCipherSuite(ids, supportedIDs []uint16, ok func(*cipherSuite) bool) *cipherSuite {
201 for _, id := range ids {
202 candidate := cipherSuiteByID(id)
203 if candidate == nil || !ok(candidate) {
207 for _, suppID := range supportedIDs {
216 // A cipherSuiteTLS13 defines only the pair of the AEAD algorithm and hash
217 // algorithm to be used with HKDF. See RFC 8446, Appendix B.4.
218 type cipherSuiteTLS13 struct {
221 aead func(key, fixedNonce []byte) aead
225 var cipherSuitesTLS13 = []*cipherSuiteTLS13{
226 {TLS_AES_128_GCM_SHA256, 16, aeadAESGCMTLS13, crypto.SHA256},
227 {TLS_CHACHA20_POLY1305_SHA256, 32, aeadChaCha20Poly1305, crypto.SHA256},
228 {TLS_AES_256_GCM_SHA384, 32, aeadAESGCMTLS13, crypto.SHA384},
231 func cipherRC4(key, iv []byte, isRead bool) interface{} {
232 cipher, _ := rc4.NewCipher(key)
236 func cipher3DES(key, iv []byte, isRead bool) interface{} {
237 block, _ := des.NewTripleDESCipher(key)
239 return cipher.NewCBCDecrypter(block, iv)
241 return cipher.NewCBCEncrypter(block, iv)
244 func cipherAES(key, iv []byte, isRead bool) interface{} {
245 block, _ := aes.NewCipher(key)
247 return cipher.NewCBCDecrypter(block, iv)
249 return cipher.NewCBCEncrypter(block, iv)
252 // macSHA1 returns a macFunction for the given protocol version.
253 func macSHA1(version uint16, key []byte) macFunction {
255 // The BoringCrypto SHA1 does not have a constant-time
256 // checksum function, so don't try to use it.
258 h = newConstantTimeHash(h)
260 return tls10MAC{h: hmac.New(h, key)}
263 // macSHA256 returns a SHA-256 based MAC. These are only supported in TLS 1.2
264 // so the given version is ignored.
265 func macSHA256(version uint16, key []byte) macFunction {
266 return tls10MAC{h: hmac.New(sha256.New, key)}
269 type macFunction interface {
270 // Size returns the length of the MAC.
272 // MAC appends the MAC of (seq, header, data) to out. The extra data is fed
273 // into the MAC after obtaining the result to normalize timing. The result
274 // is only valid until the next invocation of MAC as the buffer is reused.
275 MAC(seq, header, data, extra []byte) []byte
278 type aead interface {
281 // explicitNonceLen returns the number of bytes of explicit nonce
282 // included in each record. This is eight for older AEADs and
283 // zero for modern ones.
284 explicitNonceLen() int
289 noncePrefixLength = 4
292 // prefixNonceAEAD wraps an AEAD and prefixes a fixed portion of the nonce to
294 type prefixNonceAEAD struct {
295 // nonce contains the fixed part of the nonce in the first four bytes.
296 nonce [aeadNonceLength]byte
300 func (f *prefixNonceAEAD) NonceSize() int { return aeadNonceLength - noncePrefixLength }
301 func (f *prefixNonceAEAD) Overhead() int { return f.aead.Overhead() }
302 func (f *prefixNonceAEAD) explicitNonceLen() int { return f.NonceSize() }
304 func (f *prefixNonceAEAD) Seal(out, nonce, plaintext, additionalData []byte) []byte {
305 copy(f.nonce[4:], nonce)
306 return f.aead.Seal(out, f.nonce[:], plaintext, additionalData)
309 func (f *prefixNonceAEAD) Open(out, nonce, ciphertext, additionalData []byte) ([]byte, error) {
310 copy(f.nonce[4:], nonce)
311 return f.aead.Open(out, f.nonce[:], ciphertext, additionalData)
314 // xoredNonceAEAD wraps an AEAD by XORing in a fixed pattern to the nonce
316 type xorNonceAEAD struct {
317 nonceMask [aeadNonceLength]byte
321 func (f *xorNonceAEAD) NonceSize() int { return 8 } // 64-bit sequence number
322 func (f *xorNonceAEAD) Overhead() int { return f.aead.Overhead() }
323 func (f *xorNonceAEAD) explicitNonceLen() int { return 0 }
325 func (f *xorNonceAEAD) Seal(out, nonce, plaintext, additionalData []byte) []byte {
326 for i, b := range nonce {
327 f.nonceMask[4+i] ^= b
329 result := f.aead.Seal(out, f.nonceMask[:], plaintext, additionalData)
330 for i, b := range nonce {
331 f.nonceMask[4+i] ^= b
337 func (f *xorNonceAEAD) Open(out, nonce, ciphertext, additionalData []byte) ([]byte, error) {
338 for i, b := range nonce {
339 f.nonceMask[4+i] ^= b
341 result, err := f.aead.Open(out, f.nonceMask[:], ciphertext, additionalData)
342 for i, b := range nonce {
343 f.nonceMask[4+i] ^= b
349 type gcmtls interface {
350 NewGCMTLS() (cipher.AEAD, error)
353 func aeadAESGCM(key, noncePrefix []byte) aead {
354 if len(noncePrefix) != noncePrefixLength {
355 panic("tls: internal error: wrong nonce length")
357 aes, err := aes.NewCipher(key)
362 if aesTLS, ok := aes.(gcmtls); ok {
363 aead, err = aesTLS.NewGCMTLS()
366 aead, err = cipher.NewGCM(aes)
372 ret := &prefixNonceAEAD{aead: aead}
373 copy(ret.nonce[:], noncePrefix)
377 func aeadAESGCMTLS13(key, nonceMask []byte) aead {
378 if len(nonceMask) != aeadNonceLength {
379 panic("tls: internal error: wrong nonce length")
381 aes, err := aes.NewCipher(key)
385 aead, err := cipher.NewGCM(aes)
390 ret := &xorNonceAEAD{aead: aead}
391 copy(ret.nonceMask[:], nonceMask)
395 func aeadChaCha20Poly1305(key, nonceMask []byte) aead {
396 if len(nonceMask) != aeadNonceLength {
397 panic("tls: internal error: wrong nonce length")
399 aead, err := chacha20poly1305.New(key)
404 ret := &xorNonceAEAD{aead: aead}
405 copy(ret.nonceMask[:], nonceMask)
409 type constantTimeHash interface {
411 ConstantTimeSum(b []byte) []byte
414 // cthWrapper wraps any hash.Hash that implements ConstantTimeSum, and replaces
415 // with that all calls to Sum. It's used to obtain a ConstantTimeSum-based HMAC.
416 type cthWrapper struct {
420 func (c *cthWrapper) Size() int { return c.h.Size() }
421 func (c *cthWrapper) BlockSize() int { return c.h.BlockSize() }
422 func (c *cthWrapper) Reset() { c.h.Reset() }
423 func (c *cthWrapper) Write(p []byte) (int, error) { return c.h.Write(p) }
424 func (c *cthWrapper) Sum(b []byte) []byte { return c.h.ConstantTimeSum(b) }
426 func newConstantTimeHash(h func() hash.Hash) func() hash.Hash {
428 return func() hash.Hash {
429 return &cthWrapper{h().(constantTimeHash)}
433 // tls10MAC implements the TLS 1.0 MAC function. RFC 2246, Section 6.2.3.
434 type tls10MAC struct {
439 func (s tls10MAC) Size() int {
443 // MAC is guaranteed to take constant time, as long as
444 // len(seq)+len(header)+len(data)+len(extra) is constant. extra is not fed into
445 // the MAC, but is only provided to make the timing profile constant.
446 func (s tls10MAC) MAC(seq, header, data, extra []byte) []byte {
451 res := s.h.Sum(s.buf[:0])
458 func rsaKA(version uint16) keyAgreement {
459 return rsaKeyAgreement{}
462 func ecdheECDSAKA(version uint16) keyAgreement {
463 return &ecdheKeyAgreement{
469 func ecdheRSAKA(version uint16) keyAgreement {
470 return &ecdheKeyAgreement{
476 // mutualCipherSuite returns a cipherSuite given a list of supported
477 // ciphersuites and the id requested by the peer.
478 func mutualCipherSuite(have []uint16, want uint16) *cipherSuite {
479 for _, id := range have {
481 return cipherSuiteByID(id)
487 func cipherSuiteByID(id uint16) *cipherSuite {
488 for _, cipherSuite := range cipherSuites {
489 if cipherSuite.id == id {
496 func mutualCipherSuiteTLS13(have []uint16, want uint16) *cipherSuiteTLS13 {
497 for _, id := range have {
499 return cipherSuiteTLS13ByID(id)
505 func cipherSuiteTLS13ByID(id uint16) *cipherSuiteTLS13 {
506 for _, cipherSuite := range cipherSuitesTLS13 {
507 if cipherSuite.id == id {
514 // A list of cipher suite IDs that are, or have been, implemented by this
517 // See https://www.iana.org/assignments/tls-parameters/tls-parameters.xml
519 // TLS 1.0 - 1.2 cipher suites.
520 TLS_RSA_WITH_RC4_128_SHA uint16 = 0x0005
521 TLS_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x000a
522 TLS_RSA_WITH_AES_128_CBC_SHA uint16 = 0x002f
523 TLS_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0035
524 TLS_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0x003c
525 TLS_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0x009c
526 TLS_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0x009d
527 TLS_ECDHE_ECDSA_WITH_RC4_128_SHA uint16 = 0xc007
528 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xc009
529 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xc00a
530 TLS_ECDHE_RSA_WITH_RC4_128_SHA uint16 = 0xc011
531 TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xc012
532 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0xc013
533 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0xc014
534 TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc023
535 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 uint16 = 0xc027
536 TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02f
537 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02b
538 TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc030
539 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc02c
540 TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xcca8
541 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 uint16 = 0xcca9
543 // TLS 1.3 cipher suites.
544 TLS_AES_128_GCM_SHA256 uint16 = 0x1301
545 TLS_AES_256_GCM_SHA384 uint16 = 0x1302
546 TLS_CHACHA20_POLY1305_SHA256 uint16 = 0x1303
548 // TLS_FALLBACK_SCSV isn't a standard cipher suite but an indicator
549 // that the client is doing version fallback. See RFC 7507.
550 TLS_FALLBACK_SCSV uint16 = 0x5600
552 // Legacy names for the corresponding cipher suites with the correct _SHA256
553 // suffix, retained for backward compatibility.
554 TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 = TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
555 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 = TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256