diff --git a/Libraries/LibCrypto/NumberTheory/ModularFunctions.h b/Libraries/LibCrypto/NumberTheory/ModularFunctions.h index d354a8dac2..7d31f666ac 100644 --- a/Libraries/LibCrypto/NumberTheory/ModularFunctions.h +++ b/Libraries/LibCrypto/NumberTheory/ModularFunctions.h @@ -34,7 +34,7 @@ namespace Crypto { namespace NumberTheory { -static auto ModularInverse(const UnsignedBigInteger& a_, const UnsignedBigInteger& b) -> UnsignedBigInteger +inline UnsignedBigInteger ModularInverse(const UnsignedBigInteger& a_, const UnsignedBigInteger& b) { if (b == 1) return { 1 }; @@ -121,7 +121,7 @@ static auto ModularInverse(const UnsignedBigInteger& a_, const UnsignedBigIntege return temp_remainder; } -static auto ModularPower(const UnsignedBigInteger& b, const UnsignedBigInteger& e, const UnsignedBigInteger& m) -> UnsignedBigInteger +static UnsignedBigInteger ModularPower(const UnsignedBigInteger& b, const UnsignedBigInteger& e, const UnsignedBigInteger& m) { if (m == 1) return 0; @@ -165,18 +165,18 @@ static auto ModularPower(const UnsignedBigInteger& b, const UnsignedBigInteger& // it will allocate and free a lot of memory! // Please use |ModularPower| if your use-case is modexp. template -static auto Power(const IntegerType& b, const IntegerType& e) -> IntegerType +static IntegerType Power(const IntegerType& b, const IntegerType& e) { IntegerType ep { e }; IntegerType base { b }; IntegerType exp { 1 }; - while (!(ep < 1)) { + while (!(ep < IntegerType { 1 })) { if (ep.words()[0] % 2 == 1) exp.set_to(exp.multiplied_by(base)); // ep = ep / 2; - ep.set_to(ep.divided_by(2).quotient); + ep.set_to(ep.divided_by(IntegerType { 2 }).quotient); // base = base * base base.set_to(base.multiplied_by(base)); @@ -220,7 +220,7 @@ static void GCD_without_allocation( } } -static UnsignedBigInteger GCD(const UnsignedBigInteger& a, const UnsignedBigInteger& b) +inline UnsignedBigInteger GCD(const UnsignedBigInteger& a, const UnsignedBigInteger& b) { UnsignedBigInteger temp_a; UnsignedBigInteger temp_b; @@ -237,7 +237,7 @@ static UnsignedBigInteger GCD(const UnsignedBigInteger& a, const UnsignedBigInte return output; } -static auto LCM(const UnsignedBigInteger& a, const UnsignedBigInteger& b) -> UnsignedBigInteger +inline UnsignedBigInteger LCM(const UnsignedBigInteger& a, const UnsignedBigInteger& b) { UnsignedBigInteger temp_a; UnsignedBigInteger temp_b; @@ -338,7 +338,7 @@ static bool is_probably_prime(const UnsignedBigInteger& p) return MR_primality_test(p, tests); } -static UnsignedBigInteger random_big_prime(size_t bits) +inline static UnsignedBigInteger random_big_prime(size_t bits) { ASSERT(bits >= 33); UnsignedBigInteger min = UnsignedBigInteger::from_base10("6074001000").shift_left(bits - 33);