diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2018-01-03 21:07:09 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2018-01-03 21:07:09 +0800 |
commit | e4e5c2051b1893a4183f99318945044a905c244f (patch) | |
tree | 5f4103ecc80654af47e75c265fb2debf86449f65 /src | |
parent | 280d7c84204b3eb1a08993fb20dcddebbf8e2b40 (diff) | |
download | tangerine-mcl-e4e5c2051b1893a4183f99318945044a905c244f.tar.gz tangerine-mcl-e4e5c2051b1893a4183f99318945044a905c244f.tar.zst tangerine-mcl-e4e5c2051b1893a4183f99318945044a905c244f.zip |
[she] add sheDecGiViaGT
Diffstat (limited to 'src')
-rw-r--r-- | src/she_c_impl.hpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/she_c_impl.hpp b/src/she_c_impl.hpp index 1f5237d..9d29c67 100644 --- a/src/she_c_impl.hpp +++ b/src/she_c_impl.hpp @@ -202,7 +202,7 @@ void sheUseDecG1ViaGT(int use) { SHE::useDecG1ViaGT(use != 0); } -void sheDecG2ViaGT(int use) +void sheUseDecG2ViaGT(int use) { SHE::useDecG2ViaGT(use != 0); } @@ -282,7 +282,7 @@ template<class CT> int decT(mclInt *m, const sheSecretKey *sec, const CT *c) try { - *m = cast(sec)->dec(*cast(c)); + *m = (cast(sec)->dec)(*cast(c)); return 0; } catch (std::exception& e) { fprintf(stderr, "err %s\n", e.what()); @@ -305,6 +305,28 @@ int sheDecGT(mclInt *m, const sheSecretKey *sec, const sheCipherTextGT *c) } template<class CT> +int decViaGTT(mclInt *m, const sheSecretKey *sec, const CT *c) + try +{ + *m = (cast(sec)->decViaGT)(*cast(c)); + return 0; +} catch (std::exception& e) { + fprintf(stderr, "err %s\n", e.what()); + return -1; +} + +int sheDecG1ViaGT(mclInt *m, const sheSecretKey *sec, const sheCipherTextG1 *c) +{ + return decViaGTT(m, sec, c); +} + +int sheDecG2ViaGT(mclInt *m, const sheSecretKey *sec, const sheCipherTextG2 *c) +{ + return decViaGTT(m, sec, c); +} + + +template<class CT> int isZeroT(const sheSecretKey *sec, const CT *c) try { |