don't send greased version numbers for gQUIC

This commit is contained in:
Marten Seemann 2018-02-25 19:35:10 +08:00
parent e26c1f09de
commit 2ab2baf4bc
4 changed files with 4 additions and 9 deletions

View file

@ -429,7 +429,7 @@ func (h *cryptoSetupServer) handleCHLO(sni string, data []byte, cryptoData map[T
replyMap := h.params.getHelloMap() replyMap := h.params.getHelloMap()
// add crypto parameters // add crypto parameters
verTag := &bytes.Buffer{} verTag := &bytes.Buffer{}
for _, v := range protocol.GetGreasedVersions(h.supportedVersions) { for _, v := range h.supportedVersions {
utils.BigEndian.WriteUint32(verTag, uint32(v)) utils.BigEndian.WriteUint32(verTag, uint32(v))
} }
replyMap[TagPUBS] = ephermalKex.PublicKey() replyMap[TagPUBS] = ephermalKex.PublicKey()

View file

@ -317,8 +317,7 @@ var _ = Describe("Server Crypto Setup", func() {
Expect(message.Data).To(HaveKeyWithValue(TagPUBS, []byte("ephermal pub"))) Expect(message.Data).To(HaveKeyWithValue(TagPUBS, []byte("ephermal pub")))
Expect(message.Data).To(HaveKey(TagSNO)) Expect(message.Data).To(HaveKey(TagSNO))
Expect(message.Data).To(HaveKey(TagVER)) Expect(message.Data).To(HaveKey(TagVER))
// the supported versions should include one reserved version number Expect(message.Data[TagVER]).To(HaveLen(4 * len(supportedVersions)))
Expect(message.Data[TagVER]).To(HaveLen(4*len(supportedVersions) + 4))
for _, v := range supportedVersions { for _, v := range supportedVersions {
b := &bytes.Buffer{} b := &bytes.Buffer{}
utils.BigEndian.WriteUint32(b, uint32(v)) utils.BigEndian.WriteUint32(b, uint32(v))

View file

@ -21,7 +21,7 @@ func ComposeGQUICVersionNegotiation(connID protocol.ConnectionID, versions []pro
utils.Errorf("error composing version negotiation packet: %s", err.Error()) utils.Errorf("error composing version negotiation packet: %s", err.Error())
return nil return nil
} }
for _, v := range protocol.GetGreasedVersions(versions) { for _, v := range versions {
utils.BigEndian.WriteUint32(buf, uint32(v)) utils.BigEndian.WriteUint32(buf, uint32(v))
} }
return buf.Bytes() return buf.Bytes()

View file

@ -16,11 +16,7 @@ var _ = Describe("Version Negotiation Packets", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(hdr.VersionFlag).To(BeTrue()) Expect(hdr.VersionFlag).To(BeTrue())
Expect(hdr.ConnectionID).To(Equal(protocol.ConnectionID(0x1337))) Expect(hdr.ConnectionID).To(Equal(protocol.ConnectionID(0x1337)))
// the supported versions should include one reserved version number Expect(hdr.SupportedVersions).To(Equal(versions))
Expect(hdr.SupportedVersions).To(HaveLen(len(versions) + 1))
for _, version := range versions {
Expect(hdr.SupportedVersions).To(ContainElement(version))
}
}) })
It("writes in IETF draft style", func() { It("writes in IETF draft style", func() {