diff options
author | Jack Lloyd <[email protected]> | 2016-11-02 15:05:46 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-03 11:57:10 -0400 |
commit | 8d50c82b43b34b70d19b0faaeab6b37f2eae066c (patch) | |
tree | 9cb7478fb7c37c66e140bc09ca77bf0ede07cc76 /src/lib/pubkey/rsa/rsa.cpp | |
parent | b1021ca76bb3c47b1b520421ccece38d772e5907 (diff) |
Remove automatic self-testing of public and private keys
Rarely expected and often causes performance problems, especially for private keys.
Instead applications should call check_key explicitly to validate keys when
necessary.
Note this removal doesn't apply to tests like ECDH on-the-curve tests, where a check
on the public key is required for security of our own key.
Updates most APIs to remove RNG calls, where they are no longer required. Exception
is PKCS8 interface, pending further work there (see GH #685) it just ignores the RNG
argument now.
Diffstat (limited to 'src/lib/pubkey/rsa/rsa.cpp')
-rw-r--r-- | src/lib/pubkey/rsa/rsa.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/lib/pubkey/rsa/rsa.cpp b/src/lib/pubkey/rsa/rsa.cpp index 76366b76a..f0418cf53 100644 --- a/src/lib/pubkey/rsa/rsa.cpp +++ b/src/lib/pubkey/rsa/rsa.cpp @@ -85,8 +85,7 @@ secure_vector<byte> RSA_PrivateKey::pkcs8_private_key() const } RSA_PrivateKey::RSA_PrivateKey(const AlgorithmIdentifier&, - const secure_vector<byte>& key_bits, - RandomNumberGenerator& rng) + const secure_vector<byte>& key_bits) { BER_Decoder(key_bits) .start_cons(SEQUENCE) @@ -100,12 +99,9 @@ RSA_PrivateKey::RSA_PrivateKey(const AlgorithmIdentifier&, .decode(m_d2) .decode(m_c) .end_cons(); - - load_check(rng); } -RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng, - const BigInt& prime1, +RSA_PrivateKey::RSA_PrivateKey(const BigInt& prime1, const BigInt& prime2, const BigInt& exp, const BigInt& d_exp, @@ -126,8 +122,6 @@ RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng, m_d1 = m_d % (m_p - 1); m_d2 = m_d % (m_q - 1); - - load_check(rng); } /* @@ -155,8 +149,6 @@ RSA_PrivateKey::RSA_PrivateKey(RandomNumberGenerator& rng, m_d1 = m_d % (m_p - 1); m_d2 = m_d % (m_q - 1); m_c = inverse_mod(m_q, m_p); - - gen_check(rng); } /* |