diff options
author | Determinant <[email protected]> | 2018-07-27 17:33:23 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2018-07-27 17:33:23 -0400 |
commit | ec6a1f84324faf8e7c92f32137464db57410f58a (patch) | |
tree | 10a0f289a255eb5c78be2cb4a5e2702fc7995182 /src/crypto.cpp | |
parent | 5f00c067f863f812a740dc209b1fb829f04042eb (diff) |
fix signature verification bug
Diffstat (limited to 'src/crypto.cpp')
-rw-r--r-- | src/crypto.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/crypto.cpp b/src/crypto.cpp index 560a8ac..88c2f57 100644 --- a/src/crypto.cpp +++ b/src/crypto.cpp @@ -8,19 +8,22 @@ secp256k1_context_t secp256k1_default_verify_ctx = new Secp256k1Context(false); QuorumCertSecp256k1::QuorumCertSecp256k1( const ReplicaConfig &config, const uint256_t &blk_hash): - QuorumCert(), blk_hash(blk_hash), rids(config.nmajority) { + QuorumCert(), blk_hash(blk_hash), rids(config.nreplicas) { rids.clear(); } bool QuorumCertSecp256k1::verify(const ReplicaConfig &config) { - bytearray_t _blk_hash(blk_hash); - if (rids.size() < config.nmajority) return false; + if (sigs.size() < config.nmajority) return false; for (size_t i = 0; i < rids.size(); i++) - if (!sigs[i].verify(_blk_hash, - static_cast<const PubKeySecp256k1 &>(config.get_pubkey(rids.get(i))), - secp256k1_default_verify_ctx - )) + if (rids.get(i)) + { + HOTSTUFF_LOG_DEBUG("checking cert(%d), blk_hash=%s", + i, get_hex10(blk_hash).c_str()); + if (!sigs[i].verify(blk_hash, + static_cast<const PubKeySecp256k1 &>(config.get_pubkey(i)), + secp256k1_default_verify_ctx)) return false; + } return true; } |