1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-12 11:12:16 +00:00

Fix UB in blst aggregate verify (#1107)

This commit is contained in:
SpyCheese 2024-08-15 12:53:05 +03:00 committed by GitHub
parent 7cbe20c440
commit 0cff1c88f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -93,12 +93,13 @@ bool aggregate_verify(const std::vector<std::pair<P1, td::BufferSlice>> &pubs_ms
return false;
}
std::unique_ptr<blst::Pairing> pairing = std::make_unique<blst::Pairing>(true, DST);
blst::P2_Affine p2_zero;
for (const auto &p : pubs_msgs) {
blst::P1_Affine p1(p.first.data(), P1_SIZE);
if (!p1.in_group() || p1.is_inf()) {
return false;
}
pairing->aggregate(&p1, nullptr, (const td::uint8 *)p.second.data(), p.second.size());
pairing->aggregate(&p1, &p2_zero, (const td::uint8 *)p.second.data(), p.second.size());
}
pairing->commit();
blst::P2_Affine p2(sig.data(), P2_SIZE);