From 6d7a12718ba4bc4784c6c86bfdcb49dc0cac6318 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Mon, 15 Aug 2016 17:05:53 +0900 Subject: add operator+() --- src/bls.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') 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& 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& 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 -- cgit v1.2.3