diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2018-12-06 10:49:06 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2018-12-06 10:49:06 +0800 |
commit | e17ebfd57bcc6b97d7012811527fbad93952f655 (patch) | |
tree | 4e7aa62c6cae55d2a8f5fdcd8a46bd95a3c78602 | |
parent | f63e122a2cff8d0e20288b897c449a42cdf84897 (diff) | |
download | dexon-bls-e17ebfd57bcc6b97d7012811527fbad93952f655.tar.gz dexon-bls-e17ebfd57bcc6b97d7012811527fbad93952f655.tar.zst dexon-bls-e17ebfd57bcc6b97d7012811527fbad93952f655.zip |
[Go] use bls384 unless tags is specified
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | ffi/go/bls/bls.go | 4 | ||||
-rw-r--r-- | ffi/go/bls/config.h | 6 | ||||
-rw-r--r-- | ffi/go/bls/mcl.go | 1 | ||||
-rw-r--r-- | readme.md | 4 |
5 files changed, 16 insertions, 3 deletions
@@ -106,6 +106,9 @@ ifeq ($(OS),mac) MAC_GO_LDFLAGS="-ldflags=-s" endif # PATH is for mingw, LD_RUN_PATH is for linux, DYLD_LIBRARY_PATH is for mac +# use bls384 unless tags is specified +test_go_default: ffi/go/bls/bls.go ffi/go/bls/bls_test.go $(BLS384_SLIB) + cd ffi/go/bls && env PATH=$$PATH:../../../lib LD_RUN_PATH="../../../lib" DYLD_LIBRARY_PATH="../../../lib" go test $(MAC_GO_LDFLAGS) . test_go256: ffi/go/bls/bls.go ffi/go/bls/bls_test.go $(BLS256_SLIB) cd ffi/go/bls && env PATH=$$PATH:../../../lib LD_RUN_PATH="../../../lib" DYLD_LIBRARY_PATH="../../../lib" go test $(MAC_GO_LDFLAGS) -tags bn256 . test_go384: ffi/go/bls/bls.go ffi/go/bls/bls_test.go $(BLS384_SLIB) @@ -114,6 +117,7 @@ test_go384_256: ffi/go/bls/bls.go ffi/go/bls/bls_test.go $(BLS384_256_SLIB) cd ffi/go/bls && env PATH=$$PATH:../../../lib LD_RUN_PATH="../../../lib" DYLD_LIBRARY_PATH="../../../lib" go test $(MAC_GO_LDFLAGS) -tags bn384_256 . test_go: + $(MAKE) test_go_default $(MAKE) test_go256 $(MAKE) test_go384 $(MAKE) test_go384_256 diff --git a/ffi/go/bls/bls.go b/ffi/go/bls/bls.go index cb7074c..90fc264 100644 --- a/ffi/go/bls/bls.go +++ b/ffi/go/bls/bls.go @@ -8,7 +8,9 @@ package bls #cgo bn384 LDFLAGS:-lbls384_dy #cgo bn384_256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 -DMCLBN_FR_UNIT_SIZE=4 #cgo bn384_256 LDFLAGS:-lbls384_256_dy -#cgo LDFLAGS:-L../../../lib -lcrypto -lgmp -lgmpxx -lstdc++ +#cgo LDFLAGS:-L../../../lib -lbls384_dy +#cgo LDFLAGS:-lcrypto -lgmp -lgmpxx -lstdc++ +#include "config.h" #include <bls/bls.h> */ import "C" diff --git a/ffi/go/bls/config.h b/ffi/go/bls/config.h new file mode 100644 index 0000000..07e1481 --- /dev/null +++ b/ffi/go/bls/config.h @@ -0,0 +1,6 @@ +#pragma +// use bn384 unless tags is specified +#ifndef MCLBN_FP_UNIT_SIZE + #define MCLBN_FP_UNIT_SIZE 6 +#endif + diff --git a/ffi/go/bls/mcl.go b/ffi/go/bls/mcl.go index 776536f..a808bad 100644 --- a/ffi/go/bls/mcl.go +++ b/ffi/go/bls/mcl.go @@ -4,6 +4,7 @@ package bls #cgo bn256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=4 #cgo bn384 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 #cgo bn384_256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 -DMCLBN_FR_UNIT_SIZE=4 +#include "config.h" #include <mcl/bn.h> */ import "C" @@ -16,10 +16,10 @@ git clone git://github.com/herumi/cybozulib_ext ; for only Windows ``` # News -* -tags options is necessary for golang binding +* -tags option for Go bindings * -tags bn256 * -tags bn384\_256 - * -tags bn384 ; previous version + * -tags bn384 ; default mode * Support swap of G1 and G2 * `make BLS_SWAP_G=1` then G1 is assigned to PublicKey and G2 is assigned to Signature. * golang binding does not support this feature yet. |