diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2018-09-21 16:48:19 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2018-09-21 16:48:19 +0800 |
commit | e68b2a3fb07999ba000eccb1727c527763d56e9f (patch) | |
tree | 17afbcda0b3c98129966df965a397f1d4d2cc725 /src | |
parent | 5b33a863f08bbd60d7631bd586e00c993f8cda1e (diff) | |
download | dexon-bls-e68b2a3fb07999ba000eccb1727c527763d56e9f.tar dexon-bls-e68b2a3fb07999ba000eccb1727c527763d56e9f.tar.gz dexon-bls-e68b2a3fb07999ba000eccb1727c527763d56e9f.tar.bz2 dexon-bls-e68b2a3fb07999ba000eccb1727c527763d56e9f.tar.lz dexon-bls-e68b2a3fb07999ba000eccb1727c527763d56e9f.tar.xz dexon-bls-e68b2a3fb07999ba000eccb1727c527763d56e9f.tar.zst dexon-bls-e68b2a3fb07999ba000eccb1727c527763d56e9f.zip |
add blsVerifyAggregatedHashes
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); |