diff options
-rw-r--r-- | checks/pk.cpp | 12 | ||||
-rw-r--r-- | checks/pk_bench.cpp | 8 | ||||
-rw-r--r-- | doc/examples/rsa_dec.cpp | 2 | ||||
-rw-r--r-- | doc/examples/rsa_enc.cpp | 2 | ||||
-rw-r--r-- | src/cms/cms_ealg.cpp | 2 | ||||
-rw-r--r-- | src/libstate/look_pk.h | 4 | ||||
-rw-r--r-- | src/pubkey/elgamal/elgamal.cpp | 4 | ||||
-rw-r--r-- | src/pubkey/pubkey.cpp | 32 | ||||
-rw-r--r-- | src/pubkey/pubkey.h | 42 | ||||
-rw-r--r-- | src/ssl/c_kex.cpp | 4 |
10 files changed, 57 insertions, 55 deletions
diff --git a/checks/pk.cpp b/checks/pk.cpp index cee298f6b..a69fa7bc7 100644 --- a/checks/pk.cpp +++ b/checks/pk.cpp @@ -238,8 +238,8 @@ u32bit validate_rsa_enc_pkcs8(const std::string& algo, std::string eme = algo.substr(12, std::string::npos); - PK_Encryptor_MR_with_EME e(*rsapub, eme); - PK_Decryptor_MR_with_EME d(*rsapriv, eme); + PK_Encryptor_EME e(*rsapub, eme); + PK_Decryptor_EME d(*rsapriv, eme); bool failure = false; validate_encryption(e, d, algo, str[1], str[2], str[3], failure); @@ -265,8 +265,8 @@ u32bit validate_rsa_enc(const std::string& algo, std::string eme = algo.substr(6, std::string::npos); - PK_Encryptor_MR_with_EME e(pubkey, eme); - PK_Decryptor_MR_with_EME d(privkey, eme); + PK_Encryptor_EME e(pubkey, eme); + PK_Decryptor_EME d(privkey, eme); bool failure = false; validate_encryption(e, d, algo, str[3], str[4], str[5], failure); @@ -291,12 +291,12 @@ u32bit validate_elg_enc(const std::string& algo, std::string eme = algo.substr(8, std::string::npos); - PK_Decryptor_MR_with_EME d(privkey, eme); + PK_Decryptor_EME d(privkey, eme); bool failure = false; if(str.size() == 7) { - PK_Encryptor_MR_with_EME e(pubkey, eme); + PK_Encryptor_EME e(pubkey, eme); validate_encryption(e, d, algo, str[4], str[5], str[6], failure); } else diff --git a/checks/pk_bench.cpp b/checks/pk_bench.cpp index 0cc1bea3a..c9e79e997 100644 --- a/checks/pk_bench.cpp +++ b/checks/pk_bench.cpp @@ -214,8 +214,8 @@ void benchmark_rsa(RandomNumberGenerator& rng, while(verify_timer.seconds() < seconds || sig_timer.seconds() < seconds) { - PK_Encryptor_MR_with_EME enc(key, enc_padding); - PK_Decryptor_MR_with_EME dec(key, enc_padding); + PK_Encryptor_EME enc(key, enc_padding); + PK_Decryptor_EME dec(key, enc_padding); benchmark_enc_dec(enc, dec, enc_timer, dec_timer, rng, 10000, seconds); @@ -675,8 +675,8 @@ void benchmark_elg(RandomNumberGenerator& rng, ElGamal_PrivateKey key(rng, group); keygen_timer.stop(); - PK_Decryptor_MR_with_EME dec(key, padding); - PK_Encryptor_MR_with_EME enc(key, padding); + PK_Decryptor_EME dec(key, padding); + PK_Encryptor_EME enc(key, padding); benchmark_enc_dec(enc, dec, enc_timer, dec_timer, rng, 1000, seconds); diff --git a/doc/examples/rsa_dec.cpp b/doc/examples/rsa_dec.cpp index df681d85b..8353b0449 100644 --- a/doc/examples/rsa_dec.cpp +++ b/doc/examples/rsa_dec.cpp @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) SecureVector<byte> enc_masterkey = b64_decode(enc_masterkey_str); - PK_Decryptor_MR_with_EME decryptor(*rsakey, "EME1(SHA-1)"); + PK_Decryptor_EME decryptor(*rsakey, "EME1(SHA-1)"); SecureVector<byte> masterkey = decryptor.decrypt(enc_masterkey); diff --git a/doc/examples/rsa_enc.cpp b/doc/examples/rsa_enc.cpp index 8ee4df181..6cf555e70 100644 --- a/doc/examples/rsa_enc.cpp +++ b/doc/examples/rsa_enc.cpp @@ -77,7 +77,7 @@ int main(int argc, char* argv[]) AutoSeeded_RNG rng; - PK_Encryptor_MR_with_EME encryptor(*rsakey, "EME1(SHA-1)"); + PK_Encryptor_EME encryptor(*rsakey, "EME1(SHA-1)"); /* Generate the master key (the other keys are derived from this) diff --git a/src/cms/cms_ealg.cpp b/src/cms/cms_ealg.cpp index 0cfdbba82..3ddf8a39e 100644 --- a/src/cms/cms_ealg.cpp +++ b/src/cms/cms_ealg.cpp @@ -131,7 +131,7 @@ void CMS_Encoder::encrypt_ktri(RandomNumberGenerator& rng, const std::string padding = "EME-PKCS1-v1_5"; const std::string pk_algo = pub_key->algo_name(); - PK_Encryptor_MR_with_EME encryptor(*pub_key, padding); + PK_Encryptor_EME encryptor(*pub_key, padding); SymmetricKey cek = setup_key(rng, cipher); diff --git a/src/libstate/look_pk.h b/src/libstate/look_pk.h index 59fe7d8c8..833b28f67 100644 --- a/src/libstate/look_pk.h +++ b/src/libstate/look_pk.h @@ -22,7 +22,7 @@ namespace Botan { inline PK_Encryptor* get_pk_encryptor(const Public_Key& key, const std::string& eme) { - return new PK_Encryptor_MR_with_EME(key, eme); + return new PK_Encryptor_EME(key, eme); } /** @@ -34,7 +34,7 @@ inline PK_Encryptor* get_pk_encryptor(const Public_Key& key, inline PK_Decryptor* get_pk_decryptor(const Private_Key& key, const std::string& eme) { - return new PK_Decryptor_MR_with_EME(key, eme); + return new PK_Decryptor_EME(key, eme); } /** diff --git a/src/pubkey/elgamal/elgamal.cpp b/src/pubkey/elgamal/elgamal.cpp index 6b919d916..fe83b3b2b 100644 --- a/src/pubkey/elgamal/elgamal.cpp +++ b/src/pubkey/elgamal/elgamal.cpp @@ -65,8 +65,8 @@ bool ElGamal_PrivateKey::check_key(RandomNumberGenerator& rng, try { - PK_Encryptor_MR_with_EME this_encryptor(*this, "EME1(SHA-1)"); - PK_Decryptor_MR_with_EME this_decryptor(*this, "EME1(SHA-1)"); + PK_Encryptor_EME this_encryptor(*this, "EME1(SHA-1)"); + PK_Decryptor_EME this_decryptor(*this, "EME1(SHA-1)"); KeyPair::check_key(rng, this_encryptor, diff --git a/src/pubkey/pubkey.cpp b/src/pubkey/pubkey.cpp index 7426292ce..5b6c7cd45 100644 --- a/src/pubkey/pubkey.cpp +++ b/src/pubkey/pubkey.cpp @@ -19,10 +19,10 @@ namespace Botan { /* -* PK_Encryptor_MR_with_EME Constructor +* PK_Encryptor_EME Constructor */ -PK_Encryptor_MR_with_EME::PK_Encryptor_MR_with_EME(const Public_Key& key, - const std::string& eme_name) +PK_Encryptor_EME::PK_Encryptor_EME(const Public_Key& key, + const std::string& eme_name) { Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory()); @@ -34,7 +34,7 @@ PK_Encryptor_MR_with_EME::PK_Encryptor_MR_with_EME(const Public_Key& key, } if(op == 0) - throw Lookup_Error("PK_Encryptor_MR_with_EME: No working engine for " + + throw Lookup_Error("PK_Encryptor_EME: No working engine for " + key.algo_name()); eme = get_eme(eme_name); @@ -44,9 +44,9 @@ PK_Encryptor_MR_with_EME::PK_Encryptor_MR_with_EME(const Public_Key& key, * Encrypt a message */ SecureVector<byte> -PK_Encryptor_MR_with_EME::enc(const byte msg[], - u32bit length, - RandomNumberGenerator& rng) const +PK_Encryptor_EME::enc(const byte msg[], + u32bit length, + RandomNumberGenerator& rng) const { SecureVector<byte> message; if(eme) @@ -55,7 +55,7 @@ PK_Encryptor_MR_with_EME::enc(const byte msg[], message.set(msg, length); if(8*(message.size() - 1) + high_bit(message[0]) > op->max_input_bits()) - throw Invalid_Argument("PK_Encryptor_MR_with_EME: Input is too large"); + throw Invalid_Argument("PK_Encryptor_EME: Input is too large"); return op->encrypt(message, message.size(), rng); } @@ -63,7 +63,7 @@ PK_Encryptor_MR_with_EME::enc(const byte msg[], /* * Return the max size, in bytes, of a message */ -u32bit PK_Encryptor_MR_with_EME::maximum_input_size() const +u32bit PK_Encryptor_EME::maximum_input_size() const { if(!eme) return (op->max_input_bits() / 8); @@ -72,10 +72,10 @@ u32bit PK_Encryptor_MR_with_EME::maximum_input_size() const } /* -* PK_Decryptor_MR_with_EME Constructor +* PK_Decryptor_EME Constructor */ -PK_Decryptor_MR_with_EME::PK_Decryptor_MR_with_EME(const Private_Key& key, - const std::string& eme_name) +PK_Decryptor_EME::PK_Decryptor_EME(const Private_Key& key, + const std::string& eme_name) { Algorithm_Factory::Engine_Iterator i(global_state().algorithm_factory()); @@ -87,7 +87,7 @@ PK_Decryptor_MR_with_EME::PK_Decryptor_MR_with_EME(const Private_Key& key, } if(op == 0) - throw Lookup_Error("PK_Decryptor_MR_with_EME: No working engine for " + + throw Lookup_Error("PK_Decryptor_EME: No working engine for " + key.algo_name()); eme = get_eme(eme_name); @@ -96,8 +96,8 @@ PK_Decryptor_MR_with_EME::PK_Decryptor_MR_with_EME(const Private_Key& key, /* * Decrypt a message */ -SecureVector<byte> PK_Decryptor_MR_with_EME::dec(const byte msg[], - u32bit length) const +SecureVector<byte> PK_Decryptor_EME::dec(const byte msg[], + u32bit length) const { try { SecureVector<byte> decrypted = op->decrypt(msg, length); @@ -108,7 +108,7 @@ SecureVector<byte> PK_Decryptor_MR_with_EME::dec(const byte msg[], } catch(Invalid_Argument) { - throw Decoding_Error("PK_Decryptor_MR_with_EME: Input is invalid"); + throw Decoding_Error("PK_Decryptor_EME: Input is invalid"); } } diff --git a/src/pubkey/pubkey.h b/src/pubkey/pubkey.h index c65ecd468..a262b51fe 100644 --- a/src/pubkey/pubkey.h +++ b/src/pubkey/pubkey.h @@ -61,8 +61,12 @@ class BOTAN_DLL PK_Encryptor */ virtual u32bit maximum_input_size() const = 0; + PK_Encryptor() {} virtual ~PK_Encryptor() {} private: + PK_Encryptor(const PK_Encryptor&) {} + PK_Encryptor& operator=(const PK_Encryptor&) { return *this; } + virtual SecureVector<byte> enc(const byte[], u32bit, RandomNumberGenerator&) const = 0; }; @@ -94,8 +98,12 @@ class BOTAN_DLL PK_Decryptor return dec(&in[0], in.size()); } + PK_Decryptor() {} virtual ~PK_Decryptor() {} private: + PK_Decryptor(const PK_Decryptor&) {} + PK_Decryptor& operator=(const PK_Decryptor&) { return *this; } + virtual SecureVector<byte> dec(const byte[], u32bit) const = 0; }; @@ -173,8 +181,8 @@ class BOTAN_DLL PK_Signer ~PK_Signer() { delete op; delete emsa; } private: - PK_Signer(const PK_Signer&); - PK_Signer& operator=(const PK_Signer&); + PK_Signer(const PK_Signer&) {} + PK_Signer& operator=(const PK_Signer&) { return *this; } PK_Ops::Signature* op; EMSA* emsa; @@ -272,8 +280,8 @@ class BOTAN_DLL PK_Verifier ~PK_Verifier() { delete op; delete emsa; } private: - PK_Verifier(const PK_Verifier&); - PK_Verifier& operator=(const PK_Verifier&); + PK_Verifier(const PK_Verifier&) {} + PK_Verifier& operator=(const PK_Verifier&) { return *this; } bool validate_signature(const MemoryRegion<byte>& msg, const byte sig[], u32bit sig_len); @@ -362,8 +370,8 @@ class BOTAN_DLL PK_Key_Agreement ~PK_Key_Agreement() { delete op; delete kdf; } private: - PK_Key_Agreement(const PK_Key_Agreement_Key&); - PK_Key_Agreement& operator=(const PK_Key_Agreement&); + PK_Key_Agreement(const PK_Key_Agreement_Key&) {} + PK_Key_Agreement& operator=(const PK_Key_Agreement&) { return *this; } PK_Ops::Key_Agreement* op; KDF* kdf; @@ -372,7 +380,7 @@ class BOTAN_DLL PK_Key_Agreement /** * Encryption with an MR algorithm and an EME. */ -class BOTAN_DLL PK_Encryptor_MR_with_EME : public PK_Encryptor +class BOTAN_DLL PK_Encryptor_EME : public PK_Encryptor { public: u32bit maximum_input_size() const; @@ -382,14 +390,11 @@ class BOTAN_DLL PK_Encryptor_MR_with_EME : public PK_Encryptor * @param key the key to use inside the decryptor * @param eme the EME to use */ - PK_Encryptor_MR_with_EME(const Public_Key& key, - const std::string& eme); + PK_Encryptor_EME(const Public_Key& key, + const std::string& eme); - ~PK_Encryptor_MR_with_EME() { delete op; delete eme; } + ~PK_Encryptor_EME() { delete op; delete eme; } private: - PK_Encryptor_MR_with_EME(const PK_Encryptor_MR_with_EME&); - PK_Encryptor_MR_with_EME& operator=(const PK_Encryptor_MR_with_EME&); - SecureVector<byte> enc(const byte[], u32bit, RandomNumberGenerator& rng) const; @@ -400,7 +405,7 @@ class BOTAN_DLL PK_Encryptor_MR_with_EME : public PK_Encryptor /** * Decryption with an MR algorithm and an EME. */ -class BOTAN_DLL PK_Decryptor_MR_with_EME : public PK_Decryptor +class BOTAN_DLL PK_Decryptor_EME : public PK_Decryptor { public: /** @@ -408,14 +413,11 @@ class BOTAN_DLL PK_Decryptor_MR_with_EME : public PK_Decryptor * @param key the key to use inside the encryptor * @param eme the EME to use */ - PK_Decryptor_MR_with_EME(const Private_Key& key, - const std::string& eme); + PK_Decryptor_EME(const Private_Key& key, + const std::string& eme); - ~PK_Decryptor_MR_with_EME() { delete op; delete eme; } + ~PK_Decryptor_EME() { delete op; delete eme; } private: - PK_Decryptor_MR_with_EME(const PK_Decryptor_MR_with_EME&); - PK_Decryptor_MR_with_EME& operator=(const PK_Decryptor_MR_with_EME&); - SecureVector<byte> dec(const byte[], u32bit) const; const PK_Ops::Decryption* op; diff --git a/src/ssl/c_kex.cpp b/src/ssl/c_kex.cpp index 7140bf35c..9e59beefc 100644 --- a/src/ssl/c_kex.cpp +++ b/src/ssl/c_kex.cpp @@ -44,7 +44,7 @@ Client_Key_Exchange::Client_Key_Exchange(RandomNumberGenerator& rng, pre_master[0] = (pref_version >> 8) & 0xFF; pre_master[1] = (pref_version ) & 0xFF; - PK_Encryptor_MR_with_EME encryptor(*rsa_pub, "PKCS1v15"); + PK_Encryptor_EME encryptor(*rsa_pub, "PKCS1v15"); key_material = encryptor.encrypt(pre_master, rng); @@ -138,7 +138,7 @@ Client_Key_Exchange::pre_master_secret(RandomNumberGenerator& rng, } else if(const RSA_PrivateKey* rsa_priv = dynamic_cast<const RSA_PrivateKey*>(priv_key)) { - PK_Decryptor_MR_with_EME decryptor(*rsa_priv, "PKCS1v15"); + PK_Decryptor_EME decryptor(*rsa_priv, "PKCS1v15"); try { pre_master = decryptor.decrypt(key_material); |