diff --git a/internal/handshake/aead_test.go b/internal/handshake/aead_test.go index 0149045d..ef6a813c 100644 --- a/internal/handshake/aead_test.go +++ b/internal/handshake/aead_test.go @@ -7,6 +7,7 @@ import ( "fmt" "github.com/lucas-clemente/quic-go/internal/protocol" + "github.com/marten-seemann/qtls" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -16,7 +17,7 @@ var _ = Describe("Long Header AEAD", func() { for i := range cipherSuites { cs := cipherSuites[i] - Context(fmt.Sprintf("using %s", cipherSuiteName(cs.ID)), func() { + Context(fmt.Sprintf("using %s", qtls.CipherSuiteName(cs.ID)), func() { getSealerAndOpener := func() (LongHeaderSealer, LongHeaderOpener) { key := make([]byte, 16) hpKey := make([]byte, 16) diff --git a/internal/handshake/crypto_setup.go b/internal/handshake/crypto_setup.go index e22df8c8..28ab87b4 100644 --- a/internal/handshake/crypto_setup.go +++ b/internal/handshake/crypto_setup.go @@ -562,7 +562,7 @@ func (h *cryptoSetup) SetReadKey(encLevel qtls.EncryptionLevel, suite *qtls.Ciph newHeaderProtector(suite, trafficSecret, true), ) h.mutex.Unlock() - h.logger.Debugf("Installed 0-RTT Read keys (using %s)", cipherSuiteName(suite.ID)) + h.logger.Debugf("Installed 0-RTT Read keys (using %s)", qtls.CipherSuiteName(suite.ID)) return case qtls.EncryptionHandshake: h.readEncLevel = protocol.EncryptionHandshake @@ -572,12 +572,12 @@ func (h *cryptoSetup) SetReadKey(encLevel qtls.EncryptionLevel, suite *qtls.Ciph h.dropInitialKeys, h.perspective, ) - h.logger.Debugf("Installed Handshake Read keys (using %s)", cipherSuiteName(suite.ID)) + h.logger.Debugf("Installed Handshake Read keys (using %s)", qtls.CipherSuiteName(suite.ID)) case qtls.EncryptionApplication: h.readEncLevel = protocol.Encryption1RTT h.aead.SetReadKey(suite, trafficSecret) h.has1RTTOpener = true - h.logger.Debugf("Installed 1-RTT Read keys (using %s)", cipherSuiteName(suite.ID)) + h.logger.Debugf("Installed 1-RTT Read keys (using %s)", qtls.CipherSuiteName(suite.ID)) default: panic("unexpected read encryption level") } @@ -597,7 +597,7 @@ func (h *cryptoSetup) SetWriteKey(encLevel qtls.EncryptionLevel, suite *qtls.Cip newHeaderProtector(suite, trafficSecret, true), ) h.mutex.Unlock() - h.logger.Debugf("Installed 0-RTT Write keys (using %s)", cipherSuiteName(suite.ID)) + h.logger.Debugf("Installed 0-RTT Write keys (using %s)", qtls.CipherSuiteName(suite.ID)) return case qtls.EncryptionHandshake: h.writeEncLevel = protocol.EncryptionHandshake @@ -607,12 +607,12 @@ func (h *cryptoSetup) SetWriteKey(encLevel qtls.EncryptionLevel, suite *qtls.Cip h.dropInitialKeys, h.perspective, ) - h.logger.Debugf("Installed Handshake Write keys (using %s)", cipherSuiteName(suite.ID)) + h.logger.Debugf("Installed Handshake Write keys (using %s)", qtls.CipherSuiteName(suite.ID)) case qtls.EncryptionApplication: h.writeEncLevel = protocol.Encryption1RTT h.aead.SetWriteKey(suite, trafficSecret) h.has1RTTSealer = true - h.logger.Debugf("Installed 1-RTT Write keys (using %s)", cipherSuiteName(suite.ID)) + h.logger.Debugf("Installed 1-RTT Write keys (using %s)", qtls.CipherSuiteName(suite.ID)) if h.zeroRTTSealer != nil { h.zeroRTTSealer = nil h.logger.Debugf("Dropping 0-RTT keys.") diff --git a/internal/handshake/qtls.go b/internal/handshake/qtls.go index 5bc3ee06..85fea0cd 100644 --- a/internal/handshake/qtls.go +++ b/internal/handshake/qtls.go @@ -129,16 +129,3 @@ func qtlsConfigToTLSConfig(config *qtls.Config) *tls.Config { CurvePreferences: config.CurvePreferences, } } - -func cipherSuiteName(id uint16) string { - switch id { - case qtls.TLS_AES_128_GCM_SHA256: - return "TLS_AES_128_GCM_SHA256" - case qtls.TLS_CHACHA20_POLY1305_SHA256: - return "TLS_CHACHA20_POLY1305_SHA256" - case qtls.TLS_AES_256_GCM_SHA384: - return "TLS_AES_256_GCM_SHA384" - default: - return "unknown cipher suite" - } -} diff --git a/internal/handshake/updatable_aead_test.go b/internal/handshake/updatable_aead_test.go index 65a9b789..28b26571 100644 --- a/internal/handshake/updatable_aead_test.go +++ b/internal/handshake/updatable_aead_test.go @@ -9,6 +9,8 @@ import ( "github.com/lucas-clemente/quic-go/internal/congestion" "github.com/lucas-clemente/quic-go/internal/protocol" "github.com/lucas-clemente/quic-go/internal/utils" + "github.com/marten-seemann/qtls" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -17,7 +19,7 @@ var _ = Describe("Updatable AEAD", func() { for i := range cipherSuites { cs := cipherSuites[i] - Context(fmt.Sprintf("using %s", cipherSuiteName(cs.ID)), func() { + Context(fmt.Sprintf("using %s", qtls.CipherSuiteName(cs.ID)), func() { getPeers := func(rttStats *congestion.RTTStats) (client, server *updatableAEAD) { trafficSecret1 := make([]byte, 16)