diff options
Diffstat (limited to 'ffi/go/bls')
-rw-r--r-- | ffi/go/bls/bls.go | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/ffi/go/bls/bls.go b/ffi/go/bls/bls.go index 7b9313e..9b2691c 100644 --- a/ffi/go/bls/bls.go +++ b/ffi/go/bls/bls.go @@ -1,14 +1,13 @@ package bls /* -#cgo CFLAGS:-I../../../include -I../../../../mcl/include/ #cgo bn256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=4 #cgo bn256 LDFLAGS:-lbls256 #cgo bn384 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 #cgo bn384 LDFLAGS:-lbls384 #cgo bn384_256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 -DMCLBN_FR_UNIT_SIZE=4 #cgo bn384_256 LDFLAGS:-lbls384_256 -#cgo LDFLAGS:-L../../../lib -lbls384 +#cgo LDFLAGS:-lbls384 #cgo LDFLAGS:-lcrypto -lgmp -lgmpxx -lstdc++ #include "config.h" #include <bls/bls.h> @@ -332,3 +331,19 @@ func DHKeyExchange(sec *SecretKey, pub *PublicKey) (out PublicKey) { C.blsDHKeyExchange(out.getPointer(), sec.getPointer(), pub.getPointer()) return out } + +// HashAndMapToSignature -- +func HashAndMapToSignature(buf []byte) *Sign { + sig := new(Sign) + err := sig.v.HashAndMapTo(buf) + if err == nil { + return sig + } else { + return nil + } +} + +// VerifyPairing -- +func VerifyPairing(X *Sign, Y *Sign, pub *PublicKey) bool { + return C.blsVerifyPairing(X.getPointer(), Y.getPointer(), pub.getPointer()) == 1 +} |