diff options
Diffstat (limited to 'src/tls/tls_handshake_state.h')
-rw-r--r-- | src/tls/tls_handshake_state.h | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/src/tls/tls_handshake_state.h b/src/tls/tls_handshake_state.h index 521da0205..0f48c976b 100644 --- a/src/tls/tls_handshake_state.h +++ b/src/tls/tls_handshake_state.h @@ -10,6 +10,7 @@ #include <botan/internal/tls_handshake_hash.h> #include <botan/internal/tls_handshake_reader.h> +#include <botan/internal/tls_handshake_writer.h> #include <botan/internal/tls_session_key.h> #include <botan/pk_keys.h> #include <botan/pubkey.h> @@ -31,7 +32,9 @@ class Policy; class Handshake_State { public: - Handshake_State(Handshake_Reader* reader); + Handshake_State(Handshake_Reader* reader, + Handshake_Writer* writer); + ~Handshake_State(); Handshake_State(const Handshake_State&) = delete; @@ -65,25 +68,25 @@ class Handshake_State void set_version(const Protocol_Version& version); - class Client_Hello* client_hello; - class Server_Hello* server_hello; - class Certificate* server_certs; - class Server_Key_Exchange* server_kex; - class Certificate_Req* cert_req; - class Server_Hello_Done* server_hello_done; + class Client_Hello* client_hello = nullptr; + class Server_Hello* server_hello = nullptr; + class Certificate* server_certs = nullptr; + class Server_Key_Exchange* server_kex = nullptr; + class Certificate_Req* cert_req = nullptr; + class Server_Hello_Done* server_hello_done = nullptr; - class Certificate* client_certs; - class Client_Key_Exchange* client_kex; - class Certificate_Verify* client_verify; + class Certificate* client_certs = nullptr; + class Client_Key_Exchange* client_kex = nullptr; + class Certificate_Verify* client_verify = nullptr; - class Next_Protocol* next_protocol; - class New_Session_Ticket* new_session_ticket; + class Next_Protocol* next_protocol = nullptr; + class New_Session_Ticket* new_session_ticket = nullptr; - class Finished* client_finished; - class Finished* server_finished; + class Finished* client_finished = nullptr; + class Finished* server_finished = nullptr; // Used by the server only, in case of RSA key exchange - Private_Key* server_rsa_kex_key; + Private_Key* server_rsa_kex_key = nullptr; Ciphersuite suite; Session_Keys keys; @@ -95,19 +98,25 @@ class Handshake_State secure_vector<byte> resume_master_secret; /* - * + * Used by the server to know if resumption should be allowed on + * a server-initiated renegotiation */ - bool allow_session_resumption; + bool allow_session_resumption = true; /** * Used by client using NPN */ std::function<std::string (std::vector<std::string>)> client_npn_cb; - Handshake_Reader* handshake_reader() { return m_handshake_reader; } + Handshake_Reader& handshake_reader() { return *m_handshake_reader; } + + Handshake_Writer& handshake_writer() { return *m_handshake_writer; } private: - Handshake_Reader* m_handshake_reader; - u32bit hand_expecting_mask, hand_received_mask; + Handshake_Reader* m_handshake_reader = nullptr; + Handshake_Writer* m_handshake_writer = nullptr; + + u32bit m_hand_expecting_mask = 0; + u32bit m_hand_received_mask = 0; Protocol_Version m_version; }; |