From 2fffad94bc1ec8a9c3794abf65926ed519735e34 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 26 Jan 2019 16:40:35 +0800 Subject: [PATCH] ignore post-handshake CRYPTO frames --- crypto_stream_manager.go | 3 +++ crypto_stream_manager_test.go | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crypto_stream_manager.go b/crypto_stream_manager.go index 330b26da..64e78781 100644 --- a/crypto_stream_manager.go +++ b/crypto_stream_manager.go @@ -37,6 +37,9 @@ func (m *cryptoStreamManager) HandleCryptoFrame(frame *wire.CryptoFrame, encLeve str = m.initialStream case protocol.EncryptionHandshake: str = m.handshakeStream + case protocol.Encryption1RTT: + // TODO(#981): process session tickets + return false, nil default: return false, fmt.Errorf("received CRYPTO frame with unexpected encryption level: %s", encLevel) } diff --git a/crypto_stream_manager_test.go b/crypto_stream_manager_test.go index b57a0299..0c331cb4 100644 --- a/crypto_stream_manager_test.go +++ b/crypto_stream_manager_test.go @@ -98,8 +98,15 @@ var _ = Describe("Crypto Stream Manager", func() { Expect(err).To(MatchError(err)) }) + It("ignores post-handshake crypto data", func() { + changed, err := csm.HandleCryptoFrame(&wire.CryptoFrame{}, protocol.Encryption1RTT) + Expect(err).ToNot(HaveOccurred()) + Expect(changed).To(BeFalse()) + }) + It("errors for unknown encryption levels", func() { - _, err := csm.HandleCryptoFrame(&wire.CryptoFrame{}, protocol.Encryption1RTT) - Expect(err).To(MatchError("received CRYPTO frame with unexpected encryption level: 1-RTT")) + _, err := csm.HandleCryptoFrame(&wire.CryptoFrame{}, 42) + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("received CRYPTO frame with unexpected encryption level")) }) })