aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls
diff options
context:
space:
mode:
authorRenĂ© Korthaus <[email protected]>2015-12-23 11:52:19 +0100
committerJack Lloyd <[email protected]>2016-01-08 19:09:51 -0500
commitd22bc10cd4f67924acd82bcd46a31e3de3b20ce3 (patch)
tree58459585e6675cd799b6ef5900be026825cd6f9d /src/lib/tls
parent2fbfdd7e5afb5e888fd8c0b56c6df09e2bdeaca7 (diff)
Mass-prefix member vars with m_
Diffstat (limited to 'src/lib/tls')
-rw-r--r--src/lib/tls/tls_extensions.cpp28
-rw-r--r--src/lib/tls/tls_extensions.h30
-rw-r--r--src/lib/tls/tls_handshake_hash.cpp2
-rw-r--r--src/lib/tls/tls_handshake_hash.h10
-rw-r--r--src/lib/tls/tls_session_key.cpp18
-rw-r--r--src/lib/tls/tls_session_key.h20
6 files changed, 54 insertions, 54 deletions
diff --git a/src/lib/tls/tls_extensions.cpp b/src/lib/tls/tls_extensions.cpp
index 3ca5be671..421c9e38c 100644
--- a/src/lib/tls/tls_extensions.cpp
+++ b/src/lib/tls/tls_extensions.cpp
@@ -91,7 +91,7 @@ std::vector<byte> Extensions::serialize() const
{
std::vector<byte> buf(2); // 2 bytes for length field
- for(auto& extn : extensions)
+ for(auto& extn : m_extensions)
{
if(extn.second->empty())
continue;
@@ -124,7 +124,7 @@ std::vector<byte> Extensions::serialize() const
std::set<Handshake_Extension_Type> Extensions::extension_types() const
{
std::set<Handshake_Extension_Type> offers;
- for(auto i = extensions.begin(); i != extensions.end(); ++i)
+ for(auto i = m_extensions.begin(); i != m_extensions.end(); ++i)
offers.insert(i->first);
return offers;
}
@@ -150,8 +150,8 @@ Server_Name_Indicator::Server_Name_Indicator(TLS_Data_Reader& reader,
if(name_type == 0) // DNS
{
- sni_host_name = reader.get_string(2, 1, 65535);
- name_bytes -= (2 + sni_host_name.size());
+ m_sni_host_name = reader.get_string(2, 1, 65535);
+ name_bytes -= (2 + m_sni_host_name.size());
}
else // some other unknown name type
{
@@ -165,7 +165,7 @@ std::vector<byte> Server_Name_Indicator::serialize() const
{
std::vector<byte> buf;
- size_t name_len = sni_host_name.size();
+ size_t name_len = m_sni_host_name.size();
buf.push_back(get_byte<u16bit>(0, name_len+3));
buf.push_back(get_byte<u16bit>(1, name_len+3));
@@ -175,8 +175,8 @@ std::vector<byte> Server_Name_Indicator::serialize() const
buf.push_back(get_byte<u16bit>(1, name_len));
buf += std::make_pair(
- reinterpret_cast<const byte*>(sni_host_name.data()),
- sni_host_name.size());
+ reinterpret_cast<const byte*>(m_sni_host_name.data()),
+ m_sni_host_name.size());
return buf;
}
@@ -184,9 +184,9 @@ std::vector<byte> Server_Name_Indicator::serialize() const
SRP_Identifier::SRP_Identifier(TLS_Data_Reader& reader,
u16bit extension_size)
{
- srp_identifier = reader.get_string(1, 1, 255);
+ m_srp_identifier = reader.get_string(1, 1, 255);
- if(srp_identifier.size() + 1 != extension_size)
+ if(m_srp_identifier.size() + 1 != extension_size)
throw Decoding_Error("Bad encoding for SRP identifier extension");
}
@@ -195,9 +195,9 @@ std::vector<byte> SRP_Identifier::serialize() const
std::vector<byte> buf;
const byte* srp_bytes =
- reinterpret_cast<const byte*>(srp_identifier.data());
+ reinterpret_cast<const byte*>(m_srp_identifier.data());
- append_tls_length_value(buf, srp_bytes, srp_identifier.size(), 1);
+ append_tls_length_value(buf, srp_bytes, m_srp_identifier.size(), 1);
return buf;
}
@@ -205,16 +205,16 @@ std::vector<byte> SRP_Identifier::serialize() const
Renegotiation_Extension::Renegotiation_Extension(TLS_Data_Reader& reader,
u16bit extension_size)
{
- reneg_data = reader.get_range<byte>(1, 0, 255);
+ m_reneg_data = reader.get_range<byte>(1, 0, 255);
- if(reneg_data.size() + 1 != extension_size)
+ if(m_reneg_data.size() + 1 != extension_size)
throw Decoding_Error("Bad encoding for secure renegotiation extn");
}
std::vector<byte> Renegotiation_Extension::serialize() const
{
std::vector<byte> buf;
- append_tls_length_value(buf, reneg_data, 1);
+ append_tls_length_value(buf, m_reneg_data, 1);
return buf;
}
diff --git a/src/lib/tls/tls_extensions.h b/src/lib/tls/tls_extensions.h
index 8c28fab31..51d76ccbd 100644
--- a/src/lib/tls/tls_extensions.h
+++ b/src/lib/tls/tls_extensions.h
@@ -80,18 +80,18 @@ class Server_Name_Indicator : public Extension
Handshake_Extension_Type type() const override { return static_type(); }
Server_Name_Indicator(const std::string& host_name) :
- sni_host_name(host_name) {}
+ m_sni_host_name(host_name) {}
Server_Name_Indicator(TLS_Data_Reader& reader,
u16bit extension_size);
- std::string host_name() const { return sni_host_name; }
+ std::string host_name() const { return m_sni_host_name; }
std::vector<byte> serialize() const override;
- bool empty() const override { return sni_host_name.empty(); }
+ bool empty() const override { return m_sni_host_name.empty(); }
private:
- std::string sni_host_name;
+ std::string m_sni_host_name;
};
/**
@@ -106,18 +106,18 @@ class SRP_Identifier : public Extension
Handshake_Extension_Type type() const override { return static_type(); }
SRP_Identifier(const std::string& identifier) :
- srp_identifier(identifier) {}
+ m_srp_identifier(identifier) {}
SRP_Identifier(TLS_Data_Reader& reader,
u16bit extension_size);
- std::string identifier() const { return srp_identifier; }
+ std::string identifier() const { return m_srp_identifier; }
std::vector<byte> serialize() const override;
- bool empty() const override { return srp_identifier.empty(); }
+ bool empty() const override { return m_srp_identifier.empty(); }
private:
- std::string srp_identifier;
+ std::string m_srp_identifier;
};
/**
@@ -134,19 +134,19 @@ class Renegotiation_Extension : public Extension
Renegotiation_Extension() {}
Renegotiation_Extension(const std::vector<byte>& bits) :
- reneg_data(bits) {}
+ m_reneg_data(bits) {}
Renegotiation_Extension(TLS_Data_Reader& reader,
u16bit extension_size);
const std::vector<byte>& renegotiation_info() const
- { return reneg_data; }
+ { return m_reneg_data; }
std::vector<byte> serialize() const override;
bool empty() const override { return false; } // always send this
private:
- std::vector<byte> reneg_data;
+ std::vector<byte> m_reneg_data;
};
/**
@@ -409,9 +409,9 @@ class Extensions
{
Handshake_Extension_Type type = T::static_type();
- auto i = extensions.find(type);
+ auto i = m_extensions.find(type);
- if(i != extensions.end())
+ if(i != m_extensions.end())
return dynamic_cast<T*>(i->second.get());
return nullptr;
}
@@ -424,7 +424,7 @@ class Extensions
void add(Extension* extn)
{
- extensions[extn->type()].reset(extn);
+ m_extensions[extn->type()].reset(extn);
}
std::vector<byte> serialize() const;
@@ -439,7 +439,7 @@ class Extensions
Extensions(const Extensions&) {}
Extensions& operator=(const Extensions&) { return (*this); }
- std::map<Handshake_Extension_Type, std::unique_ptr<Extension>> extensions;
+ std::map<Handshake_Extension_Type, std::unique_ptr<Extension>> m_extensions;
};
}
diff --git a/src/lib/tls/tls_handshake_hash.cpp b/src/lib/tls/tls_handshake_hash.cpp
index 615767cc2..00b8d744c 100644
--- a/src/lib/tls/tls_handshake_hash.cpp
+++ b/src/lib/tls/tls_handshake_hash.cpp
@@ -29,7 +29,7 @@ secure_vector<byte> Handshake_Hash::final(Protocol_Version version,
};
std::unique_ptr<HashFunction> hash(HashFunction::create(choose_hash()));
- hash->update(data);
+ hash->update(m_data);
return hash->final();
}
diff --git a/src/lib/tls/tls_handshake_hash.h b/src/lib/tls/tls_handshake_hash.h
index 050f3a454..d0f5c882f 100644
--- a/src/lib/tls/tls_handshake_hash.h
+++ b/src/lib/tls/tls_handshake_hash.h
@@ -23,19 +23,19 @@ class Handshake_Hash
{
public:
void update(const byte in[], size_t length)
- { data += std::make_pair(in, length); }
+ { m_data += std::make_pair(in, length); }
void update(const std::vector<byte>& in)
- { data += in; }
+ { m_data += in; }
secure_vector<byte> final(Protocol_Version version,
const std::string& mac_algo) const;
- const std::vector<byte>& get_contents() const { return data; }
+ const std::vector<byte>& get_contents() const { return m_data; }
- void reset() { data.clear(); }
+ void reset() { m_data.clear(); }
private:
- std::vector<byte> data;
+ std::vector<byte> m_data;
};
}
diff --git a/src/lib/tls/tls_session_key.cpp b/src/lib/tls/tls_session_key.cpp
index ffadf3e33..0e796aa23 100644
--- a/src/lib/tls/tls_session_key.cpp
+++ b/src/lib/tls/tls_session_key.cpp
@@ -43,7 +43,7 @@ Session_Keys::Session_Keys(const Handshake_State* state,
if(resuming)
{
// This is actually the master secret saved as part of the session
- master_sec = pre_master_secret;
+ m_master_sec = pre_master_secret;
}
else
{
@@ -61,7 +61,7 @@ Session_Keys::Session_Keys(const Handshake_State* state,
salt += state->server_hello()->random();
}
- master_sec = prf->derive_key(48, pre_master_secret, salt);
+ m_master_sec = prf->derive_key(48, pre_master_secret, salt);
}
secure_vector<byte> salt;
@@ -69,26 +69,26 @@ Session_Keys::Session_Keys(const Handshake_State* state,
salt += state->server_hello()->random();
salt += state->client_hello()->random();
- SymmetricKey keyblock = prf->derive_key(prf_gen, master_sec, salt);
+ SymmetricKey keyblock = prf->derive_key(prf_gen, m_master_sec, salt);
const byte* key_data = keyblock.begin();
- c_mac = SymmetricKey(key_data, mac_keylen);
+ m_c_mac = SymmetricKey(key_data, mac_keylen);
key_data += mac_keylen;
- s_mac = SymmetricKey(key_data, mac_keylen);
+ m_s_mac = SymmetricKey(key_data, mac_keylen);
key_data += mac_keylen;
- c_cipher = SymmetricKey(key_data, cipher_keylen);
+ m_c_cipher = SymmetricKey(key_data, cipher_keylen);
key_data += cipher_keylen;
- s_cipher = SymmetricKey(key_data, cipher_keylen);
+ m_s_cipher = SymmetricKey(key_data, cipher_keylen);
key_data += cipher_keylen;
- c_iv = InitializationVector(key_data, cipher_nonce_bytes);
+ m_c_iv = InitializationVector(key_data, cipher_nonce_bytes);
key_data += cipher_nonce_bytes;
- s_iv = InitializationVector(key_data, cipher_nonce_bytes);
+ m_s_iv = InitializationVector(key_data, cipher_nonce_bytes);
}
}
diff --git a/src/lib/tls/tls_session_key.h b/src/lib/tls/tls_session_key.h
index 6b74f907d..23c4a78fb 100644
--- a/src/lib/tls/tls_session_key.h
+++ b/src/lib/tls/tls_session_key.h
@@ -20,16 +20,16 @@ namespace TLS {
class Session_Keys
{
public:
- SymmetricKey client_cipher_key() const { return c_cipher; }
- SymmetricKey server_cipher_key() const { return s_cipher; }
+ SymmetricKey client_cipher_key() const { return m_c_cipher; }
+ SymmetricKey server_cipher_key() const { return m_s_cipher; }
- SymmetricKey client_mac_key() const { return c_mac; }
- SymmetricKey server_mac_key() const { return s_mac; }
+ SymmetricKey client_mac_key() const { return m_c_mac; }
+ SymmetricKey server_mac_key() const { return m_s_mac; }
- InitializationVector client_iv() const { return c_iv; }
- InitializationVector server_iv() const { return s_iv; }
+ InitializationVector client_iv() const { return m_c_iv; }
+ InitializationVector server_iv() const { return m_s_iv; }
- const secure_vector<byte>& master_secret() const { return master_sec; }
+ const secure_vector<byte>& master_secret() const { return m_master_sec; }
Session_Keys() {}
@@ -38,9 +38,9 @@ class Session_Keys
bool resuming);
private:
- secure_vector<byte> master_sec;
- SymmetricKey c_cipher, s_cipher, c_mac, s_mac;
- InitializationVector c_iv, s_iv;
+ secure_vector<byte> m_master_sec;
+ SymmetricKey m_c_cipher, m_s_cipher, m_c_mac, m_s_mac;
+ InitializationVector m_c_iv, m_s_iv;
};
}