include peer perspective in nullAEAD

ref #375
This commit is contained in:
Marten Seemann 2017-01-04 10:02:45 +07:00
parent c62fa83248
commit 3c223b22a2
No known key found for this signature in database
GPG key ID: 3603F40B121FCDEA
8 changed files with 93 additions and 37 deletions

View file

@ -17,11 +17,13 @@ type mockAEAD struct {
}
func (m *mockAEAD) Open(dst, src []byte, packetNumber protocol.PacketNumber, associatedData []byte) ([]byte, protocol.EncryptionLevel, error) {
res, err := (&crypto.NullAEAD{}).Open(dst, src, packetNumber, associatedData)
nullAEAD := crypto.NewNullAEAD(protocol.PerspectiveServer, protocol.VersionWhatever)
res, err := nullAEAD.Open(dst, src, packetNumber, associatedData)
return res, m.encLevelOpen, err
}
func (m *mockAEAD) Seal(dst, src []byte, packetNumber protocol.PacketNumber, associatedData []byte) ([]byte, protocol.EncryptionLevel) {
return (&crypto.NullAEAD{}).Seal(dst, src, packetNumber, associatedData), protocol.EncryptionUnspecified
nullAEAD := crypto.NewNullAEAD(protocol.PerspectiveServer, protocol.VersionWhatever)
return nullAEAD.Seal(dst, src, packetNumber, associatedData), protocol.EncryptionUnspecified
}
var _ quicAEAD = &mockAEAD{}