aboutsummaryrefslogtreecommitdiffstats
path: root/src/kdf_test.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-09-01 14:31:57 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-09-01 14:31:57 +0200
commitc24b883c01fc932dd28add1ac0319459a007d498 (patch)
treef8eaf8fa466060874e7408972632efeef6ee7e8b /src/kdf_test.go
parentImproved handling of key-material (diff)
downloadwireguard-go-c24b883c01fc932dd28add1ac0319459a007d498.tar.xz
wireguard-go-c24b883c01fc932dd28add1ac0319459a007d498.zip
Fixed KDF tests
Diffstat (limited to 'src/kdf_test.go')
-rw-r--r--src/kdf_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/kdf_test.go b/src/kdf_test.go
index 0cce81d..a89dacc 100644
--- a/src/kdf_test.go
+++ b/src/kdf_test.go
@@ -2,6 +2,7 @@ package main
import (
"encoding/hex"
+ "golang.org/x/crypto/blake2s"
"testing"
)
@@ -44,10 +45,12 @@ func TestKDF(t *testing.T) {
},
}
+ var t0, t1, t2 [blake2s.Size]byte
+
for _, test := range tests {
key, _ := hex.DecodeString(test.key)
input, _ := hex.DecodeString(test.input)
- t0, t1, t2 := KDF3(key, input)
+ KDF3(&t0, &t1, &t2, key, input)
t0s := hex.EncodeToString(t0[:])
t1s := hex.EncodeToString(t1[:])
t2s := hex.EncodeToString(t2[:])
@@ -59,7 +62,7 @@ func TestKDF(t *testing.T) {
for _, test := range tests {
key, _ := hex.DecodeString(test.key)
input, _ := hex.DecodeString(test.input)
- t0, t1 := KDF2(key, input)
+ KDF2(&t0, &t1, key, input)
t0s := hex.EncodeToString(t0[:])
t1s := hex.EncodeToString(t1[:])
assertEquals(t, t0s, test.t0)
@@ -69,7 +72,7 @@ func TestKDF(t *testing.T) {
for _, test := range tests {
key, _ := hex.DecodeString(test.key)
input, _ := hex.DecodeString(test.input)
- t0 := KDF1(key, input)
+ KDF1(&t0, key, input)
t0s := hex.EncodeToString(t0[:])
assertEquals(t, t0s, test.t0)
}