aboutsummaryrefslogtreecommitdiffstats
path: root/go/blscgo
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-03-15 05:07:20 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-03-15 05:07:20 +0800
commitd085930d574264ae30c1091a9948c21b3160feb8 (patch)
treece192c0cd0bcc7e3e9a8402a3147409392159277 /go/blscgo
parenta148e716c06551b5ac143477c919548c9a682a03 (diff)
downloaddexon-bls-d085930d574264ae30c1091a9948c21b3160feb8.tar
dexon-bls-d085930d574264ae30c1091a9948c21b3160feb8.tar.gz
dexon-bls-d085930d574264ae30c1091a9948c21b3160feb8.tar.bz2
dexon-bls-d085930d574264ae30c1091a9948c21b3160feb8.tar.lz
dexon-bls-d085930d574264ae30c1091a9948c21b3160feb8.tar.xz
dexon-bls-d085930d574264ae30c1091a9948c21b3160feb8.tar.zst
dexon-bls-d085930d574264ae30c1091a9948c21b3160feb8.zip
add UNIT option to select bn256 or bn384
Diffstat (limited to 'go/blscgo')
-rw-r--r--go/blscgo/bls.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/go/blscgo/bls.go b/go/blscgo/bls.go
index f75945b..3d78ee0 100644
--- a/go/blscgo/bls.go
+++ b/go/blscgo/bls.go
@@ -2,6 +2,8 @@ package blscgo
/*
#cgo CFLAGS:-I../../include
+#cgo bn256 CFLAGS:-DBLS_MAX_OP_UNIT_SIZE=4
+#cgo bn384 CFLAGS:-DBLS_MAX_OP_UNIT_SIZE=6
#cgo LDFLAGS:-lbls -lbls_if -lmcl -lgmp -lgmpxx -L../lib -L../../lib -L../../../mcl/lib -L../../mcl/lib -lstdc++ -lcrypto
#include "bls_if.h"
*/
@@ -15,12 +17,12 @@ const CurveFp382_2 = 2
// Init --
func Init(curve int) {
- C.blsInit(C.int(curve))
+ C.blsInit(C.int(curve), C.BLS_MAX_OP_UNIT_SIZE)
}
// ID --
type ID struct {
- v [6]C.uint64_t
+ v [C.BLS_MAX_OP_UNIT_SIZE]C.uint64_t
}
// getPointer --
@@ -63,7 +65,7 @@ func (id *ID) Set(v []uint64) error {
// SecretKey --
type SecretKey struct {
- v [6]C.uint64_t
+ v [C.BLS_MAX_OP_UNIT_SIZE]C.uint64_t
}
// getPointer --
@@ -153,7 +155,7 @@ func (sec *SecretKey) GetPop() (sign *Sign) {
// PublicKey --
type PublicKey struct {
- v [6 * 2 * 3]C.uint64_t
+ v [C.BLS_MAX_OP_UNIT_SIZE * 2 * 3]C.uint64_t
}
// getPointer --
@@ -201,7 +203,7 @@ func (pub *PublicKey) Recover(pubVec []PublicKey, idVec []ID) {
// Sign --
type Sign struct {
- v [6 * 3]C.uint64_t
+ v [C.BLS_MAX_OP_UNIT_SIZE * 3]C.uint64_t
}
// getPointer --