move all dependencies on qtls to a separate package

This commit is contained in:
Marten Seemann
2020-08-13 10:23:33 +07:00
parent 524da2213c
commit 977dbc828c
29 changed files with 572 additions and 478 deletions

View File

@@ -3,12 +3,13 @@ package handshake
import (
"crypto/aes"
"crypto/cipher"
"crypto/tls"
"encoding/binary"
"fmt"
"golang.org/x/crypto/chacha20"
"github.com/marten-seemann/qtls"
"github.com/lucas-clemente/quic-go/internal/qtls"
)
type headerProtector interface {
@@ -18,9 +19,9 @@ type headerProtector interface {
func newHeaderProtector(suite *qtls.CipherSuiteTLS13, trafficSecret []byte, isLongHeader bool) headerProtector {
switch suite.ID {
case qtls.TLS_AES_128_GCM_SHA256, qtls.TLS_AES_256_GCM_SHA384:
case tls.TLS_AES_128_GCM_SHA256, tls.TLS_AES_256_GCM_SHA384:
return newAESHeaderProtector(suite, trafficSecret, isLongHeader)
case qtls.TLS_CHACHA20_POLY1305_SHA256:
case tls.TLS_CHACHA20_POLY1305_SHA256:
return newChaChaHeaderProtector(suite, trafficSecret, isLongHeader)
default:
panic(fmt.Sprintf("Invalid cipher suite id: %d", suite.ID))