aboutsummaryrefslogtreecommitdiffstats
path: root/go/blscgo
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-03-14 21:27:53 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-03-14 21:27:53 +0800
commita148e716c06551b5ac143477c919548c9a682a03 (patch)
tree50a4ee2734cad50c7faa2915d5174ea7f200f161 /go/blscgo
parentfba189073130bad49061f451faef69533961c635 (diff)
downloaddexon-bls-a148e716c06551b5ac143477c919548c9a682a03.tar
dexon-bls-a148e716c06551b5ac143477c919548c9a682a03.tar.gz
dexon-bls-a148e716c06551b5ac143477c919548c9a682a03.tar.bz2
dexon-bls-a148e716c06551b5ac143477c919548c9a682a03.tar.lz
dexon-bls-a148e716c06551b5ac143477c919548c9a682a03.tar.xz
dexon-bls-a148e716c06551b5ac143477c919548c9a682a03.tar.zst
dexon-bls-a148e716c06551b5ac143477c919548c9a682a03.zip
start to support 384-bit curve
Diffstat (limited to 'go/blscgo')
-rw-r--r--go/blscgo/bls.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/go/blscgo/bls.go b/go/blscgo/bls.go
index bd0cd2d..f75945b 100644
--- a/go/blscgo/bls.go
+++ b/go/blscgo/bls.go
@@ -9,14 +9,18 @@ import "C"
import "fmt"
import "unsafe"
+const CurveFp254BNb = 0
+const CurveFp382_1 = 1
+const CurveFp382_2 = 2
+
// Init --
-func Init() {
- C.blsInit()
+func Init(curve int) {
+ C.blsInit(C.int(curve))
}
// ID --
type ID struct {
- v [4]C.uint64_t
+ v [6]C.uint64_t
}
// getPointer --
@@ -49,8 +53,8 @@ func (id *ID) SetStr(s string) error {
// Set --
func (id *ID) Set(v []uint64) error {
- if len(v) != 4 {
- return fmt.Errorf("bad size (%d), expected size 4", len(v))
+ if len(v) != 6 {
+ return fmt.Errorf("bad size (%d), expected size 6", len(v))
}
// #nosec
C.blsIdSet(id.getPointer(), (*C.uint64_t)(unsafe.Pointer(&v[0])))
@@ -59,7 +63,7 @@ func (id *ID) Set(v []uint64) error {
// SecretKey --
type SecretKey struct {
- v [4]C.uint64_t
+ v [6]C.uint64_t
}
// getPointer --
@@ -92,8 +96,8 @@ func (sec *SecretKey) SetStr(s string) error {
// SetArray --
func (sec *SecretKey) SetArray(v []uint64) error {
- if len(v) != 4 {
- return fmt.Errorf("bad size (%d), expected size 4", len(v))
+ if len(v) != 6 {
+ return fmt.Errorf("bad size (%d), expected size 6", len(v))
}
// #nosec
C.blsSecretKeySetArray(sec.getPointer(), (*C.uint64_t)(unsafe.Pointer(&v[0])))
@@ -149,7 +153,7 @@ func (sec *SecretKey) GetPop() (sign *Sign) {
// PublicKey --
type PublicKey struct {
- v [4 * 2 * 3]C.uint64_t
+ v [6 * 2 * 3]C.uint64_t
}
// getPointer --
@@ -197,7 +201,7 @@ func (pub *PublicKey) Recover(pubVec []PublicKey, idVec []ID) {
// Sign --
type Sign struct {
- v [4 * 3]C.uint64_t
+ v [6 * 3]C.uint64_t
}
// getPointer --