Skip to content

Commit

Permalink
Merge pull request #3217 from lucas-clemente/drop-versions-32-and-34
Browse files Browse the repository at this point in the history
drop support for QUIC draft version 32 and 34
  • Loading branch information
marten-seemann committed Jul 6, 2021
2 parents 5d3c5d7 + f51cc93 commit 99d2a4e
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 51 deletions.
2 changes: 1 addition & 1 deletion http3/client_test.go
Expand Up @@ -55,7 +55,7 @@ var _ = Describe("Client", func() {

It("rejects quic.Configs that allow multiple QUIC versions", func() {
qconf := &quic.Config{
Versions: []quic.VersionNumber{protocol.VersionDraft29, protocol.VersionDraft32},
Versions: []quic.VersionNumber{protocol.VersionDraft29, protocol.Version1},
}
_, err := newClient("localhost:1337", nil, &roundTripperOpts{}, qconf, nil)
Expect(err).To(MatchError("can only use a single QUIC version for dialing a HTTP/3 connection"))
Expand Down
16 changes: 1 addition & 15 deletions http3/server.go
Expand Up @@ -31,8 +31,6 @@ var (

const (
nextProtoH3Draft29 = "h3-29"
nextProtoH3Draft32 = "h3-32"
nextProtoH3Draft34 = "h3-34"
nextProtoH3 = "h3"
)

Expand All @@ -50,12 +48,6 @@ func versionToALPN(v protocol.VersionNumber) string {
if v == protocol.VersionTLS || v == protocol.VersionDraft29 {
return nextProtoH3Draft29
}
if v == protocol.VersionDraft32 {
return nextProtoH3Draft32
}
if v == protocol.VersionDraft34 {
return nextProtoH3Draft34
}
return ""
}

Expand Down Expand Up @@ -159,13 +151,7 @@ func (s *Server) serveImpl(tlsConf *tls.Config, conn net.PacketConn) error {
// determine the ALPN from the QUIC version used
proto := nextProtoH3Draft29
if qconn, ok := ch.Conn.(handshake.ConnWithVersion); ok {
//nolint:exhaustive
switch qconn.GetQUICVersion() {
case quic.VersionDraft32:
proto = nextProtoH3Draft32
case protocol.VersionDraft34:
proto = nextProtoH3Draft34
case protocol.Version1:
if qconn.GetQUICVersion() == protocol.Version1 {
proto = nextProtoH3
}
}
Expand Down
8 changes: 4 additions & 4 deletions http3/server_test.go
Expand Up @@ -586,10 +586,10 @@ var _ = Describe("Server", func() {

It("works if the quic.Config sets QUIC versions", func() {
s.Server.Addr = ":443"
s.QuicConfig.Versions = []quic.VersionNumber{quic.VersionDraft32, quic.VersionDraft29}
s.QuicConfig.Versions = []quic.VersionNumber{quic.Version1, quic.VersionDraft29}
hdr := http.Header{}
Expect(s.SetQuicHeaders(hdr)).To(Succeed())
Expect(hdr).To(Equal(http.Header{"Alt-Svc": {`h3-32=":443"; ma=2592000,h3-29=":443"; ma=2592000`}}))
Expect(hdr).To(Equal(http.Header{"Alt-Svc": {`h3=":443"; ma=2592000,h3-29=":443"; ma=2592000`}}))
})
})

Expand Down Expand Up @@ -709,9 +709,9 @@ var _ = Describe("Server", func() {
c, err := conf.GetConfigForClient(&tls.ClientHelloInfo{Conn: newMockConn(protocol.VersionDraft29)})
ExpectWithOffset(1, err).ToNot(HaveOccurred())
ExpectWithOffset(1, c.NextProtos).To(Equal([]string{nextProtoH3Draft29}))
c, err = conf.GetConfigForClient(&tls.ClientHelloInfo{Conn: newMockConn(protocol.VersionDraft32)})
c, err = conf.GetConfigForClient(&tls.ClientHelloInfo{Conn: newMockConn(protocol.Version1)})
ExpectWithOffset(1, err).ToNot(HaveOccurred())
ExpectWithOffset(1, c.NextProtos).To(Equal([]string{nextProtoH3Draft32}))
ExpectWithOffset(1, c.NextProtos).To(Equal([]string{nextProtoH3}))
}

It("uses the quic.Config to start the QUIC server", func() {
Expand Down
4 changes: 0 additions & 4 deletions interface.go
Expand Up @@ -21,10 +21,6 @@ type VersionNumber = protocol.VersionNumber
const (
// VersionDraft29 is IETF QUIC draft-29
VersionDraft29 = protocol.VersionDraft29
// VersionDraft32 is IETF QUIC draft-32
VersionDraft32 = protocol.VersionDraft32
// VersionDraft34 is IETF QUIC draft-34
VersionDraft34 = protocol.VersionDraft34
// Version1 is RFC 9000
Version1 = protocol.Version1
)
Expand Down
8 changes: 4 additions & 4 deletions internal/handshake/initial_aead.go
Expand Up @@ -11,13 +11,13 @@ import (
)

var (
quicSaltOld = []byte{0xaf, 0xbf, 0xec, 0x28, 0x99, 0x93, 0xd2, 0x4c, 0x9e, 0x97, 0x86, 0xf1, 0x9c, 0x61, 0x11, 0xe0, 0x43, 0x90, 0xa8, 0x99}
quicSaltDraft34 = []byte{0x38, 0x76, 0x2c, 0xf7, 0xf5, 0x59, 0x34, 0xb3, 0x4d, 0x17, 0x9a, 0xe6, 0xa4, 0xc8, 0x0c, 0xad, 0xcc, 0xbb, 0x7f, 0x0a}
quicSaltOld = []byte{0xaf, 0xbf, 0xec, 0x28, 0x99, 0x93, 0xd2, 0x4c, 0x9e, 0x97, 0x86, 0xf1, 0x9c, 0x61, 0x11, 0xe0, 0x43, 0x90, 0xa8, 0x99}
quicSalt = []byte{0x38, 0x76, 0x2c, 0xf7, 0xf5, 0x59, 0x34, 0xb3, 0x4d, 0x17, 0x9a, 0xe6, 0xa4, 0xc8, 0x0c, 0xad, 0xcc, 0xbb, 0x7f, 0x0a}
)

func getSalt(v protocol.VersionNumber) []byte {
if v == protocol.VersionDraft34 || v == protocol.Version1 {
return quicSaltDraft34
if v == protocol.Version1 {
return quicSalt
}
return quicSaltOld
}
Expand Down
6 changes: 3 additions & 3 deletions internal/handshake/initial_aead_test.go
Expand Up @@ -72,8 +72,8 @@ var _ = Describe("Initial AEAD using AES-GCM", func() {
})

// values taken from the Appendix of the draft
Context("using the test vector from the QUIC draft, for QUIC draft-34", func() {
const version = protocol.VersionDraft34
Context("using the test vector from the QUIC draft, for QUIC v1", func() {
const version = protocol.Version1
var connID protocol.ConnectionID

BeforeEach(func() {
Expand Down Expand Up @@ -125,7 +125,7 @@ var _ = Describe("Initial AEAD using AES-GCM", func() {
})
})

for _, ver := range []protocol.VersionNumber{protocol.VersionDraft32, protocol.VersionDraft34} {
for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.Version1} {
v := ver

Context(fmt.Sprintf("using version %s", v), func() {
Expand Down
2 changes: 1 addition & 1 deletion internal/handshake/retry.go
Expand Up @@ -48,7 +48,7 @@ func GetRetryIntegrityTag(retry []byte, origDestConnID protocol.ConnectionID, ve

var tag [16]byte
var sealed []byte
if version != protocol.VersionDraft34 && version != protocol.Version1 {
if version != protocol.Version1 {
sealed = oldRetryAEAD.Seal(tag[:0], oldRetryNonce[:], nil, retryBuf.Bytes())
} else {
sealed = retryAEAD.Seal(tag[:0], retryNonce[:], nil, retryBuf.Bytes())
Expand Down
8 changes: 4 additions & 4 deletions internal/handshake/retry_test.go
Expand Up @@ -17,8 +17,8 @@ var _ = Describe("Retry Integrity Check", func() {
})

It("includes the original connection ID in the tag calculation", func() {
t1 := GetRetryIntegrityTag([]byte("foobar"), protocol.ConnectionID{1, 2, 3, 4}, protocol.VersionDraft34)
t2 := GetRetryIntegrityTag([]byte("foobar"), protocol.ConnectionID{4, 3, 2, 1}, protocol.VersionDraft34)
t1 := GetRetryIntegrityTag([]byte("foobar"), protocol.ConnectionID{1, 2, 3, 4}, protocol.Version1)
t2 := GetRetryIntegrityTag([]byte("foobar"), protocol.ConnectionID{4, 3, 2, 1}, protocol.Version1)
Expect(*t1).ToNot(Equal(*t2))
})

Expand All @@ -28,9 +28,9 @@ var _ = Describe("Retry Integrity Check", func() {
Expect(GetRetryIntegrityTag(data[:len(data)-16], connID, protocol.VersionDraft29)[:]).To(Equal(data[len(data)-16:]))
})

It("uses the test vector from the draft, for draft-34", func() {
It("uses the test vector from the draft, for version 1", func() {
connID := protocol.ConnectionID(splitHexString("0x8394c8f03e515708"))
data := splitHexString("ff000000010008f067a5502a4262b574 6f6b656e04a265ba2eff4d829058fb3f 0f2496ba")
Expect(GetRetryIntegrityTag(data[:len(data)-16], connID, protocol.VersionDraft34)[:]).To(Equal(data[len(data)-16:]))
Expect(GetRetryIntegrityTag(data[:len(data)-16], connID, protocol.Version1)[:]).To(Equal(data[len(data)-16:]))
})
})
2 changes: 1 addition & 1 deletion internal/handshake/tls_extension_handler.go
Expand Up @@ -24,7 +24,7 @@ var _ tlsExtensionHandler = &extensionHandler{}
// newExtensionHandler creates a new extension handler
func newExtensionHandler(params []byte, pers protocol.Perspective, v protocol.VersionNumber) tlsExtensionHandler {
et := uint16(quicTLSExtensionType)
if v != protocol.VersionDraft34 && v != protocol.Version1 {
if v != protocol.Version1 {
et = quicTLSExtensionTypeOldDrafts
}
return &extensionHandler{
Expand Down
4 changes: 2 additions & 2 deletions internal/handshake/tls_extension_handler_test.go
Expand Up @@ -35,7 +35,7 @@ var _ = Describe("TLS Extension Handler, for the server", func() {
})

Context("for the server", func() {
for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.VersionDraft34} {
for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.Version1} {
v := ver

Context(fmt.Sprintf("sending, for version %s", v), func() {
Expand Down Expand Up @@ -122,7 +122,7 @@ var _ = Describe("TLS Extension Handler, for the server", func() {
})

Context("for the client", func() {
for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.VersionDraft34} {
for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.Version1} {
v := ver

Context(fmt.Sprintf("sending, for version %s", v), func() {
Expand Down
10 changes: 2 additions & 8 deletions internal/protocol/version.go
Expand Up @@ -22,14 +22,12 @@ const (
VersionWhatever VersionNumber = math.MaxUint32 - 1 // for when the version doesn't matter
VersionUnknown VersionNumber = math.MaxUint32
VersionDraft29 VersionNumber = 0xff00001d
VersionDraft32 VersionNumber = 0xff000020
VersionDraft34 VersionNumber = 0xff000022
Version1 VersionNumber = 0x1
)

// SupportedVersions lists the versions that the server supports
// must be in sorted descending order
var SupportedVersions = []VersionNumber{Version1, VersionDraft34, VersionDraft32, VersionDraft29}
var SupportedVersions = []VersionNumber{Version1, VersionDraft29}

// IsValidVersion says if the version is known to quic-go
func IsValidVersion(v VersionNumber) bool {
Expand All @@ -39,7 +37,7 @@ func IsValidVersion(v VersionNumber) bool {
func (vn VersionNumber) String() string {
// For releases, VersionTLS will be set to a draft version.
// A switch statement can't contain duplicate cases.
if vn == VersionTLS && VersionTLS != VersionDraft29 && VersionTLS != VersionDraft32 && VersionTLS != Version1 {
if vn == VersionTLS && VersionTLS != VersionDraft29 && VersionTLS != Version1 {
return "TLS dev version (WIP)"
}
//nolint:exhaustive
Expand All @@ -50,10 +48,6 @@ func (vn VersionNumber) String() string {
return "unknown"
case VersionDraft29:
return "draft-29"
case VersionDraft32:
return "draft-32"
case VersionDraft34:
return "draft-34"
case Version1:
return "v1"
default:
Expand Down
4 changes: 0 additions & 4 deletions internal/protocol/version_test.go
Expand Up @@ -15,8 +15,6 @@ var _ = Describe("Version", func() {
Expect(IsValidVersion(VersionWhatever)).To(BeFalse())
Expect(IsValidVersion(VersionUnknown)).To(BeFalse())
Expect(IsValidVersion(VersionDraft29)).To(BeTrue())
Expect(IsValidVersion(VersionDraft32)).To(BeTrue())
Expect(IsValidVersion(VersionDraft34)).To(BeTrue())
Expect(IsValidVersion(Version1)).To(BeTrue())
Expect(IsValidVersion(1234)).To(BeFalse())
})
Expand All @@ -29,8 +27,6 @@ var _ = Describe("Version", func() {
Expect(VersionWhatever.String()).To(Equal("whatever"))
Expect(VersionUnknown.String()).To(Equal("unknown"))
Expect(VersionDraft29.String()).To(Equal("draft-29"))
Expect(VersionDraft32.String()).To(Equal("draft-32"))
Expect(VersionDraft34.String()).To(Equal("draft-34"))
Expect(Version1.String()).To(Equal("v1"))
// check with unsupported version numbers from the wiki
Expect(VersionNumber(0x51303039).String()).To(Equal("gQUIC 9"))
Expand Down

0 comments on commit 99d2a4e

Please sign in to comment.