diff options
Diffstat (limited to 'src/tls')
-rw-r--r-- | src/tls/tls_client.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/tls/tls_client.cpp b/src/tls/tls_client.cpp index 46e5296e2..e72dcbc8f 100644 --- a/src/tls/tls_client.cpp +++ b/src/tls/tls_client.cpp @@ -71,6 +71,8 @@ void Client::initiate_handshake(bool force_full_renegotiation, if(!m_writer.record_version_set()) m_writer.set_version(m_state->handshake_io().initial_record_version()); + if(m_state->version().is_datagram_protocol()) + m_state->set_expected_next(HELLO_VERIFY_REQUEST); m_state->set_expected_next(SERVER_HELLO); m_state->client_npn_cb = next_protocol; @@ -157,10 +159,26 @@ void Client::process_handshake_msg(Handshake_Type type, m_state->confirm_transition_to(type); - if(type != HANDSHAKE_CCS && type != FINISHED) + if(type != HANDSHAKE_CCS && type != FINISHED && type != HELLO_VERIFY_REQUEST) m_state->hash.update(m_state->handshake_io().format(contents, type)); - if(type == SERVER_HELLO) + if(type == HELLO_VERIFY_REQUEST) + { + m_state->set_expected_next(SERVER_HELLO); + m_state->set_expected_next(HELLO_VERIFY_REQUEST); // might get it again + + Hello_Verify_Request hello_verify_request(contents); + + std::unique_ptr<Client_Hello> client_hello_w_cookie( + new Client_Hello(m_state->handshake_io(), + m_state->hash, + *m_state->client_hello, + hello_verify_request)); + + delete m_state->client_hello; + m_state->client_hello = client_hello_w_cookie.release(); + } + else if(type == SERVER_HELLO) { m_state->server_hello = new Server_Hello(contents); |