aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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