diff --git a/integer.cpp b/integer.cpp index e89aee5e..3246fb53 100644 --- a/integer.cpp +++ b/integer.cpp @@ -4386,13 +4386,13 @@ Integer Integer::Gcd(const Integer &a, const Integer &b) Integer Integer::InverseMod(const Integer &m) const { CRYPTOPP_ASSERT(m.NotNegative()); - CRYPTOPP_ASSERT(m != 0); + CRYPTOPP_ASSERT(m.NotZero()); if (IsNegative()) return Modulo(m).InverseModNext(m); // http://github.com/weidai11/cryptopp/issues/602 - if (*this > m) + if (*this >= m) return Modulo(m).InverseModNext(m); return InverseModNext(m); @@ -4401,7 +4401,7 @@ Integer Integer::InverseMod(const Integer &m) const Integer Integer::InverseModNext(const Integer &m) const { CRYPTOPP_ASSERT(m.NotNegative()); - CRYPTOPP_ASSERT(m != 0); + CRYPTOPP_ASSERT(m.NotZero()); if (m.IsEven()) { diff --git a/validat0.cpp b/validat0.cpp index fc9a2c5b..9f03533c 100644 --- a/validat0.cpp +++ b/validat0.cpp @@ -3374,7 +3374,7 @@ bool TestIntegerOps() // ******************** Integer Modulo and InverseMod ******************** // http://github.com/weidai11/cryptopp/issues/602 - // The bug report that uncovered the InverseMod problems + // The bug report that uncovered the InverseMod problems { Integer a("0x2F0500010000018000000000001C1C000000000000000A000B0000000000000000000000000000FDFFFFFF00000000"); Integer b("0x3D2F050001");