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/pk_algs.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/pk_algs.cpp')
-rw-r--r-- | src/lib/pubkey/pk_algs.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/pubkey/pk_algs.cpp b/src/lib/pubkey/pk_algs.cpp index 2a34bd6f6..e7d744ae9 100644 --- a/src/lib/pubkey/pk_algs.cpp +++ b/src/lib/pubkey/pk_algs.cpp @@ -122,8 +122,7 @@ load_public_key(const AlgorithmIdentifier& alg_id, std::unique_ptr<Private_Key> load_private_key(const AlgorithmIdentifier& alg_id, - const secure_vector<byte>& key_bits, - RandomNumberGenerator& rng) + const secure_vector<byte>& key_bits) { const std::string alg_name = OIDS::lookup(alg_id.oid); if(alg_name == "") @@ -131,12 +130,12 @@ load_private_key(const AlgorithmIdentifier& alg_id, #if defined(BOTAN_HAS_RSA) if(alg_name == "RSA") - return std::unique_ptr<Private_Key>(new RSA_PrivateKey(alg_id, key_bits, rng)); + return std::unique_ptr<Private_Key>(new RSA_PrivateKey(alg_id, key_bits)); #endif #if defined(BOTAN_HAS_CURVE_25519) if(alg_name == "Curve25519") - return std::unique_ptr<Private_Key>(new Curve25519_PrivateKey(alg_id, key_bits, rng)); + return std::unique_ptr<Private_Key>(new Curve25519_PrivateKey(alg_id, key_bits)); #endif #if defined(BOTAN_HAS_ECDSA) @@ -151,12 +150,12 @@ load_private_key(const AlgorithmIdentifier& alg_id, #if defined(BOTAN_HAS_DIFFIE_HELLMAN) if(alg_name == "DH") - return std::unique_ptr<Private_Key>(new DH_PrivateKey(alg_id, key_bits, rng)); + return std::unique_ptr<Private_Key>(new DH_PrivateKey(alg_id, key_bits)); #endif #if defined(BOTAN_HAS_DSA) if(alg_name == "DSA") - return std::unique_ptr<Private_Key>(new DSA_PrivateKey(alg_id, key_bits, rng)); + return std::unique_ptr<Private_Key>(new DSA_PrivateKey(alg_id, key_bits)); #endif #if defined(BOTAN_HAS_MCELIECE) @@ -181,7 +180,7 @@ load_private_key(const AlgorithmIdentifier& alg_id, #if defined(BOTAN_HAS_ELGAMAL) if(alg_name == "ElGamal") - return std::unique_ptr<Private_Key>(new ElGamal_PrivateKey(alg_id, key_bits, rng)); + return std::unique_ptr<Private_Key>(new ElGamal_PrivateKey(alg_id, key_bits)); #endif throw Decoding_Error("Unhandled PK algorithm " + alg_name); |