diff options
author | lloyd <[email protected]> | 2012-01-19 15:03:07 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-01-19 15:03:07 +0000 |
commit | 30104a60568b392886c1d717a7ca006378552e4d (patch) | |
tree | 2ad36cb3d8ced600d15a85f38ae2f7d9e7a32698 /src/tls/tls_handshake_state.h | |
parent | b899ee14925310574da400c2af0f491f8cd2a103 (diff) |
I'm not sure if I like this asthetically, but passing around the
entire handshake state in many cases makes things simpler to update,
in that each message type already knows what it needs depending on the
version, params, etc, and this way a) that knowledge doesn't need to
percolate up the the actual client and server handshake code and b)
each message type can be updated for new formats/version without
having to change its callers. Downside is it hides the dependency
information away, and makes it non-obvious what needs to be created
beforehand for each message to work correctly. However this is
(almost) entirely predicated on the handshake message flows, and these
we control with the next expected message scheme, so this should be
fairly safe to do.
This checkin only updates the ones where it was immediately relevant
but for consistency probably all of them should be updated in the same
way.
Diffstat (limited to 'src/tls/tls_handshake_state.h')
-rw-r--r-- | src/tls/tls_handshake_state.h | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/tls/tls_handshake_state.h b/src/tls/tls_handshake_state.h index 7ca2dae94..e58a83f3e 100644 --- a/src/tls/tls_handshake_state.h +++ b/src/tls/tls_handshake_state.h @@ -8,9 +8,13 @@ #ifndef BOTAN_TLS_HANDSHAKE_STATE_H__ #define BOTAN_TLS_HANDSHAKE_STATE_H__ -#include <botan/internal/tls_messages.h> +#include <botan/internal/tls_handshake_hash.h> #include <botan/internal/tls_session_key.h> #include <botan/secqueue.h> +#include <botan/pk_keys.h> +#include <botan/pubkey.h> + +#include <utility> #if defined(BOTAN_USE_STD_TR1) @@ -31,40 +35,43 @@ namespace Botan { /** * SSL/TLS Handshake State */ -class Handshake_State +class TLS_Handshake_State { public: - Handshake_State(); - ~Handshake_State(); + TLS_Handshake_State(); + ~TLS_Handshake_State(); bool received_handshake_msg(Handshake_Type handshake_msg) const; void confirm_transition_to(Handshake_Type handshake_msg); void set_expected_next(Handshake_Type handshake_msg); + std::pair<std::string, Signature_Format> + choose_sig_format(const Public_Key* key, bool for_client_auth); + Version_Code version; - Client_Hello* client_hello; - Server_Hello* server_hello; - Certificate* server_certs; - Server_Key_Exchange* server_kex; - Certificate_Req* cert_req; - Server_Hello_Done* server_hello_done; + 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; - Certificate* client_certs; - Client_Key_Exchange* client_kex; - Certificate_Verify* client_verify; + class Certificate* client_certs; + class Client_Key_Exchange* client_kex; + class Certificate_Verify* client_verify; - Next_Protocol* next_protocol; + class Next_Protocol* next_protocol; - Finished* client_finished; - Finished* server_finished; + class Finished* client_finished; + class Finished* server_finished; Public_Key* kex_pub; Private_Key* kex_priv; TLS_Cipher_Suite suite; - SessionKeys keys; + Session_Keys keys; TLS_Handshake_Hash hash; SecureQueue queue; |