don’t send more than 3 CHLOs

makes sure that the server allows the client to make progress in the handshake
This commit is contained in:
Marten Seemann
2016-12-01 14:40:04 +07:00
parent 7f2e706908
commit 2131e8fa6d
3 changed files with 34 additions and 7 deletions

View File

@@ -403,6 +403,17 @@ var _ = Describe("Crypto setup", func() {
Expect(tags[TagNONC]).To(Equal(cs.nonc))
Expect(tags[TagPUBS]).To(Equal(kex.PublicKey()))
})
It("doesn't send more than MaxClientHellos CHLOs", func() {
Expect(cs.clientHelloCounter).To(BeZero())
for i := 1; i <= protocol.MaxClientHellos; i++ {
err := cs.sendCHLO()
Expect(err).ToNot(HaveOccurred())
Expect(cs.clientHelloCounter).To(Equal(i))
}
err := cs.sendCHLO()
Expect(err).To(MatchError(qerr.Error(qerr.CryptoTooManyRejects, fmt.Sprintf("More than %d rejects", protocol.MaxClientHellos))))
})
})
Context("escalating crypto", func() {