diff options
Diffstat (limited to 'ffi/go/bls')
-rw-r--r-- | ffi/go/bls/bls.go | 6 | ||||
-rw-r--r-- | ffi/go/bls/bls_test.go | 7 |
2 files changed, 6 insertions, 7 deletions
diff --git a/ffi/go/bls/bls.go b/ffi/go/bls/bls.go index 2374d2e..2e57460 100644 --- a/ffi/go/bls/bls.go +++ b/ffi/go/bls/bls.go @@ -390,7 +390,7 @@ func (sign *Sign) VerifyAggregateHashes(pubVec []PublicKey, hash [][]byte) bool /// -var s_randReader *io.Reader +var s_randReader io.Reader func createSlice(buf *C.char, n C.uint) []byte { size := int(n) @@ -401,7 +401,7 @@ func createSlice(buf *C.char, n C.uint) []byte { //export wrapReadRandGo func wrapReadRandGo(buf *C.char, n C.uint) C.uint { slice := createSlice(buf, n) - ret, err := (*s_randReader).Read(slice) + ret, err := s_randReader.Read(slice) if ret == int(n) && err == nil { return n } @@ -409,7 +409,7 @@ func wrapReadRandGo(buf *C.char, n C.uint) C.uint { } // SetRandFunc -- -func SetRandFunc(randReader *io.Reader) { +func SetRandFunc(randReader io.Reader) { s_randReader = randReader if randReader != nil { C.blsSetRandFunc(nil, C.ReadRandFunc(unsafe.Pointer(C.wrapReadRandCgo))) diff --git a/ffi/go/bls/bls_test.go b/ffi/go/bls/bls_test.go index b020682..bfed6c2 100644 --- a/ffi/go/bls/bls_test.go +++ b/ffi/go/bls/bls_test.go @@ -5,7 +5,6 @@ import "strconv" import "crypto/sha256" import "crypto/sha512" import "fmt" -import "io" import "crypto/rand" var unitN = 0 @@ -462,8 +461,8 @@ func (self *SeqRead) Read(buf []byte) (int, error) { } func testReadRand(t *testing.T) { - var s1 io.Reader = &SeqRead{} - SetRandFunc(&s1) + s1 := new(SeqRead) + SetRandFunc(s1) var sec SecretKey sec.SetByCSPRNG() buf := sec.GetLittleEndian() @@ -474,7 +473,7 @@ func testReadRand(t *testing.T) { t.Fatal("buf") } } - SetRandFunc(&rand.Reader) + SetRandFunc(rand.Reader) sec.SetByCSPRNG() buf = sec.GetLittleEndian() fmt.Printf("(rand.Reader) buf=%x\n", buf) |