From e899ed8547ca12f2274dbc00690922a99eac5f9f Mon Sep 17 00:00:00 2001 From: Fuzzbawls Date: Thu, 20 Jan 2022 22:43:55 -0800 Subject: [PATCH] Fix `-sign-compare` warnings --- src/schemes.cpp | 2 +- src/test.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/schemes.cpp b/src/schemes.cpp index fe7d37f2e..5948fd24c 100644 --- a/src/schemes.cpp +++ b/src/schemes.cpp @@ -533,7 +533,7 @@ bool AugSchemeMPL::AggregateVerify(const vector& pubkeys, } vector> augMessages(nPubKeys); - for (int i = 0; i < nPubKeys; ++i) { + for (size_t i = 0; i < nPubKeys; ++i) { vector& aug = augMessages[i]; vector&& pubkey = pubkeys[i].Serialize(); aug.reserve(pubkey.size() + messages[i].size()); diff --git a/src/test.cpp b/src/test.cpp index 0482ed4e0..1cf867226 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -29,7 +29,7 @@ using std::vector; using namespace bls; -void TestHKDF(string ikm_hex, string salt_hex, string info_hex, string prk_expected_hex, string okm_expected_hex, int L) { +void TestHKDF(string ikm_hex, string salt_hex, string info_hex, string prk_expected_hex, string okm_expected_hex, size_t L) { vector ikm = Util::HexToBytes(ikm_hex); vector salt = Util::HexToBytes(salt_hex); vector info = Util::HexToBytes(info_hex); @@ -1324,7 +1324,7 @@ TEST_CASE("Threshold Signatures") { // First create the participants and their secrets std::vector participants; - for (int i=0; i < n ; i++) { + for (size_t i=0; i < n ; i++) { Participant participant; participant.id = getRandomSeed(); participant.sk = randPrivKey(); @@ -1333,7 +1333,7 @@ TEST_CASE("Threshold Signatures") { // Create the vectors' coefficients participant.sks.emplace_back(participant.sk); participant.pks.emplace_back(participant.pk); - for (int j = 0; j < (m-1); j++) { + for (size_t j = 0; j < (m-1); j++) { auto sk = randPrivKey(); participant.sks.emplace_back(sk); participant.pks.emplace_back(sk.GetG1Element()); @@ -1343,7 +1343,7 @@ TEST_CASE("Threshold Signatures") { // Second, create shares for every other participant for (Participant& participant : participants) { - for (int j=0; j < n; j++) { + for (size_t j=0; j < n; j++) { RawData id = participants[j].id; participant.sksShares.emplace(id, bls::Threshold::PrivateKeyShare(participant.sks, Bytes(id))); participant.pksShares.emplace(id, bls::Threshold::PublicKeyShare(participant.pks, Bytes(id))); @@ -1353,7 +1353,7 @@ TEST_CASE("Threshold Signatures") { // Third, send shares and verification vectors for (Participant& participant : participants) { - for (int j=0; j < n; j++) { + for (size_t j=0; j < n; j++) { auto& recipient = participants[j]; RawData destId = recipient.id; // S(x) evaluated in participant1.id. @@ -1392,8 +1392,8 @@ TEST_CASE("Threshold Signatures") { // Let's aggregate all the verification vectors to obtain Pa(): std::vector finalVerifVector(participants[0].pks); - for (int j = 1; j < participants.size(); j++) { - for (int i = 0; i < finalVerifVector.size(); i++) { + for (size_t j = 1; j < participants.size(); j++) { + for (size_t i = 0; i < finalVerifVector.size(); i++) { finalVerifVector[i] += participants[j].pks.at(i); } } @@ -1419,7 +1419,7 @@ TEST_CASE("Threshold Signatures") { // Let's aggregate all the SIG(0) values to obtain SIGa(0) // This will be checked for equality against the recovered threshold signature G2Element finalSIG = participants[0].sig; - for (int j = 1; j < participants.size(); j++) { + for (size_t j = 1; j < participants.size(); j++) { finalSIG += participants[j].sig; }