From 9e2ff7df572e023d50c07b2a12683324d5b3e331 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Mon, 30 Mar 2020 13:23:55 -0500 Subject: [PATCH] Correct typos in noise.go (#205) --- main.go | 4 ++-- noise.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 266cca8..264274a 100644 --- a/main.go +++ b/main.go @@ -299,9 +299,9 @@ func Main(configPath string, configTest bool, buildVersion string) { switch ifConfig.Cipher { case "aes": - noiseEndiannes = binary.BigEndian + noiseEndianness = binary.BigEndian case "chachapoly": - noiseEndiannes = binary.LittleEndian + noiseEndianness = binary.LittleEndian default: l.Fatalf("Unknown cipher: %v", ifConfig.Cipher) } diff --git a/noise.go b/noise.go index 29e80ef..543bb52 100644 --- a/noise.go +++ b/noise.go @@ -8,11 +8,11 @@ import ( "github.com/flynn/noise" ) -type endiannes interface { +type endianness interface { PutUint64(b []byte, v uint64) } -var noiseEndiannes endiannes = binary.BigEndian +var noiseEndianness endianness = binary.BigEndian type NebulaCipherState struct { c noise.Cipher @@ -37,7 +37,7 @@ func (s *NebulaCipherState) EncryptDanger(out, ad, plaintext []byte, n uint64, n nb[1] = 0 nb[2] = 0 nb[3] = 0 - noiseEndiannes.PutUint64(nb[4:], n) + noiseEndianness.PutUint64(nb[4:], n) out = s.c.(cipher.AEAD).Seal(out, nb, plaintext, ad) //l.Debugf("Encryption: outlen: %d, nonce: %d, ad: %s, plainlen %d", len(out), n, ad, len(plaintext)) return out, nil @@ -52,7 +52,7 @@ func (s *NebulaCipherState) DecryptDanger(out, ad, ciphertext []byte, n uint64, nb[1] = 0 nb[2] = 0 nb[3] = 0 - noiseEndiannes.PutUint64(nb[4:], n) + noiseEndianness.PutUint64(nb[4:], n) return s.c.(cipher.AEAD).Open(out, nb, ciphertext, ad) } else { return []byte{}, nil