From 52de604c02536ef2724aa99632bf50efa9d09294 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 10 Aug 2012 12:38:00 +0000 Subject: Make the CCS message a Handshake_Msg and send it through the handshake IO layer. Needed for DTLS which needs to be able to track and retransmit the CCS if needed. --- src/tls/tls_handshake_io.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/tls/tls_handshake_io.cpp') diff --git a/src/tls/tls_handshake_io.cpp b/src/tls/tls_handshake_io.cpp index aa644571d..6ff8f71e0 100644 --- a/src/tls/tls_handshake_io.cpp +++ b/src/tls/tls_handshake_io.cpp @@ -102,10 +102,16 @@ Stream_Handshake_IO::format(const std::vector& msg, std::vector Stream_Handshake_IO::send(const Handshake_Message& msg) { - const std::vector buf = format(msg.serialize(), msg.type()); + const std::vector msg_bits = msg.serialize(); - m_writer.send(HANDSHAKE, &buf[0], buf.size()); + if(msg.type() == HANDSHAKE_CCS) + { + m_writer.send(CHANGE_CIPHER_SPEC, msg_bits); + return std::vector(); // not included in handshake hashes + } + const std::vector buf = format(msg_bits, msg.type()); + m_writer.send(HANDSHAKE, buf); return buf; } @@ -282,15 +288,21 @@ Datagram_Handshake_IO::format(const std::vector& msg, } std::vector -Datagram_Handshake_IO::send(const Handshake_Message& handshake_msg) +Datagram_Handshake_IO::send(const Handshake_Message& msg) { - const std::vector msg = handshake_msg.serialize(); + const std::vector msg_bits = msg.serialize(); + + if(msg.type() == HANDSHAKE_CCS) + { + m_writer.send(CHANGE_CIPHER_SPEC, msg_bits); + return std::vector(); // not included in handshake hashes + } const std::vector no_fragment = - format_w_seq(msg, handshake_msg.type(), m_out_message_seq); + format_w_seq(msg_bits, msg.type(), m_out_message_seq); // FIXME: fragment to mtu size if needed - m_writer.send(HANDSHAKE, &no_fragment[0], no_fragment.size()); + m_writer.send(HANDSHAKE, no_fragment); m_out_message_seq += 1; -- cgit v1.2.3