aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tls/tls_channel.cpp10
-rw-r--r--src/tls/tls_channel.h12
-rw-r--r--src/tls/tls_client.cpp2
-rw-r--r--src/tls/tls_server.cpp2
4 files changed, 18 insertions, 8 deletions
diff --git a/src/tls/tls_channel.cpp b/src/tls/tls_channel.cpp
index 6bbb64a5d..51e0c11e5 100644
--- a/src/tls/tls_channel.cpp
+++ b/src/tls/tls_channel.cpp
@@ -375,7 +375,7 @@ size_t Channel::received_data(const byte input[], size_t input_size)
}
if(alert_msg.type() == Alert::CLOSE_NOTIFY)
- send_alert(Alert(Alert::CLOSE_NOTIFY)); // reply in kind
+ send_warning_alert(Alert::CLOSE_NOTIFY); // reply in kind
if(alert_msg.type() == Alert::CLOSE_NOTIFY || alert_msg.is_fatal())
{
@@ -395,22 +395,22 @@ size_t Channel::received_data(const byte input[], size_t input_size)
}
catch(TLS_Exception& e)
{
- send_alert(Alert(e.type(), true));
+ send_fatal_alert(e.type());
throw;
}
catch(Integrity_Failure& e)
{
- send_alert(Alert(Alert::BAD_RECORD_MAC, true));
+ send_fatal_alert(Alert::BAD_RECORD_MAC);
throw;
}
catch(Decoding_Error& e)
{
- send_alert(Alert(Alert::DECODE_ERROR, true));
+ send_fatal_alert(Alert::DECODE_ERROR);
throw;
}
catch(...)
{
- send_alert(Alert(Alert::INTERNAL_ERROR, true));
+ send_fatal_alert(Alert::INTERNAL_ERROR);
throw;
}
}
diff --git a/src/tls/tls_channel.h b/src/tls/tls_channel.h
index c3c2dc8e2..be3ef3e6d 100644
--- a/src/tls/tls_channel.h
+++ b/src/tls/tls_channel.h
@@ -52,7 +52,7 @@ class BOTAN_DLL Channel
/**
* Send a close notification alert
*/
- void close() { send_alert(Alert(Alert::CLOSE_NOTIFY)); }
+ void close() { send_warning_alert(Alert::CLOSE_NOTIFY); }
/**
* @return true iff the connection is active for sending application data
@@ -150,6 +150,16 @@ class BOTAN_DLL Channel
*/
void send_alert(const Alert& alert);
+ /**
+ * Send a warning alert
+ */
+ void send_warning_alert(Alert::Type type) { send_alert(Alert(type, false)); }
+
+ /**
+ * Send a fatal alert
+ */
+ void send_fatal_alert(Alert::Type type) { send_alert(Alert(type, true)); }
+
void activate_session();
void change_cipher_spec_reader(Connection_Side side);
diff --git a/src/tls/tls_client.cpp b/src/tls/tls_client.cpp
index 15e3ab56b..e24e9739b 100644
--- a/src/tls/tls_client.cpp
+++ b/src/tls/tls_client.cpp
@@ -168,7 +168,7 @@ void Client::process_handshake_msg(const Handshake_State* active_state,
(!m_policy.allow_insecure_renegotiation() && !secure_renegotiation_supported()))
{
// RFC 5746 section 4.2
- send_alert(Alert(Alert::NO_RENEGOTIATION));
+ send_warning_alert(Alert::NO_RENEGOTIATION);
return;
}
diff --git a/src/tls/tls_server.cpp b/src/tls/tls_server.cpp
index 496d6c35b..6f4aaf4c3 100644
--- a/src/tls/tls_server.cpp
+++ b/src/tls/tls_server.cpp
@@ -284,7 +284,7 @@ void Server::process_handshake_msg(const Handshake_State* active_state,
if(!m_policy.allow_insecure_renegotiation() &&
!(initial_handshake || secure_renegotiation_supported()))
{
- send_alert(Alert(Alert::NO_RENEGOTIATION));
+ send_warning_alert(Alert::NO_RENEGOTIATION);
return;
}