don't drop Handshake keys when receiving an ACK for a 0-RTT packet

This commit is contained in:
Marten Seemann
2019-06-27 13:05:09 +08:00
parent d6b50cf15a
commit 0b65a0c75e
2 changed files with 16 additions and 0 deletions

View File

@@ -75,6 +75,13 @@ var _ = Describe("Updatable AEAD", func() {
Expect(opened).To(Equal(msg))
})
It("saves the first packet number", func() {
client.Seal(nil, msg, 0x1337, ad)
Expect(client.FirstPacketNumber()).To(Equal(protocol.PacketNumber(0x1337)))
client.Seal(nil, msg, 0x1338, ad)
Expect(client.FirstPacketNumber()).To(Equal(protocol.PacketNumber(0x1337)))
})
It("fails to open a message if the associated data is not the same", func() {
encrypted := client.Seal(nil, msg, 0x1337, ad)
_, err := server.Open(nil, encrypted, time.Now(), 0x1337, protocol.KeyPhaseZero, []byte("wrong ad"))