Skip to content

Commit

Permalink
Some more codeql cleanup (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
emlowe authored Jun 20, 2023
1 parent 2b6e809 commit 95c2f65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 60 deletions.
18 changes: 6 additions & 12 deletions src/elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,9 @@ G1Element G1Element::Generator()

bool G1Element::IsValid() const
{
// Infinity no longer valid in Relic
// https://github.com/relic-toolkit/relic/commit/f3be2babb955cf9f82743e0ae5ef265d3da6c02b
// if (blst_p1_is_inf(&p) == 1)
// return true;

// return blst_p1_on_curve((blst_p1*)&p);
// Infinity was considered a valid G1Element in older Relic versions
// on which this library was previously based.
// For historical compatibililty this behavior is maintained.

if (blst_p1_is_inf(&p))
return true;
Expand Down Expand Up @@ -299,12 +296,9 @@ G2Element G2Element::Generator()

bool G2Element::IsValid() const
{
// Infinity no longer valid in Relic
// https://github.com/relic-toolkit/relic/commit/f3be2babb955cf9f82743e0ae5ef265d3da6c02b
// if (blst_p2_is_inf(&q) == 1)
// return true;

// return blst_p2_on_curve((blst_p2*)&q);
// Infinity was considered a valid G2Element in older Relic versions
// on which this library was previously based.
// For historical compatibililty this behavior is maintained.

if (blst_p2_is_inf(&q))
return true;
Expand Down
48 changes: 0 additions & 48 deletions src/schemes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,39 +264,6 @@ bool CoreMPL::AggregateVerify(
return ret;
}

// bool CoreMPL::NativeVerify(
// blst_p1* pubkeys,
// blst_p2* mappedHashes,
// size_t length)
// {
// blst_fp12 target, candidate, tmpPairing;
// memcpy(&target, blst_fp12_one(), sizeof(blst_fp12));
// memcpy(&candidate, blst_fp12_one(), sizeof(blst_fp12));

// // prod e(pubkey[i], hash[i]) * e(-g1, aggSig)
// // Performs pubKeys.size() pairings, 250 at a time

// blst_p1_affine Ps[length];
// blst_p2_affine Qs[length];
// const blst_p1* ppoints[2] = {pubkeys, NULL};
// const blst_p2* pqoints[2] = {mappedHashes, NULL};

// blst_p1s_to_affine(Ps, ppoints, length);
// blst_p2s_to_affine(Qs, pqoints, length);
// for (size_t i = 0; i < length; i += 250) {
// size_t numPairings = std::min((length - i), (size_t)250);
// const blst_p1_affine* const pP = &(Ps[i]);
// const blst_p2_affine* const pQ = &(Qs[i]);
// blst_miller_loop_n(&tmpPairing, &pQ, &pP, numPairings);
// blst_fp12_mul(&candidate, &candidate, &tmpPairing);
// }
// // 1 =? prod e(pubkey[i], hash[i]) * e(-g1, aggSig)
// if (memcmp(&target, &candidate, sizeof(blst_fp12)) != 0) {
// return false;
// }
// return true;
// }

PrivateKey CoreMPL::DeriveChildSk(const PrivateKey& sk, uint32_t index)
{
return HDKeys::DeriveChildSk(sk, index);
Expand Down Expand Up @@ -584,21 +551,6 @@ bool PopSchemeMPL::PopVerify(const Bytes& pubkey, const Bytes& proof)
{
return PopSchemeMPL::PopVerify(
G1Element::FromBytes(pubkey), G2Element::FromBytes(proof));

// const G2Element hashedPoint = G2Element::FromMessage(
// pubkey,
// (const uint8_t*)POP_CIPHERSUITE_ID.c_str(),
// POP_CIPHERSUITE_ID.length());

// blst_p1 g1s[2];
// blst_p2 g2s[2];

// G1Element::Generator().Negate().ToNative(&(g1s[0]));
// G1Element::FromBytes(pubkey).ToNative(&(g1s[1]));
// G2Element::FromBytes(proof).ToNative(&(g2s[0]));
// hashedPoint.ToNative(&(g2s[1]));

// return CoreMPL::NativeVerify(g1s, g2s, 2);
}

bool PopSchemeMPL::FastAggregateVerify(
Expand Down

0 comments on commit 95c2f65

Please sign in to comment.