From 75208d3bd90a9ce8852850f611b141848f4ef135 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 7 Sep 2016 09:15:39 +0900 Subject: pass the pointer of Id --- go/bls/bls.go | 4 ++-- go/main.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'go') diff --git a/go/bls/bls.go b/go/bls/bls.go index 976c884..97f0fe4 100644 --- a/go/bls/bls.go +++ b/go/bls/bls.go @@ -155,7 +155,7 @@ func makeIdPointerArray(v []Id) (pv []*C.blsId) { } return pv } -func (sec *SecretKey) Set(msk []SecretKey, id Id) { +func (sec *SecretKey) Set(msk []SecretKey, id *Id) { v := makeSecretKeyPointerArray(msk) C.blsSecretKeySet(sec.self, (**C.blsSecretKey)(unsafe.Pointer(&v[0])), C.size_t(len(msk)), id.self) } @@ -208,7 +208,7 @@ func (pub *PublicKey) SetStr(s string) error { func (pub *PublicKey) Add(rhs *PublicKey) { C.blsPublicKeyAdd(pub.self, rhs.self); } -func (sec *PublicKey) Set(msk []PublicKey, id Id) { +func (sec *PublicKey) Set(msk []PublicKey, id *Id) { v := makePublicKeyPointerArray(msk) C.blsPublicKeySet(sec.self, (**C.blsPublicKey)(unsafe.Pointer(&v[0])), C.size_t(len(msk)), id.self) } diff --git a/go/main.go b/go/main.go index 1ad8cc1..73bdd43 100644 --- a/go/main.go +++ b/go/main.go @@ -25,7 +25,7 @@ func testRecoverSecretKey() { idVec[i] = *bls.NewId() idVec[i].Set([]uint64{1, 2, 3, uint64(i)}) secVec[i] = *bls.NewSecretKey() - secVec[i].Set(msk, idVec[i]) + secVec[i].Set(msk, &idVec[i]) } // recover sec2 from secVec and idVec sec2 := bls.NewSecretKey() @@ -61,10 +61,10 @@ func testSign() { fmt.Printf("idVec[%d]=%s\n", i, idVec[i].String()) secVec[i] = *bls.NewSecretKey() - secVec[i].Set(msk, idVec[i]) + secVec[i].Set(msk, &idVec[i]) pubVec[i] = *bls.NewPublicKey() - pubVec[i].Set(mpk, idVec[i]) + pubVec[i].Set(mpk, &idVec[i]) fmt.Printf("pubVec[%d]=%s\n", i, pubVec[i].String()) verifyTrue(pubVec[i].String() == secVec[i].GetPublicKey().String()) -- cgit v1.2.3