From b1d28426d5ee61bc2bf5e5639aa908b67a10c1c9 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 12 Dec 2016 15:23:47 -0800 Subject: [PATCH] brontide: properly pack nonce as 96-bit little endian value --- brontide/noise.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brontide/noise.go b/brontide/noise.go index 4924ee10..e4bb684c 100644 --- a/brontide/noise.go +++ b/brontide/noise.go @@ -93,7 +93,7 @@ func (c *cipherState) Encrypt(associatedData, cipherText, plainText []byte) []by }() var nonce [12]byte - binary.LittleEndian.PutUint64(nonce[:], c.nonce) + binary.LittleEndian.PutUint64(nonce[4:], c.nonce) return c.cipher.Seal(cipherText, nonce[:], plainText, associatedData) } @@ -111,7 +111,7 @@ func (c *cipherState) Decrypt(associatedData, plainText, cipherText []byte) ([]b }() var nonce [12]byte - binary.LittleEndian.PutUint64(nonce[:], c.nonce) + binary.LittleEndian.PutUint64(nonce[4:], c.nonce) return c.cipher.Open(plainText, nonce[:], cipherText, associatedData) }