summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-08-17 17:19:06 -0700
committerGitHub <noreply@github.com>2017-08-17 17:19:06 -0700
commit96eab1202717e073782ec399a4e0820cae15b1bb (patch)
tree011012982be971c7e9ef91466f026bc0956ac9a2 /vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go
parent2c895ee66eed626721135acfcc48254c6e3f3b29 (diff)
downloadchat-96eab1202717e073782ec399a4e0820cae15b1bb.tar.gz
chat-96eab1202717e073782ec399a4e0820cae15b1bb.tar.bz2
chat-96eab1202717e073782ec399a4e0820cae15b1bb.zip
Updating server dependancies. (#7246)
Diffstat (limited to 'vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go')
-rw-r--r--vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go b/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go
index f8cecd9e6..f67e94eba 100644
--- a/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go
+++ b/vendor/golang.org/x/crypto/salsa20/salsa/salsa_test.go
@@ -33,3 +33,22 @@ func TestCore208(t *testing.T) {
t.Errorf("expected %x, got %x", out, in)
}
}
+
+func TestOutOfBoundsWrite(t *testing.T) {
+ // encrypted "0123456789"
+ cipherText := []byte{170, 166, 196, 104, 175, 121, 68, 44, 174, 51}
+ var counter [16]byte
+ var key [32]byte
+ want := "abcdefghij"
+ plainText := []byte(want)
+ defer func() {
+ err := recover()
+ if err == nil {
+ t.Error("XORKeyStream expected to panic on len(dst) < len(src), but didn't")
+ }
+ if plainText[3] == '3' {
+ t.Errorf("XORKeyStream did out of bounds write, want %v, got %v", want, string(plainText))
+ }
+ }()
+ XORKeyStream(plainText[:3], cipherText, &counter, &key)
+}