aboutsummaryrefslogtreecommitdiffstats
path: root/src/bls.cpp
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-08-15 15:34:36 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-08-15 15:34:36 +0800
commit08a5785b10a75a155af82db43793d2e4f0da0615 (patch)
tree10277ea6784031862d1085a8c5a799e4c055e4a8 /src/bls.cpp
parent7e2aacd8b7e7f3d9acc6313b64a811d93b674216 (diff)
downloaddexon-bls-08a5785b10a75a155af82db43793d2e4f0da0615.tar
dexon-bls-08a5785b10a75a155af82db43793d2e4f0da0615.tar.gz
dexon-bls-08a5785b10a75a155af82db43793d2e4f0da0615.tar.bz2
dexon-bls-08a5785b10a75a155af82db43793d2e4f0da0615.tar.lz
dexon-bls-08a5785b10a75a155af82db43793d2e4f0da0615.tar.xz
dexon-bls-08a5785b10a75a155af82db43793d2e4f0da0615.tar.zst
dexon-bls-08a5785b10a75a155af82db43793d2e4f0da0615.zip
rename Verifier to MasterPublicKey
Diffstat (limited to 'src/bls.cpp')
-rw-r--r--src/bls.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/bls.cpp b/src/bls.cpp
index 3747c18..ecbb59e 100644
--- a/src/bls.cpp
+++ b/src/bls.cpp
@@ -164,7 +164,7 @@ struct PublicKey {
const G2& get() const { return sQ; }
};
-struct Verifier {
+struct MasterPublicKey {
std::vector<G2> vecR;
};
@@ -236,49 +236,49 @@ void Sign::recover(const std::vector<Sign>& signVec)
id_ = 0;
}
-Verifier::Verifier()
- : self_(new impl::Verifier())
+MasterPublicKey::MasterPublicKey()
+ : self_(new impl::MasterPublicKey())
{
}
-Verifier::~Verifier()
+MasterPublicKey::~MasterPublicKey()
{
delete self_;
}
-Verifier::Verifier(const Verifier& rhs)
- : self_(new impl::Verifier(*rhs.self_))
+MasterPublicKey::MasterPublicKey(const MasterPublicKey& rhs)
+ : self_(new impl::MasterPublicKey(*rhs.self_))
{
}
-Verifier& Verifier::operator=(const Verifier& rhs)
+MasterPublicKey& MasterPublicKey::operator=(const MasterPublicKey& rhs)
{
*self_ = *rhs.self_;
return *this;
}
-bool Verifier::operator==(const Verifier& rhs) const
+bool MasterPublicKey::operator==(const MasterPublicKey& rhs) const
{
return self_->vecR == rhs.self_->vecR;
}
-std::ostream& operator<<(std::ostream& os, const Verifier& ver)
+std::ostream& operator<<(std::ostream& os, const MasterPublicKey& mpk)
{
- const size_t n = ver.self_->vecR.size();
+ const size_t n = mpk.self_->vecR.size();
os << n;
for (size_t i = 0; i < n; i++) {
- os << '\n' << ver.self_->vecR[i];
+ os << '\n' << mpk.self_->vecR[i];
}
return os;
}
-std::istream& operator>>(std::istream& is, Verifier& ver)
+std::istream& operator>>(std::istream& is, MasterPublicKey& mpk)
{
size_t n;
is >> n;
- ver.self_->vecR.resize(n);
+ mpk.self_->vecR.resize(n);
for (size_t i = 0; i < n; i++) {
- is >> ver.self_->vecR[i];
+ is >> mpk.self_->vecR[i];
}
return is;
}
@@ -335,10 +335,10 @@ void PublicKey::recover(const std::vector<PublicKey>& pubVec)
id_ = 0;
}
-bool PublicKey::isValid(const Verifier& ver) const
+bool PublicKey::isValid(const MasterPublicKey& mpk) const
{
G2 v;
- evalPoly(v, Fr(id_), ver.self_->vecR);
+ evalPoly(v, Fr(id_), mpk.self_->vecR);
return v == self_->sQ;
}
@@ -398,7 +398,7 @@ void PrivateKey::sign(Sign& sign, const std::string& m) const
sign.id_ = id_;
}
-void PrivateKey::share(std::vector<PrivateKey>& prvVec, int n, int k, Verifier *ver)
+void PrivateKey::share(std::vector<PrivateKey>& prvVec, int n, int k, MasterPublicKey *mpk)
{
if (id_ != 0) throw cybozu::Exception("bls:PrivateKey:share:already shared") << id_;
if (n <= 0 || k <= 0 || k > n) throw cybozu::Exception("bls:PrivateKey:share:bad n, k") << n << k;
@@ -410,8 +410,8 @@ void PrivateKey::share(std::vector<PrivateKey>& prvVec, int n, int k, Verifier *
poly.eval(prvVec[i].self_->s, id);
prvVec[i].id_ = id;
}
- if (ver == 0) return;
- std::vector<G2>& vecR = ver->self_->vecR;
+ if (mpk == 0) return;
+ std::vector<G2>& vecR = mpk->self_->vecR;
vecR.resize(k);
for (size_t i = 0; i < vecR.size(); i++) {
G2::mul(vecR[i], getQ(), poly.c[i]);