X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fcnw%2Fcnw_test.go;h=29e408f42405a6a0936b4e70f4c3bd84057e52f4;hb=f47fff1e42f75b736e7067ec06c2e81394833d46;hp=24cf4524f4eb19be623bbbbbe53565704aa44452;hpb=cecb63f12f4a9f523276a0c19c7feb7437c7f53a;p=govpn.git diff --git a/src/cypherpunks.ru/govpn/cnw/cnw_test.go b/src/cypherpunks.ru/govpn/cnw/cnw_test.go index 24cf452..29e408f 100644 --- a/src/cypherpunks.ru/govpn/cnw/cnw_test.go +++ b/src/cypherpunks.ru/govpn/cnw/cnw_test.go @@ -1,6 +1,6 @@ /* GoVPN -- simple secure free software virtual private network daemon -Copyright (C) 2014-2016 Sergey Matveev +Copyright (C) 2014-2017 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,16 +22,17 @@ import ( "bytes" "crypto/rand" "encoding/binary" + "io" "testing" "testing/quick" ) var ( - testKey *[32]byte = new([32]byte) + testKey = new([32]byte) ) func init() { - rand.Read(testKey[:]) + io.ReadFull(rand.Reader, testKey[:]) } func TestSymmetric(t *testing.T) { @@ -66,8 +67,8 @@ func TestSmallSize(t *testing.T) { func BenchmarkChaff(b *testing.B) { nonce := make([]byte, 8) data := make([]byte, 16) - rand.Read(nonce) - rand.Read(data) + io.ReadFull(rand.Reader, nonce) + io.ReadFull(rand.Reader, data) b.ResetTimer() for i := 0; i < b.N; i++ { Chaff(testKey, nonce, data) @@ -77,8 +78,8 @@ func BenchmarkChaff(b *testing.B) { func BenchmarkWinnow(b *testing.B) { nonce := make([]byte, 8) data := make([]byte, 16) - rand.Read(nonce) - rand.Read(data) + io.ReadFull(rand.Reader, nonce) + io.ReadFull(rand.Reader, data) chaffed := Chaff(testKey, nonce, data) b.ResetTimer() for i := 0; i < b.N; i++ {