diff options
author | lloyd <[email protected]> | 2012-08-03 16:27:43 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-08-03 16:27:43 +0000 |
commit | 419935515357bc1b7b39825ed3a0def12362746d (patch) | |
tree | 55703bfc52e65ccb3d873d375010e79abb1b9b3b /src | |
parent | 2d6888083bc497302e88c7eea6f930479cba0407 (diff) |
Add Handshake_Hash::reset
Add cookie support in Client_Hello.
Diffstat (limited to 'src')
-rw-r--r-- | src/tls/msg_client_hello.cpp | 16 | ||||
-rw-r--r-- | src/tls/tls_handshake_hash.h | 1 | ||||
-rw-r--r-- | src/tls/tls_messages.h | 10 |
3 files changed, 24 insertions, 3 deletions
diff --git a/src/tls/msg_client_hello.cpp b/src/tls/msg_client_hello.cpp index 2d2e03752..52536e79c 100644 --- a/src/tls/msg_client_hello.cpp +++ b/src/tls/msg_client_hello.cpp @@ -156,6 +156,18 @@ Client_Hello::Client_Hello(const std::vector<byte>& buf, Handshake_Type type) deserialize_sslv2(buf); } +Client_Hello::Client_Hello(Handshake_IO& io, + Handshake_Hash& hash, + const Client_Hello& initial_hello, + const Hello_Verify_Request& hello_verify) + { + *this = initial_hello; + m_hello_cookie = hello_verify.cookie(); + + hash.reset(); + hash.update(io.send(*this)); + } + /* * Serialize a Client Hello message */ @@ -168,6 +180,10 @@ std::vector<byte> Client_Hello::serialize() const buf += m_random; append_tls_length_value(buf, m_session_id, 1); + + if(m_version.is_datagram_protocol()) + append_tls_length_value(buf, m_hello_cookie, 1); + append_tls_length_value(buf, m_suites, 2); append_tls_length_value(buf, m_comp_methods, 1); diff --git a/src/tls/tls_handshake_hash.h b/src/tls/tls_handshake_hash.h index bf6c8ff8b..e7fc24f64 100644 --- a/src/tls/tls_handshake_hash.h +++ b/src/tls/tls_handshake_hash.h @@ -38,6 +38,7 @@ class Handshake_Hash const std::vector<byte>& get_contents() const { return data; } + void reset() { data.clear(); } private: std::vector<byte> data; }; diff --git a/src/tls/tls_messages.h b/src/tls/tls_messages.h index 0969aea06..de56a1cd2 100644 --- a/src/tls/tls_messages.h +++ b/src/tls/tls_messages.h @@ -38,9 +38,6 @@ class Handshake_Message Handshake_Message() {} virtual ~Handshake_Message() {} - private: - Handshake_Message(const Handshake_Message&) {} - Handshake_Message& operator=(const Handshake_Message&) { return (*this); } }; std::vector<byte> make_hello_random(RandomNumberGenerator& rng); @@ -130,6 +127,11 @@ class Client_Hello : public Handshake_Message const Session& resumed_session, bool next_protocol = false); + Client_Hello(Handshake_IO& io, + Handshake_Hash& hash, + const Client_Hello& initial_hello, + const Hello_Verify_Request& hello_verify); + Client_Hello(const std::vector<byte>& buf, Handshake_Type type); @@ -156,6 +158,8 @@ class Client_Hello : public Handshake_Message bool m_supports_session_ticket; std::vector<byte> m_session_ticket; + std::vector<byte> m_hello_cookie; + bool m_supports_heartbeats; bool m_peer_can_send_heartbeats; }; |