mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
drop 0-RTT write keys when receiving the 1-RTT keys
This commit is contained in:
parent
40a993e31c
commit
22abcfe6fb
2 changed files with 4 additions and 12 deletions
|
@ -568,6 +568,10 @@ func (h *cryptoSetup) SetWriteKey(encLevel qtls.EncryptionLevel, suite *qtls.Cip
|
||||||
h.aead.SetWriteKey(suite, trafficSecret)
|
h.aead.SetWriteKey(suite, trafficSecret)
|
||||||
h.has1RTTSealer = true
|
h.has1RTTSealer = true
|
||||||
h.logger.Debugf("Installed 1-RTT Write keys (using %s)", cipherSuiteName(suite.ID))
|
h.logger.Debugf("Installed 1-RTT Write keys (using %s)", cipherSuiteName(suite.ID))
|
||||||
|
if h.zeroRTTSealer != nil {
|
||||||
|
h.zeroRTTSealer = nil
|
||||||
|
h.logger.Debugf("Dropping 0-RTT keys.")
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
panic("unexpected write encryption level")
|
panic("unexpected write encryption level")
|
||||||
}
|
}
|
||||||
|
|
|
@ -720,18 +720,6 @@ var _ = Describe("Crypto Setup TLS", func() {
|
||||||
|
|
||||||
Expect(server.ConnectionState().DidResume).To(BeTrue())
|
Expect(server.ConnectionState().DidResume).To(BeTrue())
|
||||||
Expect(client.ConnectionState().DidResume).To(BeTrue())
|
Expect(client.ConnectionState().DidResume).To(BeTrue())
|
||||||
opener, err := server.Get0RTTOpener()
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
Expect(opener).ToNot(BeNil())
|
|
||||||
sealer, err := client.Get0RTTSealer()
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
Expect(sealer).ToNot(BeNil())
|
|
||||||
// use the 0-RTT sealer and opener to encrypt and decrypt a message
|
|
||||||
plaintext := []byte("Lorem ipsum dolor sit amet")
|
|
||||||
msg := sealer.Seal(nil, plaintext, 0x1337, []byte("foobar"))
|
|
||||||
decrypted, err := opener.Open(nil, msg, 0x1337, []byte("foobar"))
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
Expect(decrypted).To(Equal(plaintext))
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue