diff options
author | lloyd <[email protected]> | 2008-09-17 22:58:39 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-17 22:58:39 +0000 |
commit | 2cbe2a9187030066886a42ec9a917f4d88e7cbc0 (patch) | |
tree | 387d6bd0098ce265ee827567c0cbb1f6d8cd42f1 | |
parent | 2b6ad3a07e89e3c93425b1fffb78d4877299b414 (diff) |
Add a patch sent by Tim Burris <[email protected]> adding private operator=
declarations to class declarations that do not support copying (for
instance because of const members). Apparently at /W4 Visual C++ warns
unless this is the case, and it seems reasonably good practice to
disable copying on most of these objects anyway due to pointer and
reference aliasing.
Instead of adding an operator= to User_Interface, I made the member
preset_passphrase non-const. This seemed like a cleaner solution to me.
(It may also be the cleaner solution in the pubkey code)
-rw-r--r-- | include/base.h | 3 | ||||
-rw-r--r-- | include/pubkey.h | 24 | ||||
-rw-r--r-- | include/ui.h | 2 |
3 files changed, 28 insertions, 1 deletions
diff --git a/include/base.h b/include/base.h index 9f63c0aad..b05feaacb 100644 --- a/include/base.h +++ b/include/base.h @@ -101,6 +101,7 @@ class BOTAN_DLL BufferedComputation BufferedComputation(u32bit); virtual ~BufferedComputation() {} private: + BufferedComputation& operator=(const BufferedComputation&); virtual void add_data(const byte[], u32bit) = 0; virtual void final_result(byte[]) = 0; }; @@ -119,6 +120,8 @@ class BOTAN_DLL HashFunction : public BufferedComputation HashFunction(u32bit, u32bit = 0); virtual ~HashFunction() {} + private: + HashFunction& operator=(const HashFunction&); }; /************************************************* diff --git a/include/pubkey.h b/include/pubkey.h index 4890fe38d..0c9abf18f 100644 --- a/include/pubkey.h +++ b/include/pubkey.h @@ -67,6 +67,9 @@ class BOTAN_DLL PK_Signer PK_Signer(const PK_Signing_Key&, const std::string&); ~PK_Signer() { delete emsa; } private: + PK_Signer(const PK_Signer&); + PK_Signer& operator=(const PK_Signer&); + const PK_Signing_Key& key; Signature_Format sig_format; EMSA* emsa; @@ -101,6 +104,9 @@ class BOTAN_DLL PK_Verifier Signature_Format sig_format; EMSA* emsa; + private: + PK_Verifier(const PK_Verifier&); + PK_Verifier& operator=(const PK_Verifier&); }; /************************************************* @@ -116,6 +122,9 @@ class BOTAN_DLL PK_Key_Agreement PK_Key_Agreement(const PK_Key_Agreement_Key&, const std::string&); private: + PK_Key_Agreement(const PK_Key_Agreement_Key&); + PK_Key_Agreement& operator=(const PK_Key_Agreement&); + const PK_Key_Agreement_Key& key; const std::string kdf_name; }; @@ -127,9 +136,14 @@ class BOTAN_DLL PK_Encryptor_MR_with_EME : public PK_Encryptor { public: u32bit maximum_input_size() const; + PK_Encryptor_MR_with_EME(const PK_Encrypting_Key&, const std::string&); ~PK_Encryptor_MR_with_EME() { delete encoder; } + 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; @@ -146,7 +160,11 @@ class BOTAN_DLL PK_Decryptor_MR_with_EME : public PK_Decryptor PK_Decryptor_MR_with_EME(const PK_Decrypting_Key&, const std::string&); ~PK_Decryptor_MR_with_EME() { delete encoder; } 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_Decrypting_Key& key; const EME* encoder; }; @@ -159,6 +177,9 @@ class BOTAN_DLL PK_Verifier_with_MR : public PK_Verifier public: PK_Verifier_with_MR(const PK_Verifying_with_MR_Key&, const std::string&); private: + PK_Verifier_with_MR(const PK_Verifying_with_MR_Key&); + PK_Verifier_with_MR& operator=(const PK_Verifier_with_MR&); + bool validate_signature(const MemoryRegion<byte>&, const byte[], u32bit); u32bit key_message_parts() const { return key.message_parts(); } u32bit key_message_part_size() const { return key.message_part_size(); } @@ -174,6 +195,9 @@ class BOTAN_DLL PK_Verifier_wo_MR : public PK_Verifier public: PK_Verifier_wo_MR(const PK_Verifying_wo_MR_Key&, const std::string&); private: + PK_Verifier_wo_MR(const PK_Verifying_wo_MR_Key&); + PK_Verifier_wo_MR& operator=(const PK_Verifier_wo_MR&); + bool validate_signature(const MemoryRegion<byte>&, const byte[], u32bit); u32bit key_message_parts() const { return key.message_parts(); } u32bit key_message_part_size() const { return key.message_part_size(); } diff --git a/include/ui.h b/include/ui.h index 57a96780a..f66ac3e56 100644 --- a/include/ui.h +++ b/include/ui.h @@ -25,7 +25,7 @@ class BOTAN_DLL User_Interface User_Interface(const std::string& = ""); virtual ~User_Interface() {} protected: - const std::string preset_passphrase; + std::string preset_passphrase; mutable bool first_try; }; |