Skip to content

Commit

Permalink
use dec without exception for wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Jul 24, 2023
1 parent a3937c5 commit 18006e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/mcl/she.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ struct SHET {
#endif
int64_t dec(const CipherTextG1& c, bool *pok = 0) const
{
if (useDecG1ViaGT_) return decViaGT(c);
if (useDecG1ViaGT_) return decViaGT(c, pok);
/*
S = mP + rxP
T = rP
Expand All @@ -845,7 +845,7 @@ struct SHET {
}
int64_t dec(const CipherTextG2& c, bool *pok = 0) const
{
if (useDecG2ViaGT_) return decViaGT(c);
if (useDecG2ViaGT_) return decViaGT(c, pok);
G2 R;
G2::mul(R, c.T_, y_);
G2::sub(R, c.S_, R);
Expand Down
8 changes: 3 additions & 5 deletions src/she_c_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,10 @@ int shePrecomputedPublicKeyEncWithZkpBinEq(sheCipherTextG1 *c1, sheCipherTextG2

template<class CT>
int decT(mclInt *m, const sheSecretKey *sec, const CT *c)
try
{
*m = (cast(sec)->dec)(*cast(c));
return 0;
} catch (std::exception&) {
return -1;
bool b;
*m = (cast(sec)->dec)(*cast(c), &b);
return b ? 0 : -1;
}

int sheDecG1(mclInt *m, const sheSecretKey *sec, const sheCipherTextG1 *c)
Expand Down

0 comments on commit 18006e5

Please sign in to comment.