Skip to content

Truly independent web browser

LibCrypto: Remove unused signed big integer operations

Shannon Boothff231a393ebd
diff --git a/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp b/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp
index 1a6f166d1f7..08866dcac2c 100644
--- a/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp
+++ b/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp
@@ -378,31 +378,6 @@ FLATTEN SignedBigInteger SignedBigInteger::shift_right(size_t num_bits) const
return result;
}
-FLATTEN ErrorOr<SignedBigInteger> SignedBigInteger::mod_power_of_two(size_t power_of_two) const
-{
- if (power_of_two == 0)
- return SignedBigInteger(0);
-
- // If the number is positive and smaller than the modulus, we can just return it.
- if (!is_negative() && static_cast<size_t>(m_mp.used * MP_DIGIT_BIT) <= power_of_two)
- return *this;
-
- // If the power of two overflows the int type, we don't have enough memory to compute it.
- if (power_of_two > NumericLimits<int>::max())
- return Error::from_errno(ENOMEM);
-
- SignedBigInteger result;
- MP_MUST(mp_mod_2d(&m_mp, power_of_two, &result.m_mp));
- if (!result.is_negative())
- return result;
-
- // If the result is negative, we need to add the modulus to it.
- UnsignedBigInteger modulus;
- MP_TRY(mp_2expt(&modulus.m_mp, power_of_two));
- MP_MUST(mp_add(&result.m_mp, &modulus.m_mp, &result.m_mp));
- return result;
-}
-
FLATTEN SignedBigInteger SignedBigInteger::multiplied_by(SignedBigInteger const& other) const
{
SignedBigInteger result;
@@ -439,13 +414,6 @@ FLATTEN SignedBigInteger SignedBigInteger::pow(u32 exponent) const
return result;
}
-FLATTEN SignedBigInteger SignedBigInteger::negated_value() const
-{
- auto result { *this };
- result.negate();
- return result;
-}
-
u32 SignedBigInteger::hash() const
{
return m_hash.ensure([&] {
diff --git a/Libraries/LibCrypto/BigInt/SignedBigInteger.h b/Libraries/LibCrypto/BigInt/SignedBigInteger.h
index 1d17fbe4f64..2f69be62b6f 100644
--- a/Libraries/LibCrypto/BigInt/SignedBigInteger.h
+++ b/Libraries/LibCrypto/BigInt/SignedBigInteger.h
@@ -80,8 +80,6 @@ public:
[[nodiscard]] SignedBigInteger quotient(SignedBigInteger const& divisor) const;
[[nodiscard]] SignedBigInteger remainder(SignedBigInteger const& divisor) const;
[[nodiscard]] SignedBigInteger pow(u32 exponent) const;
- [[nodiscard]] ErrorOr<SignedBigInteger> mod_power_of_two(size_t power_of_two) const;
-
[[nodiscard]] SignedBigInteger plus(UnsignedBigInteger const& other) const;
[[nodiscard]] SignedBigInteger minus(UnsignedBigInteger const& other) const;
[[nodiscard]] SignedBigInteger multiplied_by(UnsignedBigInteger const& other) const;
@@ -89,8 +87,6 @@ public:
[[nodiscard]] SignedBigInteger quotient(UnsignedBigInteger const& divisor) const;
[[nodiscard]] SignedBigInteger remainder(UnsignedBigInteger const& divisor) const;
- [[nodiscard]] SignedBigInteger negated_value() const;
-
[[nodiscard]] u32 hash() const;
[[nodiscard]] bool operator==(SignedBigInteger const& other) const;