]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
go test: use x/crypto for blake2s now that we have 128-bit mac
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 6 Jun 2017 14:50:20 +0000 (16:50 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 8 Jun 2017 02:24:13 +0000 (04:24 +0200)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
contrib/external-tests/go/main.go

index 4081bb5d0316fe2b58999e6f97795655d54f2e9d..e3627f33fb36f8dd3b88a14c78d159194a51890c 100644 (file)
@@ -10,10 +10,10 @@ import (
        "net"
        "time"
 
-       "github.com/dchest/blake2s"
        "github.com/titanous/noise"
        "golang.org/x/net/icmp"
        "golang.org/x/net/ipv4"
+       "golang.org/x/crypto/blake2s"
 )
 
 func ipChecksum(buf []byte) uint16 {
@@ -69,10 +69,10 @@ func main() {
        initiationPacket[3] = 0                                 // Reserved
        binary.LittleEndian.PutUint32(initiationPacket[4:], 28) // Sender index: 28 (arbitrary)
        initiationPacket, _, _ = hs.WriteMessage(initiationPacket, tai64n)
-       hasher, _ := blake2s.New(&blake2s.Config{Size: 32})
+       hasher, _ := blake2s.New256(nil)
        hasher.Write([]byte("mac1----"))
        hasher.Write(theirPublic)
-       hasher, _ = blake2s.New(&blake2s.Config{Size: 16, Key: hasher.Sum(nil)})
+       hasher, _ = blake2s.New128(hasher.Sum(nil))
        hasher.Write(initiationPacket)
        initiationPacket = append(initiationPacket, hasher.Sum(nil)[:16]...)
        initiationPacket = append(initiationPacket, make([]byte, 16)...)