diff options
author | lloyd <[email protected]> | 2012-05-18 20:44:34 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-05-18 20:44:34 +0000 |
commit | 8383b0b503c812e45f2780217b048a19a8946853 (patch) | |
tree | 939403bad80ee2b1e13b69c82adc316422a9c7d6 /src/tls | |
parent | c691561f3198f481c13457433efbccc1c9fcd898 (diff) |
Replace 0 and NULL pointer constants with nullptr. Also fix an old
style cast in secmem.h
Diffstat (limited to 'src/tls')
-rw-r--r-- | src/tls/rec_read.cpp | 6 | ||||
-rw-r--r-- | src/tls/rec_wri.cpp | 6 | ||||
-rw-r--r-- | src/tls/s_kex.cpp | 4 | ||||
-rw-r--r-- | src/tls/tls_channel.cpp | 10 | ||||
-rw-r--r-- | src/tls/tls_channel.h | 2 | ||||
-rw-r--r-- | src/tls/tls_client.cpp | 8 | ||||
-rw-r--r-- | src/tls/tls_extensions.cpp | 2 | ||||
-rw-r--r-- | src/tls/tls_extensions.h | 2 | ||||
-rw-r--r-- | src/tls/tls_handshake_state.cpp | 30 | ||||
-rw-r--r-- | src/tls/tls_messages.h | 2 | ||||
-rw-r--r-- | src/tls/tls_server.cpp | 10 |
11 files changed, 41 insertions, 41 deletions
diff --git a/src/tls/rec_read.cpp b/src/tls/rec_read.cpp index 4a1d6aac1..fd57496c8 100644 --- a/src/tls/rec_read.cpp +++ b/src/tls/rec_read.cpp @@ -18,7 +18,7 @@ namespace TLS { Record_Reader::Record_Reader() : m_readbuf(TLS_HEADER_SIZE + MAX_CIPHERTEXT_SIZE), - m_mac(0) + m_mac(nullptr) { reset(); set_maximum_fragment_size(0); @@ -37,7 +37,7 @@ void Record_Reader::reset() m_cipher.reset(); delete m_mac; - m_mac = 0; + m_mac = nullptr; m_block_size = 0; m_iv_size = 0; @@ -72,7 +72,7 @@ void Record_Reader::activate(Connection_Side side, { m_cipher.reset(); delete m_mac; - m_mac = 0; + m_mac = nullptr; m_seq_no = 0; if(compression_method != NO_COMPRESSION) diff --git a/src/tls/rec_wri.cpp b/src/tls/rec_wri.cpp index 63383f85e..d18ab6594 100644 --- a/src/tls/rec_wri.cpp +++ b/src/tls/rec_wri.cpp @@ -25,7 +25,7 @@ namespace TLS { Record_Writer::Record_Writer(std::function<void (const byte[], size_t)> out) : m_output_fn(out), m_writebuf(TLS_HEADER_SIZE + MAX_CIPHERTEXT_SIZE), - m_mac(0) + m_mac(nullptr) { reset(); set_maximum_fragment_size(0); @@ -48,7 +48,7 @@ void Record_Writer::reset() m_cipher.reset(); delete m_mac; - m_mac = 0; + m_mac = nullptr; m_version = Protocol_Version(); m_block_size = 0; @@ -76,7 +76,7 @@ void Record_Writer::activate(Connection_Side side, { m_cipher.reset(); delete m_mac; - m_mac = 0; + m_mac = nullptr; if(compression_method != NO_COMPRESSION) throw Internal_Error("Negotiated unknown compression algorithm"); diff --git a/src/tls/s_kex.cpp b/src/tls/s_kex.cpp index d28b44857..48901d311 100644 --- a/src/tls/s_kex.cpp +++ b/src/tls/s_kex.cpp @@ -33,7 +33,7 @@ Server_Key_Exchange::Server_Key_Exchange(Record_Writer& writer, Credentials_Manager& creds, RandomNumberGenerator& rng, const Private_Key* signing_key) : - m_kex_key(0), m_srp_params(0) + m_kex_key(nullptr), m_srp_params(nullptr) { const std::string hostname = state->client_hello->sni_hostname(); const std::string kex_algo = state->suite.kex_algo(); @@ -146,7 +146,7 @@ Server_Key_Exchange::Server_Key_Exchange(const std::vector<byte>& buf, const std::string& kex_algo, const std::string& sig_algo, Protocol_Version version) : - m_kex_key(0), m_srp_params(0) + m_kex_key(nullptr), m_srp_params(nullptr) { if(buf.size() < 6) throw Decoding_Error("Server_Key_Exchange: Packet corrupted"); diff --git a/src/tls/tls_channel.cpp b/src/tls/tls_channel.cpp index ff6722b5e..dadf26e90 100644 --- a/src/tls/tls_channel.cpp +++ b/src/tls/tls_channel.cpp @@ -22,7 +22,7 @@ Channel::Channel(std::function<void (const byte[], size_t)> socket_output_fn, proc_fn(proc_fn), handshake_fn(handshake_complete), writer(socket_output_fn), - state(0), + state(nullptr), handshake_completed(false), connection_closed(false), m_peer_supports_heartbeats(false), @@ -33,7 +33,7 @@ Channel::Channel(std::function<void (const byte[], size_t)> socket_output_fn, Channel::~Channel() { delete state; - state = 0; + state = nullptr; } size_t Channel::received_data(const byte buf[], size_t buf_size) @@ -105,7 +105,7 @@ size_t Channel::received_data(const byte buf[], size_t buf_size) alert_notify(alert_msg); - proc_fn(0, 0, alert_msg); + proc_fn(nullptr, 0, alert_msg); if(alert_msg.type() == Alert::CLOSE_NOTIFY) { @@ -120,7 +120,7 @@ size_t Channel::received_data(const byte buf[], size_t buf_size) connection_closed = true; delete state; - state = 0; + state = nullptr; writer.reset(); reader.reset(); @@ -238,7 +238,7 @@ void Channel::send_alert(const Alert& alert) connection_closed = true; delete state; - state = 0; + state = nullptr; writer.reset(); } diff --git a/src/tls/tls_channel.h b/src/tls/tls_channel.h index 46dafc416..fc0595064 100644 --- a/src/tls/tls_channel.h +++ b/src/tls/tls_channel.h @@ -69,7 +69,7 @@ class BOTAN_DLL Channel /** * Attempt to send a heartbeat message (if negotiated with counterparty) */ - void heartbeat() { heartbeat(0, 0); } + void heartbeat() { heartbeat(nullptr, 0); } /** * @return certificate chain of the peer (may be empty) diff --git a/src/tls/tls_client.cpp b/src/tls/tls_client.cpp index feb9ef85f..1ca256f3e 100644 --- a/src/tls/tls_client.cpp +++ b/src/tls/tls_client.cpp @@ -132,7 +132,7 @@ void Client::alert_notify(const Alert& alert) if(handshake_completed && state) { delete state; - state = 0; + state = nullptr; } } } @@ -143,7 +143,7 @@ void Client::alert_notify(const Alert& alert) void Client::process_handshake_msg(Handshake_Type type, const std::vector<byte>& contents) { - if(state == 0) + if(!state) throw Unexpected_Message("Unexpected handshake message from server"); if(type == HELLO_REQUEST) @@ -157,7 +157,7 @@ void Client::process_handshake_msg(Handshake_Type type, if(!secure_renegotiation.supported() && policy.require_secure_renegotiation()) { delete state; - state = 0; + state = nullptr; // RFC 5746 section 4.2 send_alert(Alert(Alert::NO_RENEGOTIATION)); @@ -474,7 +474,7 @@ void Client::process_handshake_msg(Handshake_Type type, session_manager.remove_entry(session_info.session_id()); delete state; - state = 0; + state = nullptr; handshake_completed = true; } else diff --git a/src/tls/tls_extensions.cpp b/src/tls/tls_extensions.cpp index 0f4e3176e..df25c40a5 100644 --- a/src/tls/tls_extensions.cpp +++ b/src/tls/tls_extensions.cpp @@ -49,7 +49,7 @@ Extension* make_extension(TLS_Data_Reader& reader, return new Session_Ticket(reader, size); default: - return 0; // not known + return nullptr; // not known } } diff --git a/src/tls/tls_extensions.h b/src/tls/tls_extensions.h index 885851c95..542ac0a82 100644 --- a/src/tls/tls_extensions.h +++ b/src/tls/tls_extensions.h @@ -351,7 +351,7 @@ class Extensions if(i != extensions.end()) return dynamic_cast<T*>(i->second); - return 0; + return nullptr; } void add(Extension* extn) diff --git a/src/tls/tls_handshake_state.cpp b/src/tls/tls_handshake_state.cpp index b8f3125c8..90de7c3f9 100644 --- a/src/tls/tls_handshake_state.cpp +++ b/src/tls/tls_handshake_state.cpp @@ -82,24 +82,24 @@ u32bit bitmask_for_handshake_type(Handshake_Type type) */ Handshake_State::Handshake_State(Handshake_Reader* reader) { - client_hello = 0; - server_hello = 0; - server_certs = 0; - server_kex = 0; - cert_req = 0; - server_hello_done = 0; - next_protocol = 0; - new_session_ticket = 0; - - client_certs = 0; - client_kex = 0; - client_verify = 0; - client_finished = 0; - server_finished = 0; + client_hello = nullptr; + server_hello = nullptr; + server_certs = nullptr; + server_kex = nullptr; + cert_req = nullptr; + server_hello_done = nullptr; + next_protocol = nullptr; + new_session_ticket = nullptr; + + client_certs = nullptr; + client_kex = nullptr; + client_verify = nullptr; + client_finished = nullptr; + server_finished = nullptr; m_handshake_reader = reader; - server_rsa_kex_key = 0; + server_rsa_kex_key = nullptr; m_version = Protocol_Version::SSL_V3; diff --git a/src/tls/tls_messages.h b/src/tls/tls_messages.h index e3bdaa6a0..31c35d901 100644 --- a/src/tls/tls_messages.h +++ b/src/tls/tls_messages.h @@ -414,7 +414,7 @@ class Server_Key_Exchange : public Handshake_Message const Policy& policy, Credentials_Manager& creds, RandomNumberGenerator& rng, - const Private_Key* signing_key = 0); + const Private_Key* signing_key = nullptr); Server_Key_Exchange(const std::vector<byte>& buf, const std::string& kex_alg, diff --git a/src/tls/tls_server.cpp b/src/tls/tls_server.cpp index 7c2c4d323..241215d59 100644 --- a/src/tls/tls_server.cpp +++ b/src/tls/tls_server.cpp @@ -163,7 +163,7 @@ std::map<std::string, std::vector<X509_Certificate> > get_server_certs(const std::string& hostname, Credentials_Manager& creds) { - const char* cert_types[] = { "RSA", "DSA", "ECDSA", 0 }; + const char* cert_types[] = { "RSA", "DSA", "ECDSA", nullptr }; std::map<std::string, std::vector<X509_Certificate> > cert_chains; @@ -223,7 +223,7 @@ void Server::alert_notify(const Alert& alert) if(handshake_completed && state) { delete state; - state = 0; + state = nullptr; } } } @@ -249,7 +249,7 @@ void Server::read_handshake(byte rec_type, void Server::process_handshake_msg(Handshake_Type type, const std::vector<byte>& contents) { - if(state == 0) + if(!state) throw Unexpected_Message("Unexpected handshake message from client"); state->confirm_transition_to(type); @@ -432,7 +432,7 @@ void Server::process_handshake_msg(Handshake_Type type, cert_chains[sig_algo]); } - Private_Key* private_key = 0; + Private_Key* private_key = nullptr; if(kex_algo == "RSA" || sig_algo != "") { @@ -608,7 +608,7 @@ void Server::process_handshake_msg(Handshake_Type type, state->server_finished); delete state; - state = 0; + state = nullptr; handshake_completed = true; } else |