From d33f8c6856db908f81498de776a483e86b2ce9bb Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Sat, 13 Feb 2021 17:41:13 +0900 Subject: [PATCH] [go] add SetBigEndianMode --- ffi/go/mcl/mcl.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ffi/go/mcl/mcl.go b/ffi/go/mcl/mcl.go index 887d08e..1dd9b84 100644 --- a/ffi/go/mcl/mcl.go +++ b/ffi/go/mcl/mcl.go @@ -200,6 +200,16 @@ func (x *Fr) SetLittleEndianMod(buf []byte) error { return nil } +// SetBigEndianMod -- +func (x *Fr) SetBigEndianMod(buf []byte) error { + // #nosec + err := C.mclBnFr_setBigEndianMod(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + if err != 0 { + return fmt.Errorf("err mclBnFr_setBigEndianMod %x", err) + } + return nil +} + // IsEqual -- func (x *Fr) IsEqual(rhs *Fr) bool { return C.mclBnFr_isEqual(x.getPointer(), rhs.getPointer()) == 1 @@ -370,6 +380,16 @@ func (x *Fp) SetLittleEndianMod(buf []byte) error { return nil } +// SetBigEndianMod -- +func (x *Fp) SetBigEndianMod(buf []byte) error { + // #nosec + err := C.mclBnFp_setBigEndianMod(x.getPointer(), unsafe.Pointer(&buf[0]), C.size_t(len(buf))) + if err != 0 { + return fmt.Errorf("err mclBnFp_setBigEndianMod %x", err) + } + return nil +} + // IsEqual -- func (x *Fp) IsEqual(rhs *Fp) bool { return C.mclBnFp_isEqual(x.getPointer(), rhs.getPointer()) == 1