improve crypto test coverage

This commit is contained in:
Lucas Clemente
2016-05-30 10:16:25 +02:00
parent 576253ba71
commit b0bc84c5aa
7 changed files with 76 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ type NullAEAD struct{}
var _ AEAD = &NullAEAD{}
// Open and verify the ciphertext
func (*NullAEAD) Open(packetNumber protocol.PacketNumber, associatedData []byte, ciphertext []byte) ([]byte, error) {
func (NullAEAD) Open(packetNumber protocol.PacketNumber, associatedData []byte, ciphertext []byte) ([]byte, error) {
if len(ciphertext) < 12 {
return nil, errors.New("NullAEAD: ciphertext cannot be less than 12 bytes long")
}
@@ -34,7 +34,7 @@ func (*NullAEAD) Open(packetNumber protocol.PacketNumber, associatedData []byte,
}
// Seal writes hash and ciphertext to the buffer
func (*NullAEAD) Seal(packetNumber protocol.PacketNumber, associatedData []byte, plaintext []byte) []byte {
func (NullAEAD) Seal(packetNumber protocol.PacketNumber, associatedData []byte, plaintext []byte) []byte {
res := make([]byte, 12+len(plaintext))
hash := fnv128a.New()