aboutsummaryrefslogtreecommitdiffstats
path: root/src/bls.cpp
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-08-15 16:05:53 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-08-15 16:05:53 +0800
commit6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318 (patch)
tree3793e48d5db8b8cd8d9238354f4b4467d4cdd7e8 /src/bls.cpp
parentd3d6bf8848950be1bafae4b90c8e83085b894d16 (diff)
downloaddexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.gz
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.bz2
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.lz
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.xz
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.tar.zst
dexon-bls-6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318.zip
add operator+()
Diffstat (limited to 'src/bls.cpp')
-rw-r--r--src/bls.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/bls.cpp b/src/bls.cpp
index ecbb59e..6bc5fc6 100644
--- a/src/bls.cpp
+++ b/src/bls.cpp
@@ -236,6 +236,12 @@ void Sign::recover(const std::vector<Sign>& signVec)
id_ = 0;
}
+void Sign::add(const Sign& rhs)
+{
+ if (id_ != 0 || rhs.id_ != 0) throw cybozu::Exception("bls:Sign:add:bad id") << id_ << rhs.id_;
+ self_->sHm += rhs.self_->sHm;
+}
+
MasterPublicKey::MasterPublicKey()
: self_(new impl::MasterPublicKey())
{
@@ -342,6 +348,12 @@ bool PublicKey::isValid(const MasterPublicKey& mpk) const
return v == self_->sQ;
}
+void PublicKey::add(const PublicKey& rhs)
+{
+ if (id_ != 0 || rhs.id_ != 0) throw cybozu::Exception("bls:PublicKey:add:bad id") << id_ << rhs.id_;
+ self_->sQ += rhs.self_->sQ;
+}
+
PrivateKey::PrivateKey()
: self_(new impl::PrivateKey())
, id_(0)
@@ -426,4 +438,10 @@ void PrivateKey::recover(const std::vector<PrivateKey>& prvVec)
id_ = 0;
}
+void PrivateKey::add(const PrivateKey& rhs)
+{
+ if (id_ != 0 || rhs.id_ != 0) throw cybozu::Exception("bls:PrivateKey:add:bad id") << id_ << rhs.id_;
+ self_->s += rhs.self_->s;
+}
+
} // bls