From 048d6b801226bbd7b6883174c20d9301267f85ba Mon Sep 17 00:00:00 2001 From: devgianlu Date: Sun, 16 Feb 2025 11:56:01 +0100 Subject: [PATCH] LibCrypto: Remove unused constructors from `RSA` class --- Libraries/LibCrypto/PK/RSA.h | 22 -------------------- Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp | 2 +- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/Libraries/LibCrypto/PK/RSA.h b/Libraries/LibCrypto/PK/RSA.h index ea0d12815e0..8a61c7f86a0 100644 --- a/Libraries/LibCrypto/PK/RSA.h +++ b/Libraries/LibCrypto/PK/RSA.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -73,19 +72,6 @@ public: { } - RSAPrivateKey(Integer n, Integer d, Integer e, Integer p, Integer q) - : m_modulus(move(n)) - , m_private_exponent(move(d)) - , m_public_exponent(move(e)) - , m_prime_1(move(p)) - , m_prime_2(move(q)) - , m_exponent_1(NumberTheory::Mod(m_private_exponent, m_prime_1.minus(1))) - , m_exponent_2(NumberTheory::Mod(m_private_exponent, m_prime_2.minus(1))) - , m_coefficient(NumberTheory::ModularInverse(m_prime_2, m_prime_1)) - , m_length(m_modulus.trimmed_length() * sizeof(u32)) - { - } - RSAPrivateKey(Integer n, Integer d, Integer e, Integer p, Integer q, Integer dp, Integer dq, Integer qinv) : m_modulus(move(n)) , m_private_exponent(move(d)) @@ -101,14 +87,6 @@ public: RSAPrivateKey() = default; - static RSAPrivateKey from_crt(Integer n, Integer e, Integer p, Integer q, Integer dp, Integer dq, Integer qinv) - { - auto phi = p.minus(1).multiplied_by(q.minus(1)); - auto d = NumberTheory::ModularInverse(e, phi); - - return { n, d, e, p, q, dp, dq, qinv }; - } - Integer const& modulus() const { return m_modulus; } Integer const& private_exponent() const { return m_private_exponent; } Integer const& public_exponent() const { return m_public_exponent; } diff --git a/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp b/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp index 07d0c034296..b29d0b3d232 100644 --- a/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp +++ b/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp @@ -244,7 +244,7 @@ static WebIDL::ExceptionOr<::Crypto::PK::RSAPrivateKey<>> parse_jwk_rsa_private_ // We know that if any of the extra parameters are provided, all of them must be if (!jwk.p.has_value()) - return ::Crypto::PK::RSAPrivateKey<>(move(n), move(d), move(e), 0, 0); + return ::Crypto::PK::RSAPrivateKey<>(move(n), move(d), move(e)); auto p = TRY(base64_url_uint_decode(realm, *jwk.p)); auto q = TRY(base64_url_uint_decode(realm, *jwk.q));