diff options
author | Tomasz Frydrych <[email protected]> | 2017-04-02 22:24:31 +0200 |
---|---|---|
committer | Tomasz Frydrych <[email protected]> | 2017-04-03 23:42:29 +0200 |
commit | fbef72e11c483fae16c32480cf84253a56d0ee25 (patch) | |
tree | 200b0fe290e9809ef6c8883e886b7c9a48c902a1 /src/lib/tls | |
parent | 753b4c2d5301574d3c9390b79aa275a49809e6c8 (diff) |
Content:
* fixes for deprecated constructions in c++11 and later (explicit rule of 3/5 or implicit rule of 0 and other violations)
* `default` specifier instead of `{}` in some places(probably all)
* removal of unreachable code (for example `return` after `throw`)
* removal of compilation unit only visible, but not used functions
* fix for `throw()` specifier - used instead `BOTAN_NOEXCEPT`
* removed not needed semicolons
Diffstat (limited to 'src/lib/tls')
-rw-r--r-- | src/lib/tls/credentials_manager.h | 2 | ||||
-rw-r--r-- | src/lib/tls/msg_server_kex.cpp | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_blocking.h | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_callbacks.cpp | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_callbacks.h | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_ciphersuite.h | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_extensions.h | 16 | ||||
-rw-r--r-- | src/lib/tls/tls_handshake_io.h | 10 | ||||
-rw-r--r-- | src/lib/tls/tls_handshake_state.cpp | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_handshake_state.h | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_messages.h | 30 | ||||
-rw-r--r-- | src/lib/tls/tls_policy.h | 30 | ||||
-rw-r--r-- | src/lib/tls/tls_record.h | 24 | ||||
-rw-r--r-- | src/lib/tls/tls_session_key.h | 2 |
14 files changed, 60 insertions, 68 deletions
diff --git a/src/lib/tls/credentials_manager.h b/src/lib/tls/credentials_manager.h index e39c81c36..bdcdf9ddd 100644 --- a/src/lib/tls/credentials_manager.h +++ b/src/lib/tls/credentials_manager.h @@ -28,7 +28,7 @@ class BigInt; class BOTAN_DLL Credentials_Manager { public: - virtual ~Credentials_Manager() {} + virtual ~Credentials_Manager() = default; /** * Return a list of the certificates of CAs that we trust in this diff --git a/src/lib/tls/msg_server_kex.cpp b/src/lib/tls/msg_server_kex.cpp index 2ffa39a79..17f5cad4f 100644 --- a/src/lib/tls/msg_server_kex.cpp +++ b/src/lib/tls/msg_server_kex.cpp @@ -245,8 +245,6 @@ Server_Key_Exchange::Server_Key_Exchange(const std::vector<uint8_t>& buf, reader.assert_done(); } -Server_Key_Exchange::~Server_Key_Exchange() {} - /** * Serialize a Server Key Exchange message */ diff --git a/src/lib/tls/tls_blocking.h b/src/lib/tls/tls_blocking.h index 96928f425..d73d723d2 100644 --- a/src/lib/tls/tls_blocking.h +++ b/src/lib/tls/tls_blocking.h @@ -73,7 +73,7 @@ class BOTAN_DLL Blocking_Client std::vector<X509_Certificate> peer_cert_chain() const { return m_channel.peer_cert_chain(); } - virtual ~Blocking_Client() {} + virtual ~Blocking_Client() = default; protected: /** diff --git a/src/lib/tls/tls_callbacks.cpp b/src/lib/tls/tls_callbacks.cpp index f25f392b3..45d0518eb 100644 --- a/src/lib/tls/tls_callbacks.cpp +++ b/src/lib/tls/tls_callbacks.cpp @@ -13,8 +13,6 @@ namespace Botan { -TLS::Callbacks::~Callbacks() {} - void TLS::Callbacks::tls_inspect_handshake_msg(const Handshake_Message&) { // default is no op diff --git a/src/lib/tls/tls_callbacks.h b/src/lib/tls/tls_callbacks.h index a0b8894ad..b20e60218 100644 --- a/src/lib/tls/tls_callbacks.h +++ b/src/lib/tls/tls_callbacks.h @@ -35,7 +35,7 @@ class Policy; class BOTAN_DLL Callbacks { public: - virtual ~Callbacks(); + virtual ~Callbacks() = default; /** * Mandatory callback: output function diff --git a/src/lib/tls/tls_ciphersuite.h b/src/lib/tls/tls_ciphersuite.h index dd8e27b6f..157b1d234 100644 --- a/src/lib/tls/tls_ciphersuite.h +++ b/src/lib/tls/tls_ciphersuite.h @@ -113,7 +113,7 @@ class BOTAN_DLL Ciphersuite bool operator<(const Ciphersuite& o) const { return ciphersuite_code() < o.ciphersuite_code(); } bool operator<(const uint16_t c) const { return ciphersuite_code() < c; } - Ciphersuite() {} + Ciphersuite() = default; private: diff --git a/src/lib/tls/tls_extensions.h b/src/lib/tls/tls_extensions.h index 38d810c76..9f5d81214 100644 --- a/src/lib/tls/tls_extensions.h +++ b/src/lib/tls/tls_extensions.h @@ -65,7 +65,7 @@ class Extension */ virtual bool empty() const = 0; - virtual ~Extension() {} + virtual ~Extension() = default; }; /** @@ -133,7 +133,7 @@ class Renegotiation_Extension final : public Extension Handshake_Extension_Type type() const override { return static_type(); } - Renegotiation_Extension() {} + Renegotiation_Extension() = default; explicit Renegotiation_Extension(const std::vector<uint8_t>& bits) : m_reneg_data(bits) {} @@ -206,7 +206,7 @@ class Session_Ticket final : public Extension /** * Create empty extension, used by both client and server */ - Session_Ticket() {} + Session_Ticket() = default; /** * Extension with ticket, used by client @@ -369,7 +369,7 @@ class Extended_Master_Secret final : public Extension bool empty() const override { return false; } - Extended_Master_Secret() {} + Extended_Master_Secret() = default; Extended_Master_Secret(TLS_Data_Reader& reader, uint16_t extension_size); }; @@ -389,7 +389,7 @@ class Encrypt_then_MAC final : public Extension bool empty() const override { return false; } - Encrypt_then_MAC() {} + Encrypt_then_MAC() = default; Encrypt_then_MAC(TLS_Data_Reader& reader, uint16_t extension_size); }; @@ -459,13 +459,13 @@ class BOTAN_DLL Extensions void deserialize(TLS_Data_Reader& reader); - Extensions() {} + Extensions() = default; explicit Extensions(TLS_Data_Reader& reader) { deserialize(reader); } private: - Extensions(const Extensions&) {} - Extensions& operator=(const Extensions&) { return (*this); } + Extensions(const Extensions&) = delete; + Extensions& operator=(const Extensions&) = delete; std::map<Handshake_Extension_Type, std::unique_ptr<Extension>> m_extensions; }; diff --git a/src/lib/tls/tls_handshake_io.h b/src/lib/tls/tls_handshake_io.h index a9453abcc..c71de532b 100644 --- a/src/lib/tls/tls_handshake_io.h +++ b/src/lib/tls/tls_handshake_io.h @@ -50,13 +50,13 @@ class Handshake_IO virtual std::pair<Handshake_Type, std::vector<uint8_t>> get_next_record(bool expecting_ccs) = 0; - Handshake_IO() {} + Handshake_IO() = default; Handshake_IO(const Handshake_IO&) = delete; Handshake_IO& operator=(const Handshake_IO&) = delete; - virtual ~Handshake_IO() {} + virtual ~Handshake_IO() = default; }; /** @@ -146,7 +146,7 @@ class Datagram_Handshake_IO final : public Handshake_IO Handshake_Type msg_type, const std::vector<uint8_t>& msg); - class Handshake_Reassembly + class Handshake_Reassembly final { public: void add_fragment(const uint8_t fragment[], @@ -172,13 +172,11 @@ class Datagram_Handshake_IO final : public Handshake_IO std::vector<uint8_t> m_message; }; - struct Message_Info + struct Message_Info final { Message_Info(uint16_t e, Handshake_Type mt, const std::vector<uint8_t>& msg) : epoch(e), msg_type(mt), msg_bits(msg) {} - Message_Info(const Message_Info& other) = default; - Message_Info() : epoch(0xFFFF), msg_type(HANDSHAKE_NONE) {} uint16_t epoch; diff --git a/src/lib/tls/tls_handshake_state.cpp b/src/lib/tls/tls_handshake_state.cpp index 6d46c18ab..d87af7305 100644 --- a/src/lib/tls/tls_handshake_state.cpp +++ b/src/lib/tls/tls_handshake_state.cpp @@ -182,8 +182,6 @@ Handshake_State::Handshake_State(Handshake_IO* io, Callbacks& cb) : { } -Handshake_State::~Handshake_State() {} - void Handshake_State::note_message(const Handshake_Message& msg) { m_callbacks.tls_inspect_handshake_msg(msg); diff --git a/src/lib/tls/tls_handshake_state.h b/src/lib/tls/tls_handshake_state.h index 889f0d101..5851a8fe8 100644 --- a/src/lib/tls/tls_handshake_state.h +++ b/src/lib/tls/tls_handshake_state.h @@ -49,7 +49,7 @@ class Handshake_State public: Handshake_State(Handshake_IO* io, Callbacks& callbacks); - virtual ~Handshake_State(); + virtual ~Handshake_State() = default; Handshake_State(const Handshake_State&) = delete; Handshake_State& operator=(const Handshake_State&) = delete; diff --git a/src/lib/tls/tls_messages.h b/src/lib/tls/tls_messages.h index 5a1f03a06..aaf372447 100644 --- a/src/lib/tls/tls_messages.h +++ b/src/lib/tls/tls_messages.h @@ -20,17 +20,17 @@ #include <string> #include <set> -namespace Botan { - -class Credentials_Manager; +#if defined(BOTAN_HAS_CECPQ1) + #include <botan/cecpq1.h> +#endif #if defined(BOTAN_HAS_SRP6) -class SRP6_Server_Session; + #include <botan/srp6.h> #endif -#if defined(BOTAN_HAS_CECPQ1) -class CECPQ1_key; -#endif +namespace Botan { + +class Credentials_Manager; namespace TLS { @@ -75,10 +75,10 @@ class BOTAN_DLL Client_Hello final : public Handshake_Message const std::string& srp_identifier = "") : m_new_session_version(version), m_hostname(hostname), - m_srp_identifier(srp_identifier) {}; + m_srp_identifier(srp_identifier) {} - const Protocol_Version protocol_version() const { return m_new_session_version; }; - const std::string& hostname() const { return m_hostname; }; + const Protocol_Version protocol_version() const { return m_new_session_version; } + const std::string& hostname() const { return m_hostname; } const std::string& srp_identifier() const { return m_srp_identifier; } private: @@ -267,11 +267,11 @@ class BOTAN_DLL Server_Hello final : public Handshake_Message m_new_session_version(new_session_version), m_ciphersuite(ciphersuite), m_compression(compression), - m_offer_session_ticket(offer_session_ticket) {}; + m_offer_session_ticket(offer_session_ticket) {} - const std::vector<uint8_t>& session_id() const { return m_new_session_id; }; - Protocol_Version protocol_version() const { return m_new_session_version; }; - uint16_t ciphersuite() const { return m_ciphersuite; }; + const std::vector<uint8_t>& session_id() const { return m_new_session_id; } + Protocol_Version protocol_version() const { return m_new_session_version; } + uint16_t ciphersuite() const { return m_ciphersuite; } uint8_t compression() const { return m_compression; } bool offer_session_ticket() const { return m_offer_session_ticket; } @@ -622,7 +622,7 @@ class BOTAN_DLL Server_Key_Exchange final : public Handshake_Message const std::string& sig_alg, Protocol_Version version); - ~Server_Key_Exchange(); + ~Server_Key_Exchange() = default; private: std::vector<uint8_t> serialize() const override; diff --git a/src/lib/tls/tls_policy.h b/src/lib/tls/tls_policy.h index 6f617c673..ad95b7eb5 100644 --- a/src/lib/tls/tls_policy.h +++ b/src/lib/tls/tls_policy.h @@ -122,27 +122,27 @@ class BOTAN_DLL Policy * Allow servers to initiate a new handshake */ virtual bool allow_server_initiated_renegotiation() const; - + /** * Allow TLS v1.0 */ virtual bool allow_tls10() const; - + /** * Allow TLS v1.1 */ virtual bool allow_tls11() const; - + /** * Allow TLS v1.2 */ virtual bool allow_tls12() const; - + /** * Allow DTLS v1.0 */ virtual bool allow_dtls10() const; - + /** * Allow DTLS v1.2 */ @@ -155,14 +155,14 @@ class BOTAN_DLL Policy * Default is currently 1024 (insecure), should be 2048 */ virtual size_t minimum_dh_group_size() const; - + /** * For ECDSA authenticated ciphersuites, the smallest key size the * client will accept. * This policy is currently only enforced on the server by the client. */ virtual size_t minimum_ecdsa_group_size() const; - + /** * Return the minimum ECDH group size we're willing to use * for key exchange @@ -199,7 +199,7 @@ class BOTAN_DLL Policy * (or logging of) the peer's keys. */ virtual void check_peer_key_acceptable(const Public_Key& public_key) const; - + /** * If this function returns false, unknown SRP/PSK identifiers * will be rejected with an unknown_psk_identifier alert as soon @@ -297,7 +297,7 @@ class BOTAN_DLL Policy */ std::string to_string() const; - virtual ~Policy() {} + virtual ~Policy() = default; }; /** @@ -396,7 +396,7 @@ class BOTAN_DLL Datagram_Policy : public Policy public: std::vector<std::string> allowed_macs() const override { return std::vector<std::string>({"AEAD"}); } - + bool allow_tls10() const override { return false; } bool allow_tls11() const override { return false; } bool allow_tls12() const override { return false; } @@ -450,22 +450,22 @@ class BOTAN_DLL Text_Policy : public Policy std::vector<std::string> allowed_ecc_curves() const override { return get_list("ecc_curves", Policy::allowed_ecc_curves()); } - + bool use_ecc_point_compression() const override { return get_bool("use_ecc_point_compression", Policy::use_ecc_point_compression()); } bool allow_tls10() const override { return get_bool("allow_tls10", Policy::allow_tls10()); } - + bool allow_tls11() const override { return get_bool("allow_tls11", Policy::allow_tls11()); } - + bool allow_tls12() const override { return get_bool("allow_tls12", Policy::allow_tls12()); } - + bool allow_dtls10() const override { return get_bool("allow_dtls10", Policy::allow_dtls10()); } - + bool allow_dtls12() const override { return get_bool("allow_dtls12", Policy::allow_dtls12()); } diff --git a/src/lib/tls/tls_record.h b/src/lib/tls/tls_record.h index ebb83c484..782257b41 100644 --- a/src/lib/tls/tls_record.h +++ b/src/lib/tls/tls_record.h @@ -80,7 +80,7 @@ class Record Protocol_Version* protocol_version, Record_Type* type) : m_data(data), m_sequence(sequence), m_protocol_version(protocol_version), - m_type(type), m_size(data.size()) {}; + m_type(type), m_size(data.size()) {} secure_vector<uint8_t>& get_data() { return m_data; } @@ -104,15 +104,15 @@ class Record_Message { public: Record_Message(const uint8_t* data, size_t size) - : m_type(0), m_sequence(0), m_data(data), m_size(size) {}; + : m_type(0), m_sequence(0), m_data(data), m_size(size) {} Record_Message(uint8_t type, uint64_t sequence, const uint8_t* data, size_t size) : m_type(type), m_sequence(sequence), m_data(data), - m_size(size) {}; + m_size(size) {} - uint8_t& get_type() { return m_type; }; - uint64_t& get_sequence() { return m_sequence; }; - const uint8_t* get_data() { return m_data; }; - size_t& get_size() { return m_size; }; + uint8_t& get_type() { return m_type; } + uint64_t& get_sequence() { return m_sequence; } + const uint8_t* get_data() { return m_data; } + size_t& get_size() { return m_size; } private: uint8_t m_type; @@ -127,16 +127,16 @@ class Record_Raw_Input Record_Raw_Input(const uint8_t* data, size_t size, size_t& consumed, bool is_datagram) : m_data(data), m_size(size), m_consumed(consumed), - m_is_datagram(is_datagram) {}; + m_is_datagram(is_datagram) {} - const uint8_t*& get_data() { return m_data; }; + const uint8_t*& get_data() { return m_data; } - size_t& get_size() { return m_size; }; + size_t& get_size() { return m_size; } - size_t& get_consumed() { return m_consumed; }; + size_t& get_consumed() { return m_consumed; } void set_consumed(size_t consumed) { m_consumed = consumed; } - bool is_datagram() { return m_is_datagram; }; + bool is_datagram() { return m_is_datagram; } private: const uint8_t* m_data; diff --git a/src/lib/tls/tls_session_key.h b/src/lib/tls/tls_session_key.h index c2c082d4a..97ad3106d 100644 --- a/src/lib/tls/tls_session_key.h +++ b/src/lib/tls/tls_session_key.h @@ -57,7 +57,7 @@ class Session_Keys */ const secure_vector<uint8_t>& master_secret() const { return m_master_sec; } - Session_Keys() {} + Session_Keys() = default; /** * @param state state the handshake state |