From b3f0f51775ae2e19c62c70e15f77ef991ad4bb49 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Sat, 24 May 2014 04:47:10 +0000 Subject: Move utils.go to csrand/csrand.go, and clean up the interface. All of the obfs4 code except unit tests now uses the csrand wrapper routines. --- ntor/ntor.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ntor/ntor.go') diff --git a/ntor/ntor.go b/ntor/ntor.go index eecf038..4483a6b 100644 --- a/ntor/ntor.go +++ b/ntor/ntor.go @@ -39,7 +39,6 @@ package ntor import ( "bytes" "crypto/hmac" - "crypto/rand" "crypto/sha256" "crypto/subtle" "encoding/base64" @@ -50,6 +49,8 @@ import ( "code.google.com/p/go.crypto/hkdf" "github.com/agl/ed25519/extra25519" + + "github.com/yawning/obfs4/csrand" ) const ( @@ -266,7 +267,7 @@ func NewKeypair(elligator bool) (*Keypair, error) { // Generate a Curve25519 private key. Like everyone who does this, // run the CSPRNG output through SHA256 for extra tinfoil hattery. priv := keypair.private.Bytes()[:] - _, err := rand.Read(priv) + err := csrand.Bytes(priv) if err != nil { return nil, err } -- cgit v1.2.3