From 506a8c954aed52f3dbb62096ce44f5ae6ef8b104 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Fri, 25 Oct 2019 15:27:47 +0900 Subject: [PATCH] [go] add some configration functions --- ffi/go/mcl/mcl.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ffi/go/mcl/mcl.go b/ffi/go/mcl/mcl.go index cf5a8fc..c9658af 100644 --- a/ffi/go/mcl/mcl.go +++ b/ffi/go/mcl/mcl.go @@ -123,6 +123,22 @@ func SetETHserialization(enable bool) { C.mclBn_setETHserialization(bool2Cint(enable)) } +// SetOriginalG2cofactor -- true if BLS_ETH is defined +func SetOriginalG2cofactor(enable bool) { + // #nosec + C.mclBn_setOriginalG2cofactor(bool2Cint(enable)) +} + +// SetMapToMode -- +func SetMapToMode(mode int) error { + // #nosec + err := C.mclBn_setMapToMode((C.int)(mode)) + if err != 0 { + return fmt.Errorf("SetMapToMode mode=%d\n", mode) + } + return nil +} + // Fr -- type Fr struct { v C.mclBnFr @@ -597,6 +613,7 @@ func (x *G1) Deserialize(buf []byte) error { } const ZERO_HEADER = 1 << 6 + func isZeroFormat(buf []byte, n int) bool { if len(buf) < n { return false