aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tls/tls_alert.cpp2
-rw-r--r--src/tls/tls_alert.h8
-rw-r--r--src/tls/tls_channel.cpp10
-rw-r--r--src/tls/tls_channel.h2
-rw-r--r--src/tls/tls_client.cpp2
5 files changed, 10 insertions, 14 deletions
diff --git a/src/tls/tls_alert.cpp b/src/tls/tls_alert.cpp
index 9d2b74aca..b526eeac3 100644
--- a/src/tls/tls_alert.cpp
+++ b/src/tls/tls_alert.cpp
@@ -30,7 +30,7 @@ Alert::Alert(const MemoryRegion<byte>& buf)
* using it internally as a special 'no alert' type.
*/
if(dc == 255)
- throw Decoding_Error("Alert: description code 255, rejecting");
+ throw Internal_Error("Alert: description code 255, rejecting");
type_code = static_cast<Type>(dc);
}
diff --git a/src/tls/tls_alert.h b/src/tls/tls_alert.h
index d09b79168..0446a8c30 100644
--- a/src/tls/tls_alert.h
+++ b/src/tls/tls_alert.h
@@ -21,11 +21,6 @@ namespace TLS {
class BOTAN_DLL Alert
{
public:
- enum Level {
- WARNING = 1,
- FATAL = 2
- };
-
enum Type {
CLOSE_NOTIFY = 0,
UNEXPECTED_MESSAGE = 10,
@@ -86,7 +81,8 @@ class BOTAN_DLL Alert
*/
Alert(const MemoryRegion<byte>& buf);
- Alert(Level level, Type code) : fatal(level == FATAL), type_code(code) {}
+ Alert(Type alert_type, bool is_fatal = false) :
+ fatal(is_fatal), type_code(alert_type) {}
Alert() : fatal(false), type_code(NULL_ALERT) {}
private:
diff --git a/src/tls/tls_channel.cpp b/src/tls/tls_channel.cpp
index 372d4125f..d737ef237 100644
--- a/src/tls/tls_channel.cpp
+++ b/src/tls/tls_channel.cpp
@@ -90,7 +90,7 @@ size_t Channel::received_data(const byte buf[], size_t buf_size)
if(connection_closed)
reader.reset();
else
- send_alert(Alert(Alert::WARNING, Alert::CLOSE_NOTIFY)); // reply in kind
+ send_alert(Alert(Alert::CLOSE_NOTIFY)); // reply in kind
}
else if(alert_msg.is_fatal())
{
@@ -113,22 +113,22 @@ size_t Channel::received_data(const byte buf[], size_t buf_size)
}
catch(TLS_Exception& e)
{
- send_alert(Alert(Alert::FATAL, e.type()));
+ send_alert(Alert(e.type(), true));
throw;
}
catch(Decoding_Error& e)
{
- send_alert(Alert(Alert::FATAL, Alert::DECODE_ERROR));
+ send_alert(Alert(Alert::DECODE_ERROR, true));
throw;
}
catch(Internal_Error& e)
{
- send_alert(Alert(Alert::FATAL, Alert::INTERNAL_ERROR));
+ send_alert(Alert(Alert::INTERNAL_ERROR, true));
throw;
}
catch(std::exception& e)
{
- send_alert(Alert(Alert::FATAL, Alert::INTERNAL_ERROR));
+ send_alert(Alert(Alert::INTERNAL_ERROR, true));
throw;
}
}
diff --git a/src/tls/tls_channel.h b/src/tls/tls_channel.h
index bba6c23ec..aa171ca4b 100644
--- a/src/tls/tls_channel.h
+++ b/src/tls/tls_channel.h
@@ -40,7 +40,7 @@ class BOTAN_DLL Channel
/**
* Send a close notification alert
*/
- void close() { send_alert(Alert(Alert::WARNING, Alert::CLOSE_NOTIFY)); }
+ void close() { send_alert(Alert(Alert::CLOSE_NOTIFY)); }
/**
* @return true iff the connection is active for sending application data
diff --git a/src/tls/tls_client.cpp b/src/tls/tls_client.cpp
index 9fbf8c772..8df0c77a1 100644
--- a/src/tls/tls_client.cpp
+++ b/src/tls/tls_client.cpp
@@ -131,7 +131,7 @@ void Client::process_handshake_msg(Handshake_Type type,
state = 0;
// RFC 5746 section 4.2
- send_alert(Alert(Alert::WARNING, Alert::NO_RENEGOTIATION));
+ send_alert(Alert(Alert::NO_RENEGOTIATION));
return;
}