diff options
-rw-r--r-- | src/tls/tls_channel.cpp | 11 | ||||
-rw-r--r-- | src/tls/tls_channel.h | 5 | ||||
-rw-r--r-- | src/tls/tls_client.cpp | 3 | ||||
-rw-r--r-- | src/tls/tls_server.cpp | 7 |
4 files changed, 18 insertions, 8 deletions
diff --git a/src/tls/tls_channel.cpp b/src/tls/tls_channel.cpp index 53cb65915..87b58f242 100644 --- a/src/tls/tls_channel.cpp +++ b/src/tls/tls_channel.cpp @@ -147,7 +147,7 @@ size_t Channel::received_data(const byte buf[], size_t buf_size) Heartbeat_Message response(Heartbeat_Message::RESPONSE, &payload[0], payload.size()); - m_writer.send(HEARTBEAT, response.contents()); + send_record(HEARTBEAT, response.contents()); } } else @@ -249,10 +249,15 @@ void Channel::heartbeat(const byte payload[], size_t payload_size) Heartbeat_Message heartbeat(Heartbeat_Message::REQUEST, payload, payload_size); - m_writer.send(HEARTBEAT, heartbeat.contents()); + send_record(HEARTBEAT, heartbeat.contents()); } } +void Channel::send_record(byte record_type, const std::vector<byte>& record) + { + m_writer.send(record_type, record); + } + void Channel::send(const byte buf[], size_t buf_size) { if(!is_active()) @@ -272,7 +277,7 @@ void Channel::send_alert(const Alert& alert) { try { - m_writer.send(ALERT, alert.serialize()); + send_record(ALERT, alert.serialize()); } catch(...) { /* swallow it */ } } diff --git a/src/tls/tls_channel.h b/src/tls/tls_channel.h index 8313741ad..e0b19758a 100644 --- a/src/tls/tls_channel.h +++ b/src/tls/tls_channel.h @@ -123,6 +123,8 @@ class BOTAN_DLL Channel void change_cipher_spec_writer(Connection_Side side); + void send_record(byte record_type, const std::vector<byte>& record); + class Secure_Renegotiation_State { public: @@ -165,8 +167,7 @@ class BOTAN_DLL Channel Record_Writer m_writer; private: Record_Reader m_reader; - public: - + protected: std::vector<X509_Certificate> m_peer_certs; Secure_Renegotiation_State m_secure_renegotiation; diff --git a/src/tls/tls_client.cpp b/src/tls/tls_client.cpp index de39d7f22..0976555d9 100644 --- a/src/tls/tls_client.cpp +++ b/src/tls/tls_client.cpp @@ -67,7 +67,8 @@ Handshake_State* Client::new_handshake_state() return new Client_Handshake_State( new Stream_Handshake_IO( - std::bind(&Record_Writer::send, std::ref(m_writer), _1, _2) + [this](byte type, const std::vector<byte>& rec) + { this->send_record(type, rec); } ) ); } diff --git a/src/tls/tls_server.cpp b/src/tls/tls_server.cpp index 3c2abf6a0..21ea568e4 100644 --- a/src/tls/tls_server.cpp +++ b/src/tls/tls_server.cpp @@ -226,8 +226,11 @@ Handshake_State* Server::new_handshake_state() using namespace std::placeholders; Handshake_State* state = new Server_Handshake_State( - new Stream_Handshake_IO(std::bind(&Record_Writer::send, - std::ref(m_writer), _1, _2))); + new Stream_Handshake_IO( + [this](byte type, const std::vector<byte>& rec) + { this->send_record(type, rec); } + ) + ); state->set_expected_next(CLIENT_HELLO); return state; |