diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bls_c_impl.hpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/bls_c_impl.hpp b/src/bls_c_impl.hpp index ad52cf7..c041564 100644 --- a/src/bls_c_impl.hpp +++ b/src/bls_c_impl.hpp @@ -275,24 +275,24 @@ inline bool toG1(G1& Hm, const void *h, mclSize size) BN::mapToG1(&b, Hm, t); return b; } -int blsG1SetHash(mclBnG1 *g1, const void *h, mclSize size) -{ - return toG1(*cast(g1), h, size) ? 0 : -1; -} -int blsVerifyAggregation(const blsSignature *aggSig, const blsPublicKey *pubVec, const mclBnG1 *g1Vec, mclSize n) +int blsVerifyAggregatedHashes(const blsSignature *aggSig, const blsPublicKey *pubVec, const void *hVec, size_t sizeofHash, mclSize n) { if (n == 0) return 0; /* - e(aggSig, Q) = prod_i e(g1Vec[i], pubVec[i]) - <=> finalExp(ML(-aggSig, Q) * prod_i ML(g1Vec[i], pubVec[i])) == 1 + e(aggSig, Q) = prod_i e(hVec[i], pubVec[i]) + <=> finalExp(ML(-aggSig, Q) * prod_i ML(hVec[i], pubVec[i])) == 1 */ GT e1, e2; BN::precomputedMillerLoop(e1, -*cast(&aggSig->v), g_Qcoeff.data()); - BN::millerLoop(e2, *cast(&g1Vec[0]), *cast(&pubVec[0].v)); + const char *ph = (const char*)hVec; + G1 h; + if (!toG1(h, &ph[0], sizeofHash)) return 0; + BN::millerLoop(e2, h, *cast(&pubVec[0].v)); e1 *= e2; for (size_t i = 1; i < n; i++) { - BN::millerLoop(e2, *cast(&g1Vec[i]), *cast(&pubVec[i].v)); + if (!toG1(h, &ph[i * sizeofHash], sizeofHash)) return 0; + BN::millerLoop(e2, h, *cast(&pubVec[i].v)); e1 *= e2; } BN::finalExp(e1, e1); |