mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Fix a_exp_b_mod_c and divide by 0 (GH #604)
This commit is contained in:
parent
1efa1a9fc7
commit
874c48a329
@ -4362,12 +4362,18 @@ Integer Integer::MultiplicativeInverse() const
|
||||
Integer a_times_b_mod_c(const Integer &x, const Integer& y, const Integer& m)
|
||||
{
|
||||
CRYPTOPP_ASSERT(m != 0);
|
||||
if (m == 0)
|
||||
throw Integer::DivideByZero();
|
||||
|
||||
return x*y%m;
|
||||
}
|
||||
|
||||
Integer a_exp_b_mod_c(const Integer &x, const Integer& e, const Integer& m)
|
||||
{
|
||||
CRYPTOPP_ASSERT(m != 0);
|
||||
if (m == 0)
|
||||
throw Integer::DivideByZero();
|
||||
|
||||
ModularArithmetic mr(m);
|
||||
return mr.Exponentiate(x, e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user