diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2019-01-05 15:07:43 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2019-01-05 15:07:43 +0800 |
commit | a80959e765f514091d3ccfe256bb540a11522f67 (patch) | |
tree | 4494ce4bf98a901af1fe798debdd77ee2fc044a2 /src | |
parent | 7535cfacbe29215487dd02ad1386826d881d7477 (diff) | |
download | dexon-bls-a80959e765f514091d3ccfe256bb540a11522f67.tar dexon-bls-a80959e765f514091d3ccfe256bb540a11522f67.tar.gz dexon-bls-a80959e765f514091d3ccfe256bb540a11522f67.tar.bz2 dexon-bls-a80959e765f514091d3ccfe256bb540a11522f67.tar.lz dexon-bls-a80959e765f514091d3ccfe256bb540a11522f67.tar.xz dexon-bls-a80959e765f514091d3ccfe256bb540a11522f67.tar.zst dexon-bls-a80959e765f514091d3ccfe256bb540a11522f67.zip |
add blsVerifyPairing
Diffstat (limited to 'src')
-rw-r--r-- | src/bls_c_impl.hpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/bls_c_impl.hpp b/src/bls_c_impl.hpp index 46b3aad..197c146 100644 --- a/src/bls_c_impl.hpp +++ b/src/bls_c_impl.hpp @@ -429,19 +429,22 @@ int blsSignHash(blsSignature *sig, const blsSecretKey *sec, const void *h, mclSi return 0; } -int blsVerifyHash(const blsSignature *sig, const blsPublicKey *pub, const void *h, mclSize size) +int blsVerifyPairing(const blsSignature *X, const blsSignature *Y, const blsPublicKey *pub) { #ifdef BLS_SWAP_G - G2 Hm; - if (!toG(Hm, h, size)) return 0; - return isEqualTwoPairings(*cast(&sig->v), *cast(&pub->v), Hm); + return isEqualTwoPairings(*cast(&X->v), *cast(&pub->v), *cast(&Y->v)); #else - G1 Hm; - if (!toG(Hm, h, size)) return 0; - return isEqualTwoPairings(*cast(&sig->v), getQcoeff().data(), Hm, *cast(&pub->v)); + return isEqualTwoPairings(*cast(&X->v), getQcoeff().data(), *cast(&Y->v), *cast(&pub->v)); #endif } +int blsVerifyHash(const blsSignature *sig, const blsPublicKey *pub, const void *h, mclSize size) +{ + blsSignature Hm; + if (!toG(*cast(&Hm.v), h, size)) return 0; + return blsVerifyPairing(sig, &Hm, pub); +} + void blsSecretKeySub(blsSecretKey *sec, const blsSecretKey *rhs) { *cast(&sec->v) -= *cast(&rhs->v); |