diff options
Diffstat (limited to 'src/lib/tls')
-rw-r--r-- | src/lib/tls/msg_finished.cpp | 9 | ||||
-rw-r--r-- | src/lib/tls/msg_server_hello.cpp | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_blocking.cpp | 4 | ||||
-rw-r--r-- | src/lib/tls/tls_blocking.h | 4 | ||||
-rw-r--r-- | src/lib/tls/tls_client.cpp | 4 | ||||
-rw-r--r-- | src/lib/tls/tls_client.h | 4 | ||||
-rw-r--r-- | src/lib/tls/tls_extensions.cpp | 18 | ||||
-rw-r--r-- | src/lib/tls/tls_messages.h | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_policy.h | 6 |
9 files changed, 20 insertions, 33 deletions
diff --git a/src/lib/tls/msg_finished.cpp b/src/lib/tls/msg_finished.cpp index b837172b6..2d6b11995 100644 --- a/src/lib/tls/msg_finished.cpp +++ b/src/lib/tls/msg_finished.cpp @@ -48,9 +48,8 @@ std::vector<byte> finished_compute_verify(const Handshake_State& state, */ Finished::Finished(Handshake_IO& io, Handshake_State& state, - Connection_Side side) + Connection_Side side) : m_verification_data(finished_compute_verify( state, side )) { - m_verification_data = finished_compute_verify(state, side); state.hash().update(io.send(*this)); } @@ -65,10 +64,8 @@ std::vector<byte> Finished::serialize() const /* * Deserialize a Finished message */ -Finished::Finished(const std::vector<byte>& buf) - { - m_verification_data = buf; - } +Finished::Finished(const std::vector<byte>& buf) : m_verification_data(buf) + {} /* * Verify a Finished message diff --git a/src/lib/tls/msg_server_hello.cpp b/src/lib/tls/msg_server_hello.cpp index f9962a8ee..f8d0c63c7 100644 --- a/src/lib/tls/msg_server_hello.cpp +++ b/src/lib/tls/msg_server_hello.cpp @@ -28,7 +28,7 @@ Server_Hello::Server_Hello(Handshake_IO& io, u16bit ciphersuite, byte compression, bool offer_session_ticket, - const std::string next_protocol) : + const std::string& next_protocol) : m_version(new_session_version), m_session_id(new_session_id), m_random(make_hello_random(rng, policy)), diff --git a/src/lib/tls/tls_blocking.cpp b/src/lib/tls/tls_blocking.cpp index f88b7896c..a1867b6b5 100644 --- a/src/lib/tls/tls_blocking.cpp +++ b/src/lib/tls/tls_blocking.cpp @@ -20,7 +20,7 @@ Blocking_Client::Blocking_Client(read_fn reader, const Policy& policy, RandomNumberGenerator& rng, const Server_Information& server_info, - const Protocol_Version offer_version, + const Protocol_Version& offer_version, const std::vector<std::string>& next) : m_read(reader), m_channel(writer, @@ -42,7 +42,7 @@ bool Blocking_Client::handshake_cb(const Session& session) return this->handshake_complete(session); } -void Blocking_Client::alert_cb(const Alert alert, const byte[], size_t) +void Blocking_Client::alert_cb(const Alert& alert, const byte[], size_t) { this->alert_notification(alert); } diff --git a/src/lib/tls/tls_blocking.h b/src/lib/tls/tls_blocking.h index 89421f5f5..00e65cbaf 100644 --- a/src/lib/tls/tls_blocking.h +++ b/src/lib/tls/tls_blocking.h @@ -39,7 +39,7 @@ class BOTAN_DLL Blocking_Client const Policy& policy, RandomNumberGenerator& rng, const Server_Information& server_info = Server_Information(), - const Protocol_Version offer_version = Protocol_Version::latest_tls_version(), + const Protocol_Version& offer_version = Protocol_Version::latest_tls_version(), const std::vector<std::string>& next_protos = {}); /** @@ -89,7 +89,7 @@ class BOTAN_DLL Blocking_Client void data_cb(const byte data[], size_t data_len); - void alert_cb(const Alert alert, const byte data[], size_t data_len); + void alert_cb(const Alert& alert, const byte data[], size_t data_len); read_fn m_read; TLS::Client m_channel; diff --git a/src/lib/tls/tls_client.cpp b/src/lib/tls/tls_client.cpp index 368e4569e..3a219ccff 100644 --- a/src/lib/tls/tls_client.cpp +++ b/src/lib/tls/tls_client.cpp @@ -51,7 +51,7 @@ Client::Client(output_fn output_fn, const Policy& policy, RandomNumberGenerator& rng, const Server_Information& info, - const Protocol_Version offer_version, + const Protocol_Version& offer_version, const std::vector<std::string>& next_protos, size_t io_buf_sz) : Channel(output_fn, proc_cb, alert_cb, handshake_cb, Channel::handshake_msg_cb(), @@ -75,7 +75,7 @@ Client::Client(output_fn output_fn, const Policy& policy, RandomNumberGenerator& rng, const Server_Information& info, - const Protocol_Version offer_version, + const Protocol_Version& offer_version, const std::vector<std::string>& next_protos) : Channel(output_fn, proc_cb, alert_cb, handshake_cb, hs_msg_cb, session_manager, rng, policy, offer_version.is_datagram_protocol()), diff --git a/src/lib/tls/tls_client.h b/src/lib/tls/tls_client.h index d17ea74d0..45a741878 100644 --- a/src/lib/tls/tls_client.h +++ b/src/lib/tls/tls_client.h @@ -62,7 +62,7 @@ class BOTAN_DLL Client final : public Channel const Policy& policy, RandomNumberGenerator& rng, const Server_Information& server_info = Server_Information(), - const Protocol_Version offer_version = Protocol_Version::latest_tls_version(), + const Protocol_Version& offer_version = Protocol_Version::latest_tls_version(), const std::vector<std::string>& next_protocols = {}, size_t reserved_io_buffer_size = 16*1024 ); @@ -77,7 +77,7 @@ class BOTAN_DLL Client final : public Channel const Policy& policy, RandomNumberGenerator& rng, const Server_Information& server_info = Server_Information(), - const Protocol_Version offer_version = Protocol_Version::latest_tls_version(), + const Protocol_Version& offer_version = Protocol_Version::latest_tls_version(), const std::vector<std::string>& next_protocols = {} ); diff --git a/src/lib/tls/tls_extensions.cpp b/src/lib/tls/tls_extensions.cpp index 35c39ddab..4acf9a6fe 100644 --- a/src/lib/tls/tls_extensions.cpp +++ b/src/lib/tls/tls_extensions.cpp @@ -180,10 +180,8 @@ std::vector<byte> Server_Name_Indicator::serialize() const #if defined(BOTAN_HAS_SRP6) SRP_Identifier::SRP_Identifier(TLS_Data_Reader& reader, - u16bit extension_size) + u16bit extension_size) : m_srp_identifier(reader.get_string(1, 1, 255)) { - m_srp_identifier = reader.get_string(1, 1, 255); - if(m_srp_identifier.size() + 1 != extension_size) throw Decoding_Error("Bad encoding for SRP identifier extension"); } @@ -203,10 +201,8 @@ std::vector<byte> SRP_Identifier::serialize() const #endif Renegotiation_Extension::Renegotiation_Extension(TLS_Data_Reader& reader, - u16bit extension_size) + u16bit extension_size) : m_reneg_data(reader.get_range<byte>(1, 0, 255)) { - m_reneg_data = reader.get_range<byte>(1, 0, 255); - if(m_reneg_data.size() + 1 != extension_size) throw Decoding_Error("Bad encoding for secure renegotiation extn"); } @@ -516,16 +512,12 @@ Signature_Algorithms::Signature_Algorithms(TLS_Data_Reader& reader, } Session_Ticket::Session_Ticket(TLS_Data_Reader& reader, - u16bit extension_size) - { - m_ticket = reader.get_elem<byte, std::vector<byte> >(extension_size); - } + u16bit extension_size) : m_ticket(reader.get_elem<byte, std::vector<byte>>(extension_size)) + {} SRTP_Protection_Profiles::SRTP_Protection_Profiles(TLS_Data_Reader& reader, - u16bit extension_size) + u16bit extension_size) : m_pp(reader.get_range<u16bit>(2, 0, 65535)) { - m_pp = reader.get_range<u16bit>(2, 0, 65535); - const std::vector<byte> mki = reader.get_range<byte>(1, 0, 255); if(m_pp.size() * 2 + mki.size() + 3 != extension_size) diff --git a/src/lib/tls/tls_messages.h b/src/lib/tls/tls_messages.h index 281333f88..00033826f 100644 --- a/src/lib/tls/tls_messages.h +++ b/src/lib/tls/tls_messages.h @@ -267,7 +267,7 @@ class Server_Hello final : public Handshake_Message u16bit ciphersuite, byte compression, bool offer_session_ticket, - const std::string next_protocol); + const std::string& next_protocol); Server_Hello(Handshake_IO& io, Handshake_Hash& hash, diff --git a/src/lib/tls/tls_policy.h b/src/lib/tls/tls_policy.h index 032de81ad..6e4b442c8 100644 --- a/src/lib/tls/tls_policy.h +++ b/src/lib/tls/tls_policy.h @@ -306,10 +306,8 @@ class BOTAN_DLL Text_Policy : public Policy m_kv = read_cfg(iss); } - explicit Text_Policy(std::istream& in) - { - m_kv = read_cfg(in); - } + explicit Text_Policy(std::istream& in) : m_kv(read_cfg(in)) + {} private: |