bls_lib
bls_lib copied to clipboard
opt_atePairing does not have 4 parameters
opt_atePairing(pairing_prod, pubkeys[0].ec2, hashed_msg_point, !delay_exp); what is the delay_exp? I check the opt_atePairing in bn.h, the define is: void opt_atePairing(Fp12T<Fp6T<Fp2T<Fp> > >& f, const Fp2T<Fp> Q[2], const Fp P[2])
bool Bls::verifyAggSig(const std::vector<const char*> &messages, const std::vector<PubKey> &pubkeys, const Sig &sig, bool delay_exp) {
// check that same number of messages and pubkeys
if (messages.size() != pubkeys.size()) {
cerr << "SIZES NOT EQUAL" << endl;
return false;
}
// calculate initial pairing
Fp12 pairing_prod;
Ec1 hashed_msg_point = hashMsgWithPubkey(messages[0], pubkeys[0].ec2);
opt_atePairing(pairing_prod, pubkeys[0].ec2, hashed_msg_point, !delay_exp);
// Set for checking that all messages are unique
std::vector<Ec1> hashed_msgs;
hashed_msgs.push_back(hashed_msg_point);
for (size_t i = 1; i < messages.size(); i++) {
Fp12 pairing_i;
Ec1 hashed_msg_point = hashMsgWithPubkey(messages[i], pubkeys[i].ec2);
Ec2 pubkey = pubkeys[i].ec2;
hashed_msgs.push_back(hashed_msg_point);
opt_atePairing(pairing_i, pubkey, hashed_msg_point, !delay_exp);
pairing_prod *= pairing_i;
}
if (delay_exp) {
pairing_prod.final_exp();
}
// calculate pairing with agg signature
Fp12 pairing_agg;
opt_atePairing(pairing_agg, g2, sig.ec1);
return pairing_agg == pairing_prod;
}