diff --git a/internal/handshake/crypto_setup.go b/internal/handshake/crypto_setup.go index 9ce12088..16798b7a 100644 --- a/internal/handshake/crypto_setup.go +++ b/internal/handshake/crypto_setup.go @@ -652,7 +652,8 @@ func (h *cryptoSetup) dropInitialKeys() { h.logger.Debugf("Dropping Initial keys.") } -func (h *cryptoSetup) DropHandshakeKeys() { +func (h *cryptoSetup) SetHandshakeConfirmed() { + // drop Handshake keys var dropped bool h.mutex.Lock() if h.handshakeOpener != nil { diff --git a/internal/handshake/interface.go b/internal/handshake/interface.go index 3bf9dc06..b64cd015 100644 --- a/internal/handshake/interface.go +++ b/internal/handshake/interface.go @@ -77,7 +77,7 @@ type CryptoSetup interface { HandleMessage([]byte, protocol.EncryptionLevel) bool SetLargest1RTTAcked(protocol.PacketNumber) error - DropHandshakeKeys() + SetHandshakeConfirmed() ConnectionState() ConnectionState GetInitialOpener() (LongHeaderOpener, error) diff --git a/internal/mocks/crypto_setup.go b/internal/mocks/crypto_setup.go index fb247276..ba1d2965 100644 --- a/internal/mocks/crypto_setup.go +++ b/internal/mocks/crypto_setup.go @@ -76,18 +76,6 @@ func (mr *MockCryptoSetupMockRecorder) ConnectionState() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectionState", reflect.TypeOf((*MockCryptoSetup)(nil).ConnectionState)) } -// DropHandshakeKeys mocks base method -func (m *MockCryptoSetup) DropHandshakeKeys() { - m.ctrl.T.Helper() - m.ctrl.Call(m, "DropHandshakeKeys") -} - -// DropHandshakeKeys indicates an expected call of DropHandshakeKeys -func (mr *MockCryptoSetupMockRecorder) DropHandshakeKeys() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DropHandshakeKeys", reflect.TypeOf((*MockCryptoSetup)(nil).DropHandshakeKeys)) -} - // Get0RTTOpener mocks base method func (m *MockCryptoSetup) Get0RTTOpener() (handshake.LongHeaderOpener, error) { m.ctrl.T.Helper() @@ -249,6 +237,18 @@ func (mr *MockCryptoSetupMockRecorder) RunHandshake() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunHandshake", reflect.TypeOf((*MockCryptoSetup)(nil).RunHandshake)) } +// SetHandshakeConfirmed mocks base method +func (m *MockCryptoSetup) SetHandshakeConfirmed() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetHandshakeConfirmed") +} + +// SetHandshakeConfirmed indicates an expected call of SetHandshakeConfirmed +func (mr *MockCryptoSetupMockRecorder) SetHandshakeConfirmed() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHandshakeConfirmed", reflect.TypeOf((*MockCryptoSetup)(nil).SetHandshakeConfirmed)) +} + // SetLargest1RTTAcked mocks base method func (m *MockCryptoSetup) SetLargest1RTTAcked(arg0 protocol.PacketNumber) error { m.ctrl.T.Helper() diff --git a/session.go b/session.go index c776f9fb..ace8a8c9 100644 --- a/session.go +++ b/session.go @@ -52,7 +52,7 @@ type cryptoStreamHandler interface { RunHandshake() ChangeConnectionID(protocol.ConnectionID) SetLargest1RTTAcked(protocol.PacketNumber) error - DropHandshakeKeys() + SetHandshakeConfirmed() GetSessionTicket() ([]byte, error) io.Closer ConnectionState() handshake.ConnectionState @@ -705,7 +705,7 @@ func (s *session) handleHandshakeComplete() { s.closeLocal(err) } s.queueControlFrame(&wire.NewTokenFrame{Token: token}) - s.cryptoStreamHandler.DropHandshakeKeys() + s.cryptoStreamHandler.SetHandshakeConfirmed() s.queueControlFrame(&wire.HandshakeDoneFrame{}) } } @@ -1242,7 +1242,7 @@ func (s *session) handleHandshakeDoneFrame() error { } s.handshakeConfirmed = true s.sentPacketHandler.SetHandshakeConfirmed() - s.cryptoStreamHandler.DropHandshakeKeys() + s.cryptoStreamHandler.SetHandshakeConfirmed() return nil } diff --git a/session_test.go b/session_test.go index bf119243..cb01fbcf 100644 --- a/session_test.go +++ b/session_test.go @@ -1640,7 +1640,7 @@ var _ = Describe("Session", func() { defer GinkgoRecover() <-finishHandshake cryptoSetup.EXPECT().RunHandshake() - cryptoSetup.EXPECT().DropHandshakeKeys() + cryptoSetup.EXPECT().SetHandshakeConfirmed() cryptoSetup.EXPECT().GetSessionTicket() close(sess.handshakeCompleteChan) sess.run() @@ -1670,7 +1670,7 @@ var _ = Describe("Session", func() { defer GinkgoRecover() <-finishHandshake cryptoSetup.EXPECT().RunHandshake() - cryptoSetup.EXPECT().DropHandshakeKeys() + cryptoSetup.EXPECT().SetHandshakeConfirmed() cryptoSetup.EXPECT().GetSessionTicket().Return(make([]byte, size), nil) close(sess.handshakeCompleteChan) sess.run() @@ -1756,7 +1756,7 @@ var _ = Describe("Session", func() { go func() { defer GinkgoRecover() cryptoSetup.EXPECT().RunHandshake() - cryptoSetup.EXPECT().DropHandshakeKeys() + cryptoSetup.EXPECT().SetHandshakeConfirmed() cryptoSetup.EXPECT().GetSessionTicket() mconn.EXPECT().Write(gomock.Any()) close(sess.handshakeCompleteChan) @@ -2030,7 +2030,7 @@ var _ = Describe("Session", func() { defer GinkgoRecover() cryptoSetup.EXPECT().RunHandshake().MaxTimes(1) cryptoSetup.EXPECT().GetSessionTicket().MaxTimes(1) - cryptoSetup.EXPECT().DropHandshakeKeys().MaxTimes(1) + cryptoSetup.EXPECT().SetHandshakeConfirmed().MaxTimes(1) close(sess.handshakeCompleteChan) err := sess.run() nerr, ok := err.(net.Error) @@ -2277,7 +2277,7 @@ var _ = Describe("Client Session", func() { sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sess.sentPacketHandler = sph sph.EXPECT().SetHandshakeConfirmed() - cryptoSetup.EXPECT().DropHandshakeKeys() + cryptoSetup.EXPECT().SetHandshakeConfirmed() Expect(sess.handleHandshakeDoneFrame()).To(Succeed()) })