aboutsummaryrefslogtreecommitdiffstats
path: root/go
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-03-17 18:52:05 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-03-17 18:52:13 +0800
commitb0779efe006b54e91fb66b0e4cc4639718c6ea4f (patch)
treedb598f2bda8a0898476d1a3cbc51e336edd78cd3 /go
parenta3083341bd08426825bb9d7352b5235b9a974f00 (diff)
downloaddexon-bls-b0779efe006b54e91fb66b0e4cc4639718c6ea4f.tar
dexon-bls-b0779efe006b54e91fb66b0e4cc4639718c6ea4f.tar.gz
dexon-bls-b0779efe006b54e91fb66b0e4cc4639718c6ea4f.tar.bz2
dexon-bls-b0779efe006b54e91fb66b0e4cc4639718c6ea4f.tar.lz
dexon-bls-b0779efe006b54e91fb66b0e4cc4639718c6ea4f.tar.xz
dexon-bls-b0779efe006b54e91fb66b0e4cc4639718c6ea4f.tar.zst
dexon-bls-b0779efe006b54e91fb66b0e4cc4639718c6ea4f.zip
add constant time sign SecretKey::signCT
Diffstat (limited to 'go')
-rw-r--r--go/blscgo/bls.go8
-rw-r--r--go/main.go2
2 files changed, 10 insertions, 0 deletions
diff --git a/go/blscgo/bls.go b/go/blscgo/bls.go
index 10968b8..35cf253 100644
--- a/go/blscgo/bls.go
+++ b/go/blscgo/bls.go
@@ -259,6 +259,14 @@ func (sec *SecretKey) Sign(m string) (sign *Sign) {
C.blsSecretKeySign(sec.getPointer(), sign.getPointer(), (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)))
return sign
}
+// Constant Time Sign --
+func (sec *SecretKey) SignCT(m string) (sign *Sign) {
+ sign = new(Sign)
+ buf := []byte(m)
+ // #nosec
+ C.blsSecretKeySignCT(sec.getPointer(), sign.getPointer(), (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)))
+ return sign
+}
// Add --
func (sign *Sign) Add(rhs *Sign) {
diff --git a/go/main.go b/go/main.go
index 7c4cf38..b7caf40 100644
--- a/go/main.go
+++ b/go/main.go
@@ -70,6 +70,8 @@ func testSign() {
verifyTrue(pubVec[i].String() == secVec[i].GetPublicKey().String())
signVec[i] = *secVec[i].Sign(m)
+ s := *secVec[i].SignCT(m)
+ verifyTrue(signVec[i] == s);
verifyTrue(signVec[i].Verify(&pubVec[i], m))
}
var sec1 blscgo.SecretKey