Skip to content

Commit

Permalink
Fix -sign-compare warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuzzbawls committed Jan 21, 2022
1 parent db24bff commit e899ed8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/schemes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ bool AugSchemeMPL::AggregateVerify(const vector<G1Element>& pubkeys,
}

vector<vector<uint8_t>> augMessages(nPubKeys);
for (int i = 0; i < nPubKeys; ++i) {
for (size_t i = 0; i < nPubKeys; ++i) {
vector<uint8_t>& aug = augMessages[i];
vector<uint8_t>&& pubkey = pubkeys[i].Serialize();
aug.reserve(pubkey.size() + messages[i].size());
Expand Down
16 changes: 8 additions & 8 deletions src/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t> ikm = Util::HexToBytes(ikm_hex);
vector<uint8_t> salt = Util::HexToBytes(salt_hex);
vector<uint8_t> info = Util::HexToBytes(info_hex);
Expand Down Expand Up @@ -1324,7 +1324,7 @@ TEST_CASE("Threshold Signatures") {

// First create the participants and their secrets
std::vector<Participant> participants;
for (int i=0; i < n ; i++) {
for (size_t i=0; i < n ; i++) {
Participant participant;
participant.id = getRandomSeed();
participant.sk = randPrivKey();
Expand All @@ -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());
Expand All @@ -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)));
Expand All @@ -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.
Expand Down Expand Up @@ -1392,8 +1392,8 @@ TEST_CASE("Threshold Signatures") {

// Let's aggregate all the verification vectors to obtain Pa():
std::vector<G1Element> 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);
}
}
Expand All @@ -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;
}

Expand Down

0 comments on commit e899ed8

Please sign in to comment.