diff options
author | lloyd <[email protected]> | 2012-07-10 21:13:06 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-07-10 21:13:06 +0000 |
commit | 3a33e128961e7ea4bd584639ba393d056bec3d23 (patch) | |
tree | a1ad9cb2ca67541a90a61b0723c7040191484356 /src | |
parent | 0e718e402cb58c5ccfe538dfe36962c73a223d3a (diff) |
Add deleted copy constructors/assignment operators where appropriate.
Replace C++98 style private copy constructors/assignment ops with ones
annotated with delete.
Diffstat (limited to 'src')
-rw-r--r-- | src/alloc/locking_allocator/locking_allocator.h | 4 | ||||
-rw-r--r-- | src/block/cascade/cascade.h | 3 | ||||
-rw-r--r-- | src/block/lion/lion.h | 3 | ||||
-rw-r--r-- | src/engine/dyn_engine/dyn_engine.h | 4 | ||||
-rw-r--r-- | src/filters/data_src.h | 4 | ||||
-rw-r--r-- | src/filters/filter.h | 8 | ||||
-rw-r--r-- | src/hash/comb4p/comb4p.h | 3 | ||||
-rw-r--r-- | src/mac/cmac/cmac.h | 4 | ||||
-rw-r--r-- | src/mac/hmac/hmac.h | 4 | ||||
-rw-r--r-- | src/mac/x919_mac/x919_mac.h | 4 | ||||
-rw-r--r-- | src/pubkey/pubkey.h | 33 | ||||
-rw-r--r-- | src/stream/ctr/ctr.h | 4 | ||||
-rw-r--r-- | src/tls/tls_channel.h | 4 | ||||
-rw-r--r-- | src/tls/tls_handshake_state.h | 3 |
14 files changed, 67 insertions, 18 deletions
diff --git a/src/alloc/locking_allocator/locking_allocator.h b/src/alloc/locking_allocator/locking_allocator.h index b2dd10dcc..4b5e25e03 100644 --- a/src/alloc/locking_allocator/locking_allocator.h +++ b/src/alloc/locking_allocator/locking_allocator.h @@ -23,6 +23,10 @@ class BOTAN_DLL mlock_allocator bool deallocate(void* p, size_t num_elems, size_t elem_size); + mlock_allocator(const mlock_allocator&) = delete; + + mlock_allocator& operator=(const mlock_allocator&) = delete; + private: mlock_allocator(); diff --git a/src/block/cascade/cascade.h b/src/block/cascade/cascade.h index b1376e2e0..9b7d44fdf 100644 --- a/src/block/cascade/cascade.h +++ b/src/block/cascade/cascade.h @@ -40,6 +40,9 @@ class BOTAN_DLL Cascade_Cipher : public BlockCipher */ Cascade_Cipher(BlockCipher* cipher1, BlockCipher* cipher2); + Cascade_Cipher(const Cascade_Cipher&) = delete; + Cascade_Cipher& operator=(const Cascade_Cipher&) = delete; + ~Cascade_Cipher(); private: void key_schedule(const byte[], size_t); diff --git a/src/block/lion/lion.h b/src/block/lion/lion.h index d016c0e82..37aad19f2 100644 --- a/src/block/lion/lion.h +++ b/src/block/lion/lion.h @@ -48,6 +48,9 @@ class BOTAN_DLL Lion : public BlockCipher StreamCipher* cipher, size_t block_size); + Lion(const Lion&) = delete; + Lion& operator=(const Lion&) = delete; + ~Lion() { delete hash; delete cipher; } private: void key_schedule(const byte[], size_t); diff --git a/src/engine/dyn_engine/dyn_engine.h b/src/engine/dyn_engine/dyn_engine.h index a73a58d8f..3251bc954 100644 --- a/src/engine/dyn_engine/dyn_engine.h +++ b/src/engine/dyn_engine/dyn_engine.h @@ -24,6 +24,10 @@ class BOTAN_DLL Dynamically_Loaded_Engine : public Engine */ Dynamically_Loaded_Engine(const std::string& lib_path); + Dynamically_Loaded_Engine(const Dynamically_Loaded_Engine&) = delete; + + Dynamically_Loaded_Engine& operator=(const Dynamically_Loaded_Engine&) = delete; + ~Dynamically_Loaded_Engine(); std::string provider_name() const { return engine->provider_name(); } diff --git a/src/filters/data_src.h b/src/filters/data_src.h index 775d17cda..e28ef7be1 100644 --- a/src/filters/data_src.h +++ b/src/filters/data_src.h @@ -156,6 +156,10 @@ class BOTAN_DLL DataSource_Stream : public DataSource */ DataSource_Stream(const std::string& file, bool use_binary = false); + DataSource_Stream(const DataSource_Stream&) = delete; + + DataSource_Stream& operator=(const DataSource_Stream&) = delete; + ~DataSource_Stream(); virtual size_t get_bytes_read() const { return total_read; } diff --git a/src/filters/filter.h b/src/filters/filter.h index 581d95c58..b541332a6 100644 --- a/src/filters/filter.h +++ b/src/filters/filter.h @@ -92,6 +92,11 @@ class BOTAN_DLL Filter } Filter(); + + Filter(const Filter&) = delete; + + Filter& operator=(const Filter&) = delete; + private: /** * Start a new message in *this and all following filters. Only for @@ -108,9 +113,6 @@ class BOTAN_DLL Filter friend class Pipe; friend class Fanout_Filter; - Filter(const Filter&) = delete; - Filter& operator=(const Filter&) = delete; - size_t total_ports() const; size_t current_port() const { return port_num; } diff --git a/src/hash/comb4p/comb4p.h b/src/hash/comb4p/comb4p.h index 73e06c379..7ad789cef 100644 --- a/src/hash/comb4p/comb4p.h +++ b/src/hash/comb4p/comb4p.h @@ -25,6 +25,9 @@ class BOTAN_DLL Comb4P : public HashFunction */ Comb4P(HashFunction* h1, HashFunction* h2); + Comp4P(const Comp4P&) = delete; + Comp4P& operator=(const Comp4P&) = delete; + ~Comb4P() { delete hash1; delete hash2; } size_t hash_block_size() const; diff --git a/src/mac/cmac/cmac.h b/src/mac/cmac/cmac.h index b398f2563..c1b75cfa5 100644 --- a/src/mac/cmac/cmac.h +++ b/src/mac/cmac/cmac.h @@ -42,6 +42,10 @@ class BOTAN_DLL CMAC : public MessageAuthenticationCode * @param cipher the underlying block cipher to use */ CMAC(BlockCipher* cipher); + + CMAC(const CMAC&) = delete; + CMAC& operator=(const CMAC&) = delete; + ~CMAC(); private: void add_data(const byte[], size_t); diff --git a/src/mac/hmac/hmac.h b/src/mac/hmac/hmac.h index cb5bd6917..39a084874 100644 --- a/src/mac/hmac/hmac.h +++ b/src/mac/hmac/hmac.h @@ -34,6 +34,10 @@ class BOTAN_DLL HMAC : public MessageAuthenticationCode * @param hash the hash to use for HMACing */ HMAC(HashFunction* hash); + + HMAC(const HMAC&) = delete; + HMAC& operator=(const HMAC&) = delete; + ~HMAC() { delete hash; } private: void add_data(const byte[], size_t); diff --git a/src/mac/x919_mac/x919_mac.h b/src/mac/x919_mac/x919_mac.h index 4b5e63b33..b7b7d685e 100644 --- a/src/mac/x919_mac/x919_mac.h +++ b/src/mac/x919_mac/x919_mac.h @@ -33,6 +33,10 @@ class BOTAN_DLL ANSI_X919_MAC : public MessageAuthenticationCode * @param cipher the underlying block cipher to use */ ANSI_X919_MAC(BlockCipher* cipher); + + ANSI_X919_MAC(const ANSI_X919_MAC&) = delete; + ANSI_X919_MAC& operator=(const ANSI_X919_MAC&) = delete; + ~ANSI_X919_MAC(); private: void add_data(const byte[], size_t); diff --git a/src/pubkey/pubkey.h b/src/pubkey/pubkey.h index 5013a1ed1..cfa46109c 100644 --- a/src/pubkey/pubkey.h +++ b/src/pubkey/pubkey.h @@ -72,10 +72,12 @@ class BOTAN_DLL PK_Encryptor PK_Encryptor() {} virtual ~PK_Encryptor() {} - private: - PK_Encryptor(const PK_Encryptor&) {} - PK_Encryptor& operator=(const PK_Encryptor&) { return *this; } + PK_Encryptor(const PK_Encryptor&) = delete; + + PK_Encryptor& operator=(const PK_Encryptor&) = delete; + + private: virtual std::vector<byte> enc(const byte[], size_t, RandomNumberGenerator&) const = 0; }; @@ -110,10 +112,11 @@ class BOTAN_DLL PK_Decryptor PK_Decryptor() {} virtual ~PK_Decryptor() {} - private: - PK_Decryptor(const PK_Decryptor&) {} - PK_Decryptor& operator=(const PK_Decryptor&) { return *this; } + PK_Decryptor(const PK_Decryptor&) = delete; + PK_Decryptor& operator=(const PK_Decryptor&) = delete; + + private: virtual secure_vector<byte> dec(const byte[], size_t) const = 0; }; @@ -195,14 +198,14 @@ class BOTAN_DLL PK_Signer Signature_Format format = IEEE_1363, Fault_Protection prot = ENABLE_FAULT_PROTECTION); + PK_Signer(const PK_Signer&) = delete; + PK_Signer& operator=(const PK_Signer&) = delete; + ~PK_Signer() { delete op; delete verify_op; delete emsa; } private: bool self_test_signature(const std::vector<byte>& msg, const std::vector<byte>& sig) const; - PK_Signer(const PK_Signer&) {} - PK_Signer& operator=(const PK_Signer&) { return *this; } - PK_Ops::Signature* op; PK_Ops::Verification* verify_op; EMSA* emsa; @@ -301,11 +304,11 @@ class BOTAN_DLL PK_Verifier const std::string& emsa, Signature_Format format = IEEE_1363); + PK_Verifier(const PK_Verifier&) = delete; + PK_Verifier& operator=(const PK_Verifier&) = delete; + ~PK_Verifier() { delete op; delete emsa; } private: - PK_Verifier(const PK_Verifier&) {} - PK_Verifier& operator=(const PK_Verifier&) { return *this; } - bool validate_signature(const secure_vector<byte>& msg, const byte sig[], size_t sig_len); @@ -391,11 +394,11 @@ class BOTAN_DLL PK_Key_Agreement PK_Key_Agreement(const PK_Key_Agreement_Key& key, const std::string& kdf); + PK_Key_Agreement(const PK_Key_Agreement_Key&) = delete; + PK_Key_Agreement& operator=(const PK_Key_Agreement&) = delete; + ~PK_Key_Agreement() { delete op; delete kdf; } private: - 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; }; diff --git a/src/stream/ctr/ctr.h b/src/stream/ctr/ctr.h index 9f391da7e..84cf9ed5d 100644 --- a/src/stream/ctr/ctr.h +++ b/src/stream/ctr/ctr.h @@ -42,6 +42,10 @@ class BOTAN_DLL CTR_BE : public StreamCipher * @param cipher the underlying block cipher to use */ CTR_BE(BlockCipher* cipher); + + CTR_BE(const CTR_BE&) = delete; + CTR_BE& operator=(const CTR_BE&) = delete; + ~CTR_BE(); private: void key_schedule(const byte key[], size_t key_len); diff --git a/src/tls/tls_channel.h b/src/tls/tls_channel.h index c2193b282..de232d042 100644 --- a/src/tls/tls_channel.h +++ b/src/tls/tls_channel.h @@ -89,6 +89,10 @@ class BOTAN_DLL Channel Session_Manager& session_manager, RandomNumberGenerator& rng); + Channel(const Channel&) = delete; + + Channel& operator=(const Channel&) = delete; + virtual ~Channel(); protected: diff --git a/src/tls/tls_handshake_state.h b/src/tls/tls_handshake_state.h index 3ac023b1d..521da0205 100644 --- a/src/tls/tls_handshake_state.h +++ b/src/tls/tls_handshake_state.h @@ -34,6 +34,9 @@ class Handshake_State Handshake_State(Handshake_Reader* reader); ~Handshake_State(); + Handshake_State(const Handshake_State&) = delete; + Handshake_State& operator=(const Handshake_State&) = delete; + bool received_handshake_msg(Handshake_Type handshake_msg) const; void confirm_transition_to(Handshake_Type handshake_msg); |