diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/pubkey/pubkey.cpp | 29 | ||||
-rw-r--r-- | src/lib/pubkey/pubkey.h | 34 |
2 files changed, 34 insertions, 29 deletions
diff --git a/src/lib/pubkey/pubkey.cpp b/src/lib/pubkey/pubkey.cpp index 74aebd5d2..e24c197b7 100644 --- a/src/lib/pubkey/pubkey.cpp +++ b/src/lib/pubkey/pubkey.cpp @@ -94,7 +94,7 @@ PK_Encryptor_EME::PK_Encryptor_EME(const Public_Key& key, throw Invalid_Argument("Key type " + key.algo_name() + " does not support encryption"); } -PK_Encryptor_EME::~PK_Encryptor_EME() { /* for unique_ptr */ } +PK_Encryptor_EME::~PK_Encryptor_EME() = default; size_t PK_Encryptor_EME::ciphertext_length(size_t ptext_len) const { @@ -122,7 +122,7 @@ PK_Decryptor_EME::PK_Decryptor_EME(const Private_Key& key, throw Invalid_Argument("Key type " + key.algo_name() + " does not support decryption"); } -PK_Decryptor_EME::~PK_Decryptor_EME() { /* for unique_ptr */ } +PK_Decryptor_EME::~PK_Decryptor_EME() = default; size_t PK_Decryptor_EME::plaintext_length(size_t ctext_len) const { @@ -145,7 +145,7 @@ PK_KEM_Encryptor::PK_KEM_Encryptor(const Public_Key& key, throw Invalid_Argument("Key type " + key.algo_name() + " does not support KEM encryption"); } -PK_KEM_Encryptor::~PK_KEM_Encryptor() { /* for unique_ptr */ } +PK_KEM_Encryptor::~PK_KEM_Encryptor() = default; void PK_KEM_Encryptor::encrypt(secure_vector<uint8_t>& out_encapsulated_key, secure_vector<uint8_t>& out_shared_key, @@ -172,7 +172,7 @@ PK_KEM_Decryptor::PK_KEM_Decryptor(const Private_Key& key, throw Invalid_Argument("Key type " + key.algo_name() + " does not support KEM decryption"); } -PK_KEM_Decryptor::~PK_KEM_Decryptor() { /* for unique_ptr */ } +PK_KEM_Decryptor::~PK_KEM_Decryptor() = default; secure_vector<uint8_t> PK_KEM_Decryptor::decrypt(const uint8_t encap_key[], size_t encap_key_len, @@ -185,6 +185,8 @@ secure_vector<uint8_t> PK_KEM_Decryptor::decrypt(const uint8_t encap_key[], salt, salt_len); } +PK_Key_Agreement::PK_Key_Agreement(PK_Key_Agreement&&) = default; + PK_Key_Agreement::PK_Key_Agreement(const Private_Key& key, RandomNumberGenerator& rng, const std::string& kdf, @@ -195,20 +197,7 @@ PK_Key_Agreement::PK_Key_Agreement(const Private_Key& key, throw Invalid_Argument("Key type " + key.algo_name() + " does not support key agreement"); } -PK_Key_Agreement::~PK_Key_Agreement() { /* for unique_ptr */ } - -PK_Key_Agreement& PK_Key_Agreement::operator=(PK_Key_Agreement&& other) - { - if(this != &other) - { - m_op = std::move(other.m_op); - } - return (*this); - } - -PK_Key_Agreement::PK_Key_Agreement(PK_Key_Agreement&& other) : - m_op(std::move(other.m_op)) - {} +PK_Key_Agreement::~PK_Key_Agreement() = default; size_t PK_Key_Agreement::agreed_value_size() const { @@ -244,7 +233,7 @@ PK_Signer::PK_Signer(const Private_Key& key, check_der_format_supported(format, m_parts); } -PK_Signer::~PK_Signer() { /* for unique_ptr */ } +PK_Signer::~PK_Signer() = default; void PK_Signer::update(const uint8_t in[], size_t length) { @@ -320,7 +309,7 @@ PK_Verifier::PK_Verifier(const Public_Key& key, check_der_format_supported(format, m_parts); } -PK_Verifier::~PK_Verifier() { /* for unique_ptr */ } +PK_Verifier::~PK_Verifier() = default; void PK_Verifier::set_input_format(Signature_Format format) { diff --git a/src/lib/pubkey/pubkey.h b/src/lib/pubkey/pubkey.h index 96fed6efc..22b0693af 100644 --- a/src/lib/pubkey/pubkey.h +++ b/src/lib/pubkey/pubkey.h @@ -66,7 +66,9 @@ class BOTAN_PUBLIC_API(2,0) PK_Encryptor virtual ~PK_Encryptor() = default; PK_Encryptor(const PK_Encryptor&) = delete; + PK_Encryptor(PK_Encryptor&&) = delete; PK_Encryptor& operator=(const PK_Encryptor&) = delete; + PK_Encryptor& operator=(PK_Encryptor&&) = delete; private: virtual std::vector<uint8_t> enc(const uint8_t[], size_t, @@ -146,7 +148,9 @@ class BOTAN_PUBLIC_API(2,0) PK_Decryptor virtual ~PK_Decryptor() = default; PK_Decryptor(const PK_Decryptor&) = delete; + PK_Decryptor(PK_Decryptor&&) = delete; PK_Decryptor& operator=(const PK_Decryptor&) = delete; + PK_Decryptor& operator=(PK_Decryptor&&) = delete; private: virtual secure_vector<uint8_t> do_decrypt(uint8_t& valid_mask, @@ -180,7 +184,9 @@ class BOTAN_PUBLIC_API(2,0) PK_Signer final ~PK_Signer(); PK_Signer(const PK_Signer&) = delete; + PK_Signer(PK_Signer&&) = delete; PK_Signer& operator=(const PK_Signer&) = delete; + PK_Signer& operator=(PK_Signer&&) = delete; /** * Sign a message all in one go @@ -290,8 +296,10 @@ class BOTAN_PUBLIC_API(2,0) PK_Verifier final ~PK_Verifier(); - PK_Verifier& operator=(const PK_Verifier&) = delete; PK_Verifier(const PK_Verifier&) = delete; + PK_Verifier(PK_Verifier&&) = delete; + PK_Verifier& operator=(const PK_Verifier&) = delete; + PK_Verifier& operator=(PK_Verifier&&) = delete; /** * Verify a signature. @@ -406,13 +414,13 @@ class BOTAN_PUBLIC_API(2,0) PK_Key_Agreement final ~PK_Key_Agreement(); + PK_Key_Agreement(const PK_Key_Agreement&) = delete; + PK_Key_Agreement& operator=(const PK_Key_Agreement&) = delete; + PK_Key_Agreement& operator=(PK_Key_Agreement&&) = delete; + // For ECIES - PK_Key_Agreement& operator=(PK_Key_Agreement&&); PK_Key_Agreement(PK_Key_Agreement&&); - PK_Key_Agreement& operator=(const PK_Key_Agreement&) = delete; - PK_Key_Agreement(const PK_Key_Agreement&) = delete; - /** * Perform Key Agreement Operation * @param key_len the desired key output size @@ -508,8 +516,10 @@ class BOTAN_PUBLIC_API(2,0) PK_Encryptor_EME final : public PK_Encryptor ~PK_Encryptor_EME(); - PK_Encryptor_EME& operator=(const PK_Encryptor_EME&) = delete; PK_Encryptor_EME(const PK_Encryptor_EME&) = delete; + PK_Encryptor_EME(PK_Encryptor_EME&&) = delete; + PK_Encryptor_EME& operator=(const PK_Encryptor_EME&) = delete; + PK_Encryptor_EME& operator=(PK_Encryptor_EME&&) = delete; /** * Return an upper bound on the ciphertext length for a particular @@ -544,8 +554,10 @@ class BOTAN_PUBLIC_API(2,0) PK_Decryptor_EME final : public PK_Decryptor size_t plaintext_length(size_t ptext_len) const override; ~PK_Decryptor_EME(); - PK_Decryptor_EME& operator=(const PK_Decryptor_EME&) = delete; PK_Decryptor_EME(const PK_Decryptor_EME&) = delete; + PK_Decryptor_EME(PK_Decryptor_EME&&) = delete; + PK_Decryptor_EME& operator=(const PK_Decryptor_EME&) = delete; + PK_Decryptor_EME& operator=(PK_Decryptor_EME&&) = delete; private: secure_vector<uint8_t> do_decrypt(uint8_t& valid_mask, const uint8_t in[], @@ -574,8 +586,10 @@ class BOTAN_PUBLIC_API(2,0) PK_KEM_Encryptor final ~PK_KEM_Encryptor(); - PK_KEM_Encryptor& operator=(const PK_KEM_Encryptor&) = delete; PK_KEM_Encryptor(const PK_KEM_Encryptor&) = delete; + PK_KEM_Encryptor(PK_KEM_Encryptor&&) = delete; + PK_KEM_Encryptor& operator=(const PK_KEM_Encryptor&) = delete; + PK_KEM_Encryptor& operator=(PK_KEM_Encryptor&&) = delete; /** * Generate a shared key for data encryption. @@ -659,8 +673,10 @@ class BOTAN_PUBLIC_API(2,0) PK_KEM_Decryptor final const std::string& provider = ""); ~PK_KEM_Decryptor(); - PK_KEM_Decryptor& operator=(const PK_KEM_Decryptor&) = delete; PK_KEM_Decryptor(const PK_KEM_Decryptor&) = delete; + PK_KEM_Decryptor(PK_KEM_Decryptor&&) = delete; + PK_KEM_Decryptor& operator=(const PK_KEM_Decryptor&) = delete; + PK_KEM_Decryptor& operator=(PK_KEM_Decryptor&&) = delete; /** * Decrypts the shared key for data encryption. |