aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-04-02 12:23:19 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-04-02 12:23:19 +0800
commite93fda860bf3b798f6a02ee806da6693a725dd2f (patch)
tree751a06a920d216ffa9530c3c569c223ac96e2e5d
parent6e2296d78de9f3d29d4370b887e9fa92c251817f (diff)
downloaddexon-bls-e93fda860bf3b798f6a02ee806da6693a725dd2f.tar
dexon-bls-e93fda860bf3b798f6a02ee806da6693a725dd2f.tar.gz
dexon-bls-e93fda860bf3b798f6a02ee806da6693a725dd2f.tar.bz2
dexon-bls-e93fda860bf3b798f6a02ee806da6693a725dd2f.tar.lz
dexon-bls-e93fda860bf3b798f6a02ee806da6693a725dd2f.tar.xz
dexon-bls-e93fda860bf3b798f6a02ee806da6693a725dd2f.tar.zst
dexon-bls-e93fda860bf3b798f6a02ee806da6693a725dd2f.zip
sign is constant time ; signCT is removedrelease20170402
-rw-r--r--go/blscgo/bls.go10
-rw-r--r--go/main_test.go4
-rw-r--r--include/bls.hpp3
-rw-r--r--include/bls_if.h1
-rw-r--r--src/bls.cpp8
-rw-r--r--src/bls_if.cpp5
-rw-r--r--test/bls_test.cpp4
7 files changed, 3 insertions, 32 deletions
diff --git a/go/blscgo/bls.go b/go/blscgo/bls.go
index 170146c..5873f38 100644
--- a/go/blscgo/bls.go
+++ b/go/blscgo/bls.go
@@ -251,7 +251,7 @@ func (sec *SecretKey) GetPublicKey() (pub *PublicKey) {
return pub
}
-// Sign --
+// Constant Time Sign --
func (sec *SecretKey) Sign(m string) (sign *Sign) {
sign = new(Sign)
buf := []byte(m)
@@ -259,14 +259,6 @@ 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_test.go b/go/main_test.go
index 091a75b..a103ba2 100644
--- a/go/main_test.go
+++ b/go/main_test.go
@@ -72,10 +72,6 @@ func testSign(t *testing.T) {
}
signVec[i] = *secVec[i].Sign(m)
- s := *secVec[i].SignCT(m)
- if signVec[i].String() != s.String() {
- t.Fatal("SingCT %d", i)
- }
if !signVec[i].Verify(&pubVec[i], m) {
t.Fatal("singVec %d", i)
}
diff --git a/include/bls.hpp b/include/bls.hpp
index 2d6c313..b7c77a6 100644
--- a/include/bls.hpp
+++ b/include/bls.hpp
@@ -118,9 +118,8 @@ public:
*/
void set(const uint64_t *p);
void getPublicKey(PublicKey& pub) const;
- void sign(Sign& sign, const std::string& m) const;
// constant time sign
- void signCT(Sign& sign, const std::string& m) const;
+ void sign(Sign& sign, const std::string& m) const;
/*
make Pop(Proof of Possesion)
pop = prv.sign(pub)
diff --git a/include/bls_if.h b/include/bls_if.h
index 805ce10..ce8463e 100644
--- a/include/bls_if.h
+++ b/include/bls_if.h
@@ -77,7 +77,6 @@ void blsSecretKeyAdd(blsSecretKey *sec, const blsSecretKey *rhs);
void blsSecretKeyInit(blsSecretKey *sec);
void blsSecretKeyGetPublicKey(const blsSecretKey *sec, blsPublicKey *pub);
void blsSecretKeySign(const blsSecretKey *sec, blsSign *sign, const char *m, size_t size);
-void blsSecretKeySignCT(const blsSecretKey *sec, blsSign *sign, const char *m, size_t size);
void blsSecretKeySet(blsSecretKey *sec, const blsSecretKey* msk, size_t k, const blsId *id);
void blsSecretKeyRecover(blsSecretKey *sec, const blsSecretKey *secVec, const blsId *idVec, size_t n);
void blsSecretKeyGetPop(const blsSecretKey *sec, blsSign *sign);
diff --git a/src/bls.cpp b/src/bls.cpp
index 6adc493..64cd40c 100644
--- a/src/bls.cpp
+++ b/src/bls.cpp
@@ -379,13 +379,7 @@ void SecretKey::sign(Sign& sign, const std::string& m) const
{
G1 Hm;
HashAndMapToG1(Hm, m);
- G1::mul(sign.getInner().sHm, Hm, getInner().s);
-}
-// constant time sign
-void SecretKey::signCT(Sign& sign, const std::string& m) const
-{
- G1 Hm;
- HashAndMapToG1(Hm, m);
+// G1::mul(sign.getInner().sHm, Hm, getInner().s);
G1::mulCT(sign.getInner().sHm, Hm, getInner().s);
}
diff --git a/src/bls_if.cpp b/src/bls_if.cpp
index 4080d70..56f35b0 100644
--- a/src/bls_if.cpp
+++ b/src/bls_if.cpp
@@ -134,11 +134,6 @@ void blsSecretKeySign(const blsSecretKey *sec, blsSign *sign, const char *m, siz
{
((const bls::SecretKey*)sec)->sign(*(bls::Sign*)sign, std::string(m, size));
}
-void blsSecretKeySignCT(const blsSecretKey *sec, blsSign *sign, const char *m, size_t size)
-{
- ((const bls::SecretKey*)sec)->signCT(*(bls::Sign*)sign, std::string(m, size));
-}
-
void blsSecretKeySet(blsSecretKey *sec, const blsSecretKey* msk, size_t k, const blsId *id)
{
((bls::SecretKey*)sec)->set((const bls::SecretKey *)msk, k, *(const bls::Id*)id);
diff --git a/test/bls_test.cpp b/test/bls_test.cpp
index b30d81d..345bbcd 100644
--- a/test/bls_test.cpp
+++ b/test/bls_test.cpp
@@ -85,14 +85,10 @@ void blsTest()
m += char('0' + i);
bls::Sign s;
sec.sign(s, m);
- bls::Sign t;
- sec.signCT(t, m);
CYBOZU_TEST_ASSERT(s.verify(pub, m));
- CYBOZU_TEST_ASSERT(t.verify(pub, m));
CYBOZU_TEST_ASSERT(!s.verify(pub, m + "a"));
streamTest(s);
CYBOZU_BENCH_C("sign", 100, sec.sign, s, m);
- CYBOZU_BENCH_C("signCT", 100, sec.signCT, s, m);
CYBOZU_BENCH_C("verify", 100, s.verify, pub, m);
}
}