aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--go/bls/bls.go12
-rw-r--r--include/bls_if.h3
-rw-r--r--src/bls_if.cpp12
3 files changed, 27 insertions, 0 deletions
diff --git a/go/bls/bls.go b/go/bls/bls.go
index df03734..5ba2f24 100644
--- a/go/bls/bls.go
+++ b/go/bls/bls.go
@@ -90,6 +90,10 @@ func (sec *SecretKey) Init() {
C.blsSecretKeyInit(sec.self)
}
+func (sec *SecretKey) Add(rhs *SecretKey) {
+ C.blsSecretKeyAdd(sec.self, rhs.self);
+}
+
type PublicKey struct {
self *C.blsPublicKey
}
@@ -122,6 +126,10 @@ func (pub *PublicKey) SetStr(s string) {
}
}
+func (pub *PublicKey) Add(rhs *PublicKey) {
+ C.blsPublicKeyAdd(pub.self, rhs.self);
+}
+
type Sign struct {
self *C.blsSign
}
@@ -167,6 +175,10 @@ func (sec *SecretKey) Sign(m string) (sign *Sign) {
return sign
}
+func (sign *Sign) Add(rhs *Sign) {
+ C.blsSignAdd(sign.self, rhs.self);
+}
+
func (sign *Sign) Verify(pub *PublicKey, m string) bool {
buf := []byte(m)
return C.blsSignVerify(sign.self, pub.self, (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf))) == 1
diff --git a/include/bls_if.h b/include/bls_if.h
index ac68495..943cb24 100644
--- a/include/bls_if.h
+++ b/include/bls_if.h
@@ -42,6 +42,7 @@ void blsSecretKeyDestroy(blsSecretKey *sec);
void blsSecretKeyPut(const blsSecretKey *sec);
int blsSecretKeySetStr(blsSecretKey *sec, const char *buf, size_t bufSize);
size_t blsSecretKeyGetStr(const blsSecretKey *sec, char *buf, size_t maxBufSize);
+void blsSecretKeyAdd(blsSecretKey *sec, const blsSecretKey *rhs);
void blsSecretKeyInit(blsSecretKey *sec);
void blsSecretKeyGetPublicKey(const blsSecretKey *sec, blsPublicKey *pub);
@@ -52,12 +53,14 @@ void blsPublicKeyDestroy(blsPublicKey *pub);
void blsPublicKeyPut(const blsPublicKey *pub);
int blsPublicKeySetStr(blsPublicKey *pub, const char *buf, size_t bufSize);
size_t blsPublicKeyGetStr(const blsPublicKey *pub, char *buf, size_t maxBufSize);
+void blsPublicKeyAdd(blsPublicKey *pub, const blsPublicKey *rhs);
blsSign *blsSignCreate(void);
void blsSignDestroy(blsSign *sign);
void blsSignPut(const blsSign *sign);
int blsSignSetStr(blsSign *sign, const char *buf, size_t bufSize);
size_t blsSignGetStr(const blsSign *sign, char *buf, size_t maxBufSize);
+void blsSignAdd(blsSign *sign, const blsSign *rhs);
int blsSignVerify(const blsSign *sign, const blsPublicKey *pub, const char *m, size_t size);
diff --git a/src/bls_if.cpp b/src/bls_if.cpp
index 8cd4916..4315fad 100644
--- a/src/bls_if.cpp
+++ b/src/bls_if.cpp
@@ -101,6 +101,10 @@ void blsSecretKeyInit(blsSecretKey *sec)
{
((bls::SecretKey*)sec)->init();
}
+void blsSecretKeyAdd(blsSecretKey *sec, const blsSecretKey *rhs)
+{
+ ((bls::SecretKey*)sec)->add(*(const bls::SecretKey*)rhs);
+}
void blsSecretKeyGetPublicKey(const blsSecretKey *sec, blsPublicKey *pub)
{
@@ -133,6 +137,10 @@ size_t blsPublicKeyGetStr(const blsPublicKey *pub, char *buf, size_t maxBufSize)
{
return getStrT<bls::PublicKey, blsPublicKey>(pub, buf, maxBufSize);
}
+void blsPublicKeyAdd(blsPublicKey *pub, const blsPublicKey *rhs)
+{
+ ((bls::PublicKey*)pub)->add(*(const bls::PublicKey*)rhs);
+}
blsSign *blsSignCreate()
{
@@ -156,6 +164,10 @@ size_t blsSignGetStr(const blsSign *sign, char *buf, size_t maxBufSize)
{
return getStrT<bls::Sign, blsSign>(sign, buf, maxBufSize);
}
+void blsSignAdd(blsSign *sign, const blsSign *rhs)
+{
+ ((bls::Sign*)sign)->add(*(const bls::Sign*)rhs);
+}
int blsSignVerify(const blsSign *sign, const blsPublicKey *pub, const char *m, size_t size)
{