implement AES-GCM as AEAD

This commit is contained in:
Lucas Clemente
2016-04-14 09:56:39 +02:00
parent 3588f24ad4
commit 8b7e2744da
6 changed files with 139 additions and 9 deletions

View File

@@ -16,7 +16,7 @@ type NullAEAD struct{}
var _ AEAD = &NullAEAD{}
// Open and verify the ciphertext
func (*NullAEAD) Open(associatedData []byte, r io.Reader) (*bytes.Reader, error) {
func (*NullAEAD) Open(packetNumber uint64, associatedData []byte, r io.Reader) (*bytes.Reader, error) {
ciphertext, err := ioutil.ReadAll(r)
if err != nil {
return nil, err
@@ -40,7 +40,7 @@ func (*NullAEAD) Open(associatedData []byte, r io.Reader) (*bytes.Reader, error)
}
// Seal writes hash and ciphertext to the buffer
func (*NullAEAD) Seal(b *bytes.Buffer, associatedData []byte, plaintext []byte) {
func (*NullAEAD) Seal(packetNumber uint64, b *bytes.Buffer, associatedData []byte, plaintext []byte) {
hash := New128a()
hash.Write(associatedData)
hash.Write(plaintext)