aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls
diff options
context:
space:
mode:
Diffstat (limited to 'src/tls')
-rw-r--r--src/tls/tls_alert.cpp15
-rw-r--r--src/tls/tls_alert.h6
2 files changed, 7 insertions, 14 deletions
diff --git a/src/tls/tls_alert.cpp b/src/tls/tls_alert.cpp
index 540fdd838..8723d9e5b 100644
--- a/src/tls/tls_alert.cpp
+++ b/src/tls/tls_alert.cpp
@@ -25,22 +25,15 @@ Alert::Alert(const std::vector<byte>& buf)
const byte dc = buf[1];
- /*
- * This is allowed by the specification but is not allocated and we're
- * using it internally as a special 'no alert' type.
- */
- if(dc == 255)
- throw Internal_Error("Alert: description code 255, rejecting");
-
m_type_code = static_cast<Type>(dc);
}
std::vector<byte> Alert::serialize() const
{
- std::vector<byte> alert(2);
- alert[0] = static_cast<byte>(is_fatal() ? 2 : 1);
- alert[1] = static_cast<byte>(type());
- return alert;
+ return std::vector<byte>({
+ (is_fatal() ? 2 : 1),
+ (static_cast<byte>(type()))
+ });
}
std::string Alert::type_string() const
diff --git a/src/tls/tls_alert.h b/src/tls/tls_alert.h
index acbcc56d6..12ab57d6b 100644
--- a/src/tls/tls_alert.h
+++ b/src/tls/tls_alert.h
@@ -56,9 +56,9 @@ class BOTAN_DLL Alert
BAD_CERTIFICATE_HASH_VALUE = 114,
UNKNOWN_PSK_IDENTITY = 115,
- NULL_ALERT = 255,
-
- HEARTBEAT_PAYLOAD = 256
+ // pseudo alert values
+ NULL_ALERT = 256,
+ HEARTBEAT_PAYLOAD = 257
};
/**