diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index a7776c0ae68..b973ef9ccc9 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -25,9 +25,6 @@ jobs: run: | go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace -skip-package self,versionnegotiation integrationtests go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/versionnegotiation -- ${{ env.QLOGFLAG }} - - name: Run self tests, using draft-29 - if: success() || failure() # run this step even if the previous one failed - run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/self -- -version=draft29 ${{ env.QLOGFLAG }} - name: Run self tests, using QUIC v1 if: success() || failure() # run this step even if the previous one failed run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/self -- -version=1 ${{ env.QLOGFLAG }} diff --git a/README.md b/README.md index 53638882acf..ad29d8650f9 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,6 @@ In addition to these base RFCs, it also implements the following RFCs: * Datagram Packetization Layer Path MTU Discovery (DPLPMTUD, [RFC 8899](https://datatracker.ietf.org/doc/html/rfc8899)) * QUIC Version 2 ([RFC 9369](https://datatracker.ietf.org/doc/html/rfc9369)) -In addition to the RFCs listed above, it currently implements the [IETF QUIC draft-29](https://tools.ietf.org/html/draft-ietf-quic-transport-29). Support for draft-29 will eventually be dropped, as it is phased out of the ecosystem. - -This repository provides both a QUIC implementation, located in the `quic` package, as well as an HTTP/3 implementation, located in the `http3` package. - ## Using QUIC ### Running a Server diff --git a/http3/client_test.go b/http3/client_test.go index 2bc008848a0..ebcfa3bce11 100644 --- a/http3/client_test.go +++ b/http3/client_test.go @@ -54,7 +54,7 @@ var _ = Describe("Client", func() { It("rejects quic.Configs that allow multiple QUIC versions", func() { qconf := &quic.Config{ - Versions: []quic.VersionNumber{protocol.VersionDraft29, protocol.Version1}, + Versions: []quic.VersionNumber{protocol.Version2, 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")) diff --git a/http3/server.go b/http3/server.go index a03b1fc53a3..d77501824eb 100644 --- a/http3/server.go +++ b/http3/server.go @@ -62,8 +62,6 @@ func versionToALPN(v protocol.VersionNumber) string { switch v { case protocol.Version1, protocol.Version2: return NextProtoH3 - case protocol.VersionDraft29: - return NextProtoH3Draft29 default: return "" } diff --git a/http3/server_test.go b/http3/server_test.go index 572446eaa77..91e1df8dab9 100644 --- a/http3/server_test.go +++ b/http3/server_test.go @@ -779,13 +779,13 @@ var _ = Describe("Server", func() { Context("setting http headers", func() { BeforeEach(func() { - s.QuicConfig = &quic.Config{Versions: []protocol.VersionNumber{protocol.VersionDraft29}} + s.QuicConfig = &quic.Config{Versions: []protocol.VersionNumber{protocol.Version1}} }) var ln1 QUICEarlyListener var ln2 QUICEarlyListener expected := http.Header{ - "Alt-Svc": {`h3-29=":443"; ma=2592000`}, + "Alt-Svc": {`h3=":443"; ma=2592000`}, } addListener := func(addr string, ln *QUICEarlyListener) { @@ -840,9 +840,9 @@ var _ = Describe("Server", func() { }) It("works if the quic.Config sets QUIC versions", func() { - s.QuicConfig.Versions = []quic.VersionNumber{quic.Version1, quic.VersionDraft29} + s.QuicConfig.Versions = []quic.VersionNumber{quic.Version1, quic.Version2} addListener(":443", &ln1) - checkSetHeaders(Equal(http.Header{"Alt-Svc": {`h3=":443"; ma=2592000,h3-29=":443"; ma=2592000`}})) + checkSetHeaders(Equal(http.Header{"Alt-Svc": {`h3=":443"; ma=2592000`}})) removeListener(&ln1) checkSetHeaderError() }) @@ -850,7 +850,7 @@ var _ = Describe("Server", func() { It("uses s.Port if set to a non-zero value", func() { s.Port = 8443 addListener(":443", &ln1) - checkSetHeaders(Equal(http.Header{"Alt-Svc": {`h3-29=":8443"; ma=2592000`}})) + checkSetHeaders(Equal(http.Header{"Alt-Svc": {`h3=":8443"; ma=2592000`}})) removeListener(&ln1) checkSetHeaderError() }) @@ -870,8 +870,8 @@ var _ = Describe("Server", func() { addListener(":443", &ln1) addListener(":8443", &ln2) checkSetHeaders(Or( - Equal(http.Header{"Alt-Svc": {`h3-29=":443"; ma=2592000,h3-29=":8443"; ma=2592000`}}), - Equal(http.Header{"Alt-Svc": {`h3-29=":8443"; ma=2592000,h3-29=":443"; ma=2592000`}}), + Equal(http.Header{"Alt-Svc": {`h3=":443"; ma=2592000,h3=":8443"; ma=2592000`}}), + Equal(http.Header{"Alt-Svc": {`h3=":8443"; ma=2592000,h3=":443"; ma=2592000`}}), )) removeListener(&ln1) removeListener(&ln2) @@ -929,17 +929,6 @@ var _ = Describe("Server", func() { Expect(c.ConnectionState().TLS.ConnectionState.NegotiatedProtocol).To(Equal(NextProtoH3)) }) - It("advertises h3-29 for draft-29", func() { - conf := ConfigureTLSConfig(testdata.GetTLSConfig()) - ln, err := quic.ListenAddr("localhost:0", conf, &quic.Config{Versions: []quic.VersionNumber{quic.VersionDraft29}}) - Expect(err).ToNot(HaveOccurred()) - defer ln.Close() - c, err := quic.DialAddr(context.Background(), ln.Addr().String(), &tls.Config{InsecureSkipVerify: true, NextProtos: []string{NextProtoH3Draft29}}, nil) - Expect(err).ToNot(HaveOccurred()) - defer c.CloseWithError(0, "") - Expect(c.ConnectionState().TLS.ConnectionState.NegotiatedProtocol).To(Equal(NextProtoH3Draft29)) - }) - It("sets the GetConfigForClient callback if no tls.Config is given", func() { var receivedConf *tls.Config quicListenAddr = func(addr string, tlsConf *tls.Config, _ *quic.Config) (QUICEarlyListener, error) { diff --git a/integrationtests/self/http_test.go b/integrationtests/self/http_test.go index f8d563b9cf1..e41dc85e4a7 100644 --- a/integrationtests/self/http_test.go +++ b/integrationtests/self/http_test.go @@ -18,7 +18,6 @@ import ( "github.com/quic-go/quic-go" "github.com/quic-go/quic-go/http3" - "github.com/quic-go/quic-go/internal/protocol" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -397,11 +396,7 @@ var _ = Describe("HTTP tests", func() { It("serves other QUIC connections", func() { tlsConf := getTLSConfig() - if version == protocol.VersionDraft29 { - tlsConf.NextProtos = []string{http3.NextProtoH3Draft29} - } else { - tlsConf.NextProtos = []string{http3.NextProtoH3} - } + tlsConf.NextProtos = []string{http3.NextProtoH3} ln, err := quic.ListenAddr("localhost:0", tlsConf, nil) Expect(err).ToNot(HaveOccurred()) defer ln.Close() diff --git a/integrationtests/self/self_suite_test.go b/integrationtests/self/self_suite_test.go index 8f9436e62ee..64240bd9152 100644 --- a/integrationtests/self/self_suite_test.go +++ b/integrationtests/self/self_suite_test.go @@ -149,8 +149,6 @@ var _ = BeforeSuite(func() { version = quic.Version1 case "2": version = quic.Version2 - case "draft29": - version = quic.VersionDraft29 default: Fail(fmt.Sprintf("unknown QUIC version: %s", versionParam)) } diff --git a/interface.go b/interface.go index 8486c7fe030..8e6213bfcbf 100644 --- a/interface.go +++ b/interface.go @@ -19,10 +19,9 @@ type StreamID = protocol.StreamID type VersionNumber = protocol.VersionNumber const ( - // VersionDraft29 is IETF QUIC draft-29 - VersionDraft29 = protocol.VersionDraft29 // Version1 is RFC 9000 Version1 = protocol.Version1 + // Version2 is RFC 9369 Version2 = protocol.Version2 ) diff --git a/internal/handshake/aead_test.go b/internal/handshake/aead_test.go index 6c269a512d2..6dee25d337e 100644 --- a/internal/handshake/aead_test.go +++ b/internal/handshake/aead_test.go @@ -15,7 +15,7 @@ import ( ) var _ = Describe("Long Header AEAD", func() { - for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.Version1, protocol.Version2} { + for _, ver := range []protocol.VersionNumber{protocol.Version1, protocol.Version2} { v := ver Context(fmt.Sprintf("using version %s", v), func() { diff --git a/internal/handshake/crypto_setup.go b/internal/handshake/crypto_setup.go index 8c9c2a8f805..a11c0d2366c 100644 --- a/internal/handshake/crypto_setup.go +++ b/internal/handshake/crypto_setup.go @@ -240,7 +240,7 @@ func newCryptoSetup( tracer.UpdatedKeyFromTLS(protocol.EncryptionInitial, protocol.PerspectiveClient) tracer.UpdatedKeyFromTLS(protocol.EncryptionInitial, protocol.PerspectiveServer) } - extHandler := newExtensionHandler(tp.Marshal(perspective), perspective, version) + extHandler := newExtensionHandler(tp.Marshal(perspective), perspective) zeroRTTParametersChan := make(chan *wire.TransportParameters, 1) cs := &cryptoSetup{ tlsConf: tlsConf, diff --git a/internal/handshake/initial_aead.go b/internal/handshake/initial_aead.go index 3967fdb83ab..ea39e7fd58a 100644 --- a/internal/handshake/initial_aead.go +++ b/internal/handshake/initial_aead.go @@ -11,9 +11,8 @@ import ( ) var ( - quicSaltOld = []byte{0xaf, 0xbf, 0xec, 0x28, 0x99, 0x93, 0xd2, 0x4c, 0x9e, 0x97, 0x86, 0xf1, 0x9c, 0x61, 0x11, 0xe0, 0x43, 0x90, 0xa8, 0x99} - quicSaltV1 = []byte{0x38, 0x76, 0x2c, 0xf7, 0xf5, 0x59, 0x34, 0xb3, 0x4d, 0x17, 0x9a, 0xe6, 0xa4, 0xc8, 0x0c, 0xad, 0xcc, 0xbb, 0x7f, 0x0a} - quicSaltV2 = []byte{0x0d, 0xed, 0xe3, 0xde, 0xf7, 0x00, 0xa6, 0xdb, 0x81, 0x93, 0x81, 0xbe, 0x6e, 0x26, 0x9d, 0xcb, 0xf9, 0xbd, 0x2e, 0xd9} + quicSaltV1 = []byte{0x38, 0x76, 0x2c, 0xf7, 0xf5, 0x59, 0x34, 0xb3, 0x4d, 0x17, 0x9a, 0xe6, 0xa4, 0xc8, 0x0c, 0xad, 0xcc, 0xbb, 0x7f, 0x0a} + quicSaltV2 = []byte{0x0d, 0xed, 0xe3, 0xde, 0xf7, 0x00, 0xa6, 0xdb, 0x81, 0x93, 0x81, 0xbe, 0x6e, 0x26, 0x9d, 0xcb, 0xf9, 0xbd, 0x2e, 0xd9} ) const ( @@ -27,10 +26,7 @@ func getSalt(v protocol.VersionNumber) []byte { if v == protocol.Version2 { return quicSaltV2 } - if v == protocol.Version1 { - return quicSaltV1 - } - return quicSaltOld + return quicSaltV1 } var initialSuite = &qtls.CipherSuiteTLS13{ diff --git a/internal/handshake/initial_aead_test.go b/internal/handshake/initial_aead_test.go index 22107259074..a4659245d02 100644 --- a/internal/handshake/initial_aead_test.go +++ b/internal/handshake/initial_aead_test.go @@ -27,12 +27,6 @@ var _ = Describe("Initial AEAD using AES-GCM", func() { Expect(key).To(Equal(expectedKey)) Expect(iv).To(Equal(expectedIV)) }, - Entry("draft-29", - protocol.VersionDraft29, - splitHexString("0088119288f1d866733ceeed15ff9d50 902cf82952eee27e9d4d4918ea371d87"), - splitHexString("175257a31eb09dea9366d8bb79ad80ba"), - splitHexString("6b26114b9cba2b63a9e8dd4f"), - ), Entry("QUIC v1", protocol.Version1, splitHexString("c00cf151ca5be075ed0ebfb5c80323c4 2d6b7db67881289af4008f1f6c357aea"), @@ -55,12 +49,6 @@ var _ = Describe("Initial AEAD using AES-GCM", func() { Expect(key).To(Equal(expectedKey)) Expect(iv).To(Equal(expectedIV)) }, - Entry("draft 29", - protocol.VersionDraft29, - splitHexString("006f881359244dd9ad1acf85f595bad6 7c13f9f5586f5e64e1acae1d9ea8f616"), - splitHexString("149d0b1662ab871fbe63c49b5e655a5d"), - splitHexString("bab2b12a4c76016ace47856d"), - ), Entry("QUIC v1", protocol.Version1, splitHexString("3c199828fd139efd216c155ad844cc81 fb82fa8d7446fa7d78be803acdda951b"), @@ -88,15 +76,6 @@ var _ = Describe("Initial AEAD using AES-GCM", func() { packet := append(header, sealed...) Expect(packet).To(Equal(expectedPacket)) }, - Entry("draft-29", - protocol.VersionDraft29, - splitHexString("c3ff00001d088394c8f03e5157080000449e00000002"), - splitHexString("060040c4010000c003036660261ff947 cea49cce6cfad687f457cf1b14531ba1 4131a0e8f309a1d0b9c4000006130113 031302010000910000000b0009000006 736572766572ff01000100000a001400 12001d00170018001901000101010201 03010400230000003300260024001d00 204cfdfcd178b784bf328cae793b136f 2aedce005ff183d7bb14952072366470 37002b0003020304000d0020001e0403 05030603020308040805080604010501 060102010402050206020202002d0002 0101001c00024001"), - splitHexString("fb66bc5f93032b7ddd89fe0ff15d9c4f"), - byte(0xc5), - splitHexString("4a95245b"), - splitHexString("c5ff00001d088394c8f03e5157080000 449e4a95245bfb66bc5f93032b7ddd89 fe0ff15d9c4f7050fccdb71c1cd80512 d4431643a53aafa1b0b518b44968b18b 8d3e7a4d04c30b3ed9410325b2abb2da fb1c12f8b70479eb8df98abcaf95dd8f 3d1c78660fbc719f88b23c8aef6771f3 d50e10fdfb4c9d92386d44481b6c52d5 9e5538d3d3942de9f13a7f8b702dc317 24180da9df22714d01003fc5e3d165c9 50e630b8540fbd81c9df0ee63f949970 26c4f2e1887a2def79050ac2d86ba318 e0b3adc4c5aa18bcf63c7cf8e85f5692 49813a2236a7e72269447cd1c755e451 f5e77470eb3de64c8849d29282069802 9cfa18e5d66176fe6e5ba4ed18026f90 900a5b4980e2f58e39151d5cd685b109 29636d4f02e7fad2a5a458249f5c0298 a6d53acbe41a7fc83fa7cc01973f7a74 d1237a51974e097636b6203997f921d0 7bc1940a6f2d0de9f5a11432946159ed 6cc21df65c4ddd1115f86427259a196c 7148b25b6478b0dc7766e1c4d1b1f515 9f90eabc61636226244642ee148b464c 9e619ee50a5e3ddc836227cad938987c 4ea3c1fa7c75bbf88d89e9ada642b2b8 8fe8107b7ea375b1b64889a4e9e5c38a 1c896ce275a5658d250e2d76e1ed3a34 ce7e3a3f383d0c996d0bed106c2899ca 6fc263ef0455e74bb6ac1640ea7bfedc 59f03fee0e1725ea150ff4d69a7660c5 542119c71de270ae7c3ecfd1af2c4ce5 51986949cc34a66b3e216bfe18b347e6 c05fd050f85912db303a8f054ec23e38 f44d1c725ab641ae929fecc8e3cefa56 19df4231f5b4c009fa0c0bbc60bc75f7 6d06ef154fc8577077d9d6a1d2bd9bf0 81dc783ece60111bea7da9e5a9748069 d078b2bef48de04cabe3755b197d52b3 2046949ecaa310274b4aac0d008b1948 c1082cdfe2083e386d4fd84c0ed0666d 3ee26c4515c4fee73433ac703b690a9f 7bf278a77486ace44c489a0c7ac8dfe4 d1a58fb3a730b993ff0f0d61b4d89557 831eb4c752ffd39c10f6b9f46d8db278 da624fd800e4af85548a294c1518893a 8778c4f6d6d73c93df200960104e062b 388ea97dcf4016bced7f62b4f062cb6c 04c20693d9a0e3b74ba8fe74cc012378 84f40d765ae56a51688d985cf0ceaef4 3045ed8c3f0c33bced08537f6882613a cd3b08d665fce9dd8aa73171e2d3771a 61dba2790e491d413d93d987e2745af2 9418e428be34941485c93447520ffe23 1da2304d6a0fd5d07d08372202369661 59bef3cf904d722324dd852513df39ae 030d8173908da6364786d3c1bfcb19ea 77a63b25f1e7fc661def480c5d00d444 56269ebd84efd8e3a8b2c257eec76060 682848cbf5194bc99e49ee75e4d0d254 bad4bfd74970c30e44b65511d4ad0e6e c7398e08e01307eeeea14e46ccd87cf3 6b285221254d8fc6a6765c524ded0085 dca5bd688ddf722e2c0faf9d0fb2ce7a 0c3f2cee19ca0ffba461ca8dc5d2c817 8b0762cf67135558494d2a96f1a139f0 edb42d2af89a9c9122b07acbc29e5e72 2df8615c343702491098478a389c9872 a10b0c9875125e257c7bfdf27eef4060 bd3d00f4c14fd3e3496c38d3c5d1a566 8c39350effbc2d16ca17be4ce29f02ed 969504dda2a8c6b9ff919e693ee79e09 089316e7d1d89ec099db3b2b268725d8 88536a4b8bf9aee8fb43e82a4d919d48 43b1ca70a2d8d3f725ead1391377dcc0"), - ), Entry("QUIC v1", protocol.Version1, splitHexString("c300000001088394c8f03e5157080000449e00000002"), @@ -128,14 +107,6 @@ var _ = Describe("Initial AEAD using AES-GCM", func() { packet := append(header, sealed...) Expect(packet).To(Equal(expectedPacket)) }, - Entry("draft 29", - protocol.VersionDraft29, - splitHexString("c1ff00001d0008f067a5502a4262b50040740001"), - splitHexString("0d0000000018410a020000560303eefc e7f7b37ba1d1632e96677825ddf73988 cfc79825df566dc5430b9a045a120013 0100002e00330024001d00209d3c940d 89690b84d08a60993c144eca684d1081 287c834d5311bcf32bb9da1a002b0002 0304"), - splitHexString("823a5d3a1207c86ee49132824f046524"), - splitHexString("caff00001d0008f067a5502a4262b5004074aaf2"), - splitHexString("caff00001d0008f067a5502a4262b500 4074aaf2f007823a5d3a1207c86ee491 32824f0465243d082d868b107a38092b c80528664cbf9456ebf27673fb5fa506 1ab573c9f001b81da028a00d52ab00b1 5bebaa70640e106cf2acd043e9c6b441 1c0a79637134d8993701fe779e58c2fe 753d14b0564021565ea92e57bc6faf56 dfc7a40870e6"), - ), Entry("QUIC v1", protocol.Version1, splitHexString("c1000000010008f067a5502a4262b50040750001"), @@ -154,7 +125,7 @@ var _ = Describe("Initial AEAD using AES-GCM", func() { ), ) - for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.Version1, protocol.Version2} { + for _, ver := range []protocol.VersionNumber{protocol.Version1, protocol.Version2} { v := ver Context(fmt.Sprintf("using version %s", v), func() { diff --git a/internal/handshake/retry.go b/internal/handshake/retry.go index ff14f7e0d24..68fa53ed134 100644 --- a/internal/handshake/retry.go +++ b/internal/handshake/retry.go @@ -11,13 +11,11 @@ import ( ) var ( - retryAEADdraft29 cipher.AEAD // used for QUIC draft versions up to 34 - retryAEADv1 cipher.AEAD // used for QUIC v1 (RFC 9000) - retryAEADv2 cipher.AEAD // used for QUIC v2 + retryAEADv1 cipher.AEAD // used for QUIC v1 (RFC 9000) + retryAEADv2 cipher.AEAD // used for QUIC v2 (RFC 9369) ) func init() { - retryAEADdraft29 = initAEAD([16]byte{0xcc, 0xce, 0x18, 0x7e, 0xd0, 0x9a, 0x09, 0xd0, 0x57, 0x28, 0x15, 0x5a, 0x6c, 0xb9, 0x6b, 0xe1}) retryAEADv1 = initAEAD([16]byte{0xbe, 0x0c, 0x69, 0x0b, 0x9f, 0x66, 0x57, 0x5a, 0x1d, 0x76, 0x6b, 0x54, 0xe3, 0x68, 0xc8, 0x4e}) retryAEADv2 = initAEAD([16]byte{0x8f, 0xb4, 0xb0, 0x1b, 0x56, 0xac, 0x48, 0xe2, 0x60, 0xfb, 0xcb, 0xce, 0xad, 0x7c, 0xcc, 0x92}) } @@ -35,11 +33,10 @@ func initAEAD(key [16]byte) cipher.AEAD { } var ( - retryBuf bytes.Buffer - retryMutex sync.Mutex - retryNonceDraft29 = [12]byte{0xe5, 0x49, 0x30, 0xf9, 0x7f, 0x21, 0x36, 0xf0, 0x53, 0x0a, 0x8c, 0x1c} - retryNonceV1 = [12]byte{0x46, 0x15, 0x99, 0xd3, 0x5d, 0x63, 0x2b, 0xf2, 0x23, 0x98, 0x25, 0xbb} - retryNonceV2 = [12]byte{0xd8, 0x69, 0x69, 0xbc, 0x2d, 0x7c, 0x6d, 0x99, 0x90, 0xef, 0xb0, 0x4a} + retryBuf bytes.Buffer + retryMutex sync.Mutex + retryNonceV1 = [12]byte{0x46, 0x15, 0x99, 0xd3, 0x5d, 0x63, 0x2b, 0xf2, 0x23, 0x98, 0x25, 0xbb} + retryNonceV2 = [12]byte{0xd8, 0x69, 0x69, 0xbc, 0x2d, 0x7c, 0x6d, 0x99, 0x90, 0xef, 0xb0, 0x4a} ) // GetRetryIntegrityTag calculates the integrity tag on a Retry packet @@ -54,14 +51,10 @@ func GetRetryIntegrityTag(retry []byte, origDestConnID protocol.ConnectionID, ve var tag [16]byte var sealed []byte - //nolint:exhaustive // These are all the versions we support - switch version { - case protocol.Version1: - sealed = retryAEADv1.Seal(tag[:0], retryNonceV1[:], nil, retryBuf.Bytes()) - case protocol.Version2: + if version == protocol.Version2 { sealed = retryAEADv2.Seal(tag[:0], retryNonceV2[:], nil, retryBuf.Bytes()) - default: - sealed = retryAEADdraft29.Seal(tag[:0], retryNonceDraft29[:], nil, retryBuf.Bytes()) + } else { + sealed = retryAEADv1.Seal(tag[:0], retryNonceV1[:], nil, retryBuf.Bytes()) } if len(sealed) != 16 { panic(fmt.Sprintf("unexpected Retry integrity tag length: %d", len(sealed))) diff --git a/internal/handshake/retry_test.go b/internal/handshake/retry_test.go index 046892bc5a1..560e7af5b43 100644 --- a/internal/handshake/retry_test.go +++ b/internal/handshake/retry_test.go @@ -12,8 +12,8 @@ import ( var _ = Describe("Retry Integrity Check", func() { It("calculates retry integrity tags", func() { connID := protocol.ParseConnectionID([]byte{1, 2, 3, 4}) - fooTag := GetRetryIntegrityTag([]byte("foo"), connID, protocol.VersionDraft29) - barTag := GetRetryIntegrityTag([]byte("bar"), connID, protocol.VersionDraft29) + fooTag := GetRetryIntegrityTag([]byte("foo"), connID, protocol.Version1) + barTag := GetRetryIntegrityTag([]byte("bar"), connID, protocol.Version1) Expect(fooTag).ToNot(BeNil()) Expect(barTag).ToNot(BeNil()) Expect(*fooTag).ToNot(Equal(*barTag)) @@ -34,10 +34,6 @@ var _ = Describe("Retry Integrity Check", func() { connID := protocol.ParseConnectionID(splitHexString("0x8394c8f03e515708")) Expect(GetRetryIntegrityTag(data[:len(data)-16], connID, version)[:]).To(Equal(data[len(data)-16:])) }, - Entry("draft-29", - protocol.VersionDraft29, - splitHexString("ffff00001d0008f067a5502a4262b574 6f6b656ed16926d81f6f9ca2953a8aa4 575e1e49"), - ), Entry("v1", protocol.Version1, splitHexString("ff000000010008f067a5502a4262b574 6f6b656e04a265ba2eff4d829058fb3f 0f2496ba"), diff --git a/internal/handshake/tls_extension_handler.go b/internal/handshake/tls_extension_handler.go index 6105fe40109..e46a930c73a 100644 --- a/internal/handshake/tls_extension_handler.go +++ b/internal/handshake/tls_extension_handler.go @@ -5,10 +5,7 @@ import ( "github.com/quic-go/quic-go/internal/qtls" ) -const ( - quicTLSExtensionTypeOldDrafts = 0xffa5 - quicTLSExtensionType = 0x39 -) +const quicTLSExtensionType = 0x39 type extensionHandler struct { ourParams []byte @@ -22,16 +19,12 @@ type extensionHandler struct { 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.VersionDraft29 { - et = quicTLSExtensionTypeOldDrafts - } +func newExtensionHandler(params []byte, pers protocol.Perspective) tlsExtensionHandler { return &extensionHandler{ ourParams: params, paramsChan: make(chan []byte), perspective: pers, - extensionType: et, + extensionType: quicTLSExtensionType, } } diff --git a/internal/handshake/tls_extension_handler_test.go b/internal/handshake/tls_extension_handler_test.go index b1ff4883b8f..4e557c9628e 100644 --- a/internal/handshake/tls_extension_handler_test.go +++ b/internal/handshake/tls_extension_handler_test.go @@ -1,8 +1,6 @@ package handshake import ( - "fmt" - "github.com/quic-go/quic-go/internal/protocol" "github.com/quic-go/quic-go/internal/qtls" @@ -14,56 +12,28 @@ var _ = Describe("TLS Extension Handler, for the server", func() { var ( handlerServer tlsExtensionHandler handlerClient tlsExtensionHandler - version protocol.VersionNumber ) - BeforeEach(func() { - version = protocol.VersionDraft29 - }) - JustBeforeEach(func() { - handlerServer = newExtensionHandler( - []byte("foobar"), - protocol.PerspectiveServer, - version, - ) - handlerClient = newExtensionHandler( - []byte("raboof"), - protocol.PerspectiveClient, - version, - ) + handlerServer = newExtensionHandler([]byte("foobar"), protocol.PerspectiveServer) + handlerClient = newExtensionHandler([]byte("raboof"), protocol.PerspectiveClient) }) Context("for the server", func() { - for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.Version1} { - v := ver - - Context(fmt.Sprintf("sending, for version %s", v), func() { - var extensionType uint16 - - BeforeEach(func() { - version = v - if v == protocol.VersionDraft29 { - extensionType = quicTLSExtensionTypeOldDrafts - } else { - extensionType = quicTLSExtensionType - } - }) - - It("only adds TransportParameters for the Encrypted Extensions", func() { - // test 2 other handshake types - Expect(handlerServer.GetExtensions(uint8(typeCertificate))).To(BeEmpty()) - Expect(handlerServer.GetExtensions(uint8(typeFinished))).To(BeEmpty()) - }) - - It("adds TransportParameters to the EncryptedExtensions message", func() { - exts := handlerServer.GetExtensions(uint8(typeEncryptedExtensions)) - Expect(exts).To(HaveLen(1)) - Expect(exts[0].Type).To(BeEquivalentTo(extensionType)) - Expect(exts[0].Data).To(Equal([]byte("foobar"))) - }) + Context("sending", func() { + It("only adds TransportParameters for the Encrypted Extensions", func() { + // test 2 other handshake types + Expect(handlerServer.GetExtensions(uint8(typeCertificate))).To(BeEmpty()) + Expect(handlerServer.GetExtensions(uint8(typeFinished))).To(BeEmpty()) }) - } + + It("adds TransportParameters to the EncryptedExtensions message", func() { + exts := handlerServer.GetExtensions(uint8(typeEncryptedExtensions)) + Expect(exts).To(HaveLen(1)) + Expect(exts[0].Type).To(BeEquivalentTo(quicTLSExtensionType)) + Expect(exts[0].Data).To(Equal([]byte("foobar"))) + }) + }) Context("receiving", func() { var chExts []qtls.Extension @@ -122,35 +92,20 @@ var _ = Describe("TLS Extension Handler, for the server", func() { }) Context("for the client", func() { - for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.Version1} { - v := ver - - Context(fmt.Sprintf("sending, for version %s", v), func() { - var extensionType uint16 - - BeforeEach(func() { - version = v - if v == protocol.VersionDraft29 { - extensionType = quicTLSExtensionTypeOldDrafts - } else { - extensionType = quicTLSExtensionType - } - }) - - It("only adds TransportParameters for the Encrypted Extensions", func() { - // test 2 other handshake types - Expect(handlerClient.GetExtensions(uint8(typeCertificate))).To(BeEmpty()) - Expect(handlerClient.GetExtensions(uint8(typeFinished))).To(BeEmpty()) - }) - - It("adds TransportParameters to the ClientHello message", func() { - exts := handlerClient.GetExtensions(uint8(typeClientHello)) - Expect(exts).To(HaveLen(1)) - Expect(exts[0].Type).To(BeEquivalentTo(extensionType)) - Expect(exts[0].Data).To(Equal([]byte("raboof"))) - }) + Context("sending", func() { + It("only adds TransportParameters for the Encrypted Extensions", func() { + // test 2 other handshake types + Expect(handlerClient.GetExtensions(uint8(typeCertificate))).To(BeEmpty()) + Expect(handlerClient.GetExtensions(uint8(typeFinished))).To(BeEmpty()) + }) + + It("adds TransportParameters to the ClientHello message", func() { + exts := handlerClient.GetExtensions(uint8(typeClientHello)) + Expect(exts).To(HaveLen(1)) + Expect(exts[0].Type).To(BeEquivalentTo(quicTLSExtensionType)) + Expect(exts[0].Data).To(Equal([]byte("raboof"))) }) - } + }) Context("receiving", func() { var chExts []qtls.Extension diff --git a/internal/handshake/updatable_aead_test.go b/internal/handshake/updatable_aead_test.go index 3ab7ddb40c3..db3cf56e1bf 100644 --- a/internal/handshake/updatable_aead_test.go +++ b/internal/handshake/updatable_aead_test.go @@ -47,7 +47,7 @@ var _ = Describe("Updatable AEAD", func() { ), ) - for _, ver := range []protocol.VersionNumber{protocol.VersionDraft29, protocol.Version1, protocol.Version2} { + for _, ver := range []protocol.VersionNumber{protocol.Version1, protocol.Version2} { v := ver Context(fmt.Sprintf("using version %s", v), func() { diff --git a/internal/protocol/version.go b/internal/protocol/version.go index 20e8976e363..5c2decbdc92 100644 --- a/internal/protocol/version.go +++ b/internal/protocol/version.go @@ -19,14 +19,14 @@ const ( // The version numbers, making grepping easier const ( VersionUnknown VersionNumber = math.MaxUint32 - VersionDraft29 VersionNumber = 0xff00001d + versionDraft29 VersionNumber = 0xff00001d // draft-29 used to be a widely deployed version Version1 VersionNumber = 0x1 Version2 VersionNumber = 0x6b3343cf ) // SupportedVersions lists the versions that the server supports // must be in sorted descending order -var SupportedVersions = []VersionNumber{Version1, Version2, VersionDraft29} +var SupportedVersions = []VersionNumber{Version1, Version2} // IsValidVersion says if the version is known to quic-go func IsValidVersion(v VersionNumber) bool { @@ -38,7 +38,7 @@ func (vn VersionNumber) String() string { switch vn { case VersionUnknown: return "unknown" - case VersionDraft29: + case versionDraft29: return "draft-29" case Version1: return "v1" diff --git a/internal/protocol/version_test.go b/internal/protocol/version_test.go index 7ef7891d17a..f1bceefcbed 100644 --- a/internal/protocol/version_test.go +++ b/internal/protocol/version_test.go @@ -12,7 +12,7 @@ var _ = Describe("Version", func() { It("says if a version is valid", func() { Expect(IsValidVersion(VersionUnknown)).To(BeFalse()) - Expect(IsValidVersion(VersionDraft29)).To(BeTrue()) + Expect(IsValidVersion(versionDraft29)).To(BeFalse()) Expect(IsValidVersion(Version1)).To(BeTrue()) Expect(IsValidVersion(Version2)).To(BeTrue()) Expect(IsValidVersion(1234)).To(BeFalse()) @@ -20,7 +20,7 @@ var _ = Describe("Version", func() { It("has the right string representation", func() { Expect(VersionUnknown.String()).To(Equal("unknown")) - Expect(VersionDraft29.String()).To(Equal("draft-29")) + Expect(versionDraft29.String()).To(Equal("draft-29")) Expect(Version1.String()).To(Equal("v1")) Expect(Version2.String()).To(Equal("v2")) // check with unsupported version numbers from the wiki diff --git a/internal/wire/header.go b/internal/wire/header.go index 37f48cced89..e2dc72e421f 100644 --- a/internal/wire/header.go +++ b/internal/wire/header.go @@ -108,7 +108,7 @@ func Is0RTTPacket(b []byte) bool { version := protocol.VersionNumber(binary.BigEndian.Uint32(b[1:5])) //nolint:exhaustive // We only need to test QUIC versions that we support. switch version { - case protocol.Version1, protocol.VersionDraft29: + case protocol.Version1: return b[0]>>4&0b11 == 0b01 case protocol.Version2: return b[0]>>4&0b11 == 0b10