aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/tls/msg_cert_req.cpp6
-rw-r--r--src/lib/tls/msg_certificate.cpp6
-rw-r--r--src/lib/tls/msg_client_hello.cpp10
-rw-r--r--src/lib/tls/msg_server_hello.cpp10
-rw-r--r--src/lib/tls/tls_client.cpp16
-rw-r--r--src/lib/tls/tls_handshake_msg.h14
-rw-r--r--src/lib/tls/tls_messages.h19
-rw-r--r--src/lib/tls/tls_server.cpp24
8 files changed, 49 insertions, 56 deletions
diff --git a/src/lib/tls/msg_cert_req.cpp b/src/lib/tls/msg_cert_req.cpp
index 569a5aa63..4fd528148 100644
--- a/src/lib/tls/msg_cert_req.cpp
+++ b/src/lib/tls/msg_cert_req.cpp
@@ -1,7 +1,6 @@
/*
* Certificate Request Message
* (C) 2004-2006,2012 Jack Lloyd
-* 2016 Matthias Gierlings
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -52,7 +51,8 @@ byte cert_type_name_to_code(const std::string& name)
/**
* Create a new Certificate Request message
*/
-Certificate_Req::Certificate_Req(Handshake_Info& hs_info,
+Certificate_Req::Certificate_Req(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
const std::vector<X509_DN>& ca_certs,
Protocol_Version version) :
@@ -69,7 +69,7 @@ Certificate_Req::Certificate_Req(Handshake_Info& hs_info,
m_supported_algos.push_back(std::make_pair(hashes[i], sigs[j]));
}
- hs_info.get_hash().update(hs_info.get_io().send(*this));
+ hash.update(io.send(*this));
}
/**
diff --git a/src/lib/tls/msg_certificate.cpp b/src/lib/tls/msg_certificate.cpp
index a622d8573..32e3e17f0 100644
--- a/src/lib/tls/msg_certificate.cpp
+++ b/src/lib/tls/msg_certificate.cpp
@@ -1,7 +1,6 @@
/*
* Certificate Message
* (C) 2004-2006,2012 Jack Lloyd
-* 2016 Matthias Gierlings
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -21,11 +20,12 @@ namespace TLS {
/**
* Create a new Certificate message
*/
-Certificate::Certificate(Handshake_Info& hs_info,
+Certificate::Certificate(Handshake_IO& io,
+ Handshake_Hash& hash,
const std::vector<X509_Certificate>& cert_list) :
m_certs(cert_list)
{
- hs_info.get_hash().update(hs_info.get_io().send(*this));
+ hash.update(io.send(*this));
}
/**
diff --git a/src/lib/tls/msg_client_hello.cpp b/src/lib/tls/msg_client_hello.cpp
index 9c080b9a5..41a6f5c02 100644
--- a/src/lib/tls/msg_client_hello.cpp
+++ b/src/lib/tls/msg_client_hello.cpp
@@ -67,7 +67,8 @@ std::vector<byte> Hello_Request::serialize() const
/*
* Create a new Client Hello message
*/
-Client_Hello::Client_Hello(Handshake_Info& hs_info,
+Client_Hello::Client_Hello(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
RandomNumberGenerator& rng,
const std::vector<byte>& reneg_info,
@@ -110,13 +111,14 @@ Client_Hello::Client_Hello(Handshake_Info& hs_info,
if(policy.send_fallback_scsv(client_settings.protocol_version()))
m_suites.push_back(TLS_FALLBACK_SCSV);
- hs_info.get_hash().update(hs_info.get_io().send(*this));
+ hash.update(io.send(*this));
}
/*
* Create a new Client Hello message (session resumption case)
*/
-Client_Hello::Client_Hello(Handshake_Info& hs_info,
+Client_Hello::Client_Hello(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
RandomNumberGenerator& rng,
const std::vector<byte>& reneg_info,
@@ -162,7 +164,7 @@ Client_Hello::Client_Hello(Handshake_Info& hs_info,
}
#endif
- hs_info.get_hash().update(hs_info.get_io().send(*this));
+ hash.update(io.send(*this));
}
void Client_Hello::update_hello_cookie(const Hello_Verify_Request& hello_verify)
diff --git a/src/lib/tls/msg_server_hello.cpp b/src/lib/tls/msg_server_hello.cpp
index 2c80ed59a..f32625508 100644
--- a/src/lib/tls/msg_server_hello.cpp
+++ b/src/lib/tls/msg_server_hello.cpp
@@ -18,7 +18,8 @@ namespace Botan {
namespace TLS {
// New session case
-Server_Hello::Server_Hello(Handshake_Info& hs_info,
+Server_Hello::Server_Hello(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
RandomNumberGenerator& rng,
const std::vector<byte>& reneg_info,
@@ -64,11 +65,12 @@ Server_Hello::Server_Hello(Handshake_Info& hs_info,
}
}
- hs_info.get_hash().update(hs_info.get_io().send(*this));
+ hash.update(io.send(*this));
}
// Resuming
-Server_Hello::Server_Hello(Handshake_Info& hs_info,
+Server_Hello::Server_Hello(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
RandomNumberGenerator& rng,
const std::vector<byte>& reneg_info,
@@ -94,7 +96,7 @@ Server_Hello::Server_Hello(Handshake_Info& hs_info,
if(!next_protocol.empty() && client_hello.supports_alpn())
m_extensions.add(new Application_Layer_Protocol_Notification(next_protocol));
- hs_info.get_hash().update(hs_info.get_io().send(*this));
+ hash.update(io.send(*this));
}
/*
diff --git a/src/lib/tls/tls_client.cpp b/src/lib/tls/tls_client.cpp
index 1708a7f40..ab7beddbd 100644
--- a/src/lib/tls/tls_client.cpp
+++ b/src/lib/tls/tls_client.cpp
@@ -154,9 +154,9 @@ void Client::send_client_hello(Handshake_State& state_base,
{
if(srp_identifier == "" || session_info.srp_identifier() == srp_identifier)
{
- Client_Hello::Handshake_Info hs_info(state.handshake_io(), state.hash());
state.client_hello(new Client_Hello(
- hs_info,
+ state.handshake_io(),
+ state.hash(),
policy(),
rng(),
secure_renegotiation_data_for_client_hello(),
@@ -170,11 +170,10 @@ void Client::send_client_hello(Handshake_State& state_base,
if(!state.client_hello()) // not resuming
{
- Client_Hello::Handshake_Info hs_info(state.handshake_io(), state.hash());
-
Client_Hello::Settings client_settings(version, m_info.hostname(), srp_identifier);
state.client_hello(new Client_Hello(
- hs_info,
+ state.handshake_io(),
+ state.hash(),
policy(),
rng(),
secure_renegotiation_data_for_client_hello(),
@@ -444,10 +443,9 @@ void Client::process_handshake_msg(const Handshake_State* active_state,
"tls-client",
m_info.hostname());
- Certificate::Handshake_Info hs_info(state.handshake_io(),
- state.hash());
-
- state.client_certs(new Certificate(hs_info, client_certs));
+ state.client_certs(new Certificate(state.handshake_io(),
+ state.hash(),
+ client_certs));
}
state.client_kex(
diff --git a/src/lib/tls/tls_handshake_msg.h b/src/lib/tls/tls_handshake_msg.h
index f098e7e81..618ae8d76 100644
--- a/src/lib/tls/tls_handshake_msg.h
+++ b/src/lib/tls/tls_handshake_msg.h
@@ -26,20 +26,6 @@ class Handshake_Hash;
class BOTAN_DLL Handshake_Message
{
public:
- class Handshake_Info
- {
- public:
- Handshake_Info(Handshake_IO& io, Handshake_Hash& hash)
- : m_io(io), m_hash(hash) {}
-
- Handshake_IO& get_io() { return m_io; }
- Handshake_Hash& get_hash() {return m_hash; }
-
- private:
- Handshake_IO& m_io;
- Handshake_Hash& m_hash;
- };
-
std::string type_string() const;
virtual Handshake_Type type() const = 0;
diff --git a/src/lib/tls/tls_messages.h b/src/lib/tls/tls_messages.h
index c6f8f9944..47ff7d3d8 100644
--- a/src/lib/tls/tls_messages.h
+++ b/src/lib/tls/tls_messages.h
@@ -181,14 +181,16 @@ class Client_Hello final : public Handshake_Message
std::set<Handshake_Extension_Type> extension_types() const
{ return m_extensions.extension_types(); }
- Client_Hello(Handshake_Info& hs_info,
+ Client_Hello(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
RandomNumberGenerator& rng,
const std::vector<byte>& reneg_info,
const Client_Hello::Settings& client_settings,
const std::vector<std::string>& next_protocols);
- Client_Hello(Handshake_Info& hs_info,
+ Client_Hello(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
RandomNumberGenerator& rng,
const std::vector<byte>& reneg_info,
@@ -302,7 +304,8 @@ class Server_Hello final : public Handshake_Message
std::set<Handshake_Extension_Type> extension_types() const
{ return m_extensions.extension_types(); }
- Server_Hello(Handshake_Info& hs_info,
+ Server_Hello(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
RandomNumberGenerator& rng,
const std::vector<byte>& secure_reneg_info,
@@ -310,7 +313,8 @@ class Server_Hello final : public Handshake_Message
const Server_Hello::Settings& settings,
const std::string next_protocol);
- Server_Hello(Handshake_Info& hs_info,
+ Server_Hello(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
RandomNumberGenerator& rng,
const std::vector<byte>& secure_reneg_info,
@@ -341,6 +345,7 @@ class Client_Key_Exchange final : public Handshake_Message
const secure_vector<byte>& pre_master_secret() const
{ return m_pre_master; }
+
Client_Key_Exchange(Handshake_IO& io,
Handshake_State& state,
const Policy& policy,
@@ -376,7 +381,8 @@ class Certificate final : public Handshake_Message
size_t count() const { return m_certs.size(); }
bool empty() const { return m_certs.empty(); }
- Certificate(Handshake_Info& hs_info,
+ Certificate(Handshake_IO& io,
+ Handshake_Hash& hash,
const std::vector<X509_Certificate>& certs);
explicit Certificate(const std::vector<byte>& buf);
@@ -402,7 +408,8 @@ class Certificate_Req final : public Handshake_Message
std::vector<std::pair<std::string, std::string> > supported_algos() const
{ return m_supported_algos; }
- Certificate_Req(Handshake_Info& hs_info,
+ Certificate_Req(Handshake_IO& io,
+ Handshake_Hash& hash,
const Policy& policy,
const std::vector<X509_DN>& allowed_cas,
Protocol_Version version);
diff --git a/src/lib/tls/tls_server.cpp b/src/lib/tls/tls_server.cpp
index ebd4d413d..96af3cc90 100644
--- a/src/lib/tls/tls_server.cpp
+++ b/src/lib/tls/tls_server.cpp
@@ -616,10 +616,9 @@ void Server::session_resume(Server_Handshake_State& pending_state,
pending_state.client_hello()->session_ticket().empty() &&
have_session_ticket_key);
- Server_Hello::Handshake_Info hs_info(pending_state.handshake_io(),
- pending_state.hash());
pending_state.server_hello(new Server_Hello(
- hs_info,
+ pending_state.handshake_io(),
+ pending_state.hash(),
policy(),
rng(),
secure_renegotiation_data_for_server_hello(),
@@ -713,10 +712,9 @@ void Server::session_create(Server_Handshake_State& pending_state,
pending_state.client_hello()->compression_methods()),
have_session_ticket_key);
- Server_Hello::Handshake_Info hs_info(pending_state.handshake_io(),
- pending_state.hash());
pending_state.server_hello(new Server_Hello(
- hs_info,
+ pending_state.handshake_io(),
+ pending_state.hash(),
policy(),
rng(),
secure_renegotiation_data_for_server_hello(),
@@ -735,10 +733,9 @@ void Server::session_create(Server_Handshake_State& pending_state,
BOTAN_ASSERT(!cert_chains[sig_algo].empty(),
"Attempting to send empty certificate chain");
- Certificate::Handshake_Info hs_info(pending_state.handshake_io(),
- pending_state.hash());
-
- pending_state.server_certs(new Certificate(hs_info, cert_chains[sig_algo]));
+ pending_state.server_certs(new Certificate(pending_state.handshake_io(),
+ pending_state.hash(),
+ cert_chains[sig_algo]));
}
Private_Key* private_key = nullptr;
@@ -778,10 +775,11 @@ void Server::session_create(Server_Handshake_State& pending_state,
if(!client_auth_CAs.empty() && pending_state.ciphersuite().sig_algo() != "")
{
- Certificate_Req::Handshake_Info hs_info(pending_state.handshake_io(),
- pending_state.hash());
pending_state.cert_req(
- new Certificate_Req(hs_info, policy(), client_auth_CAs,
+ new Certificate_Req(pending_state.handshake_io(),
+ pending_state.hash(),
+ policy(),
+ client_auth_CAs,
pending_state.version()));
pending_state.set_expected_next(CERTIFICATE);