diff options
author | lloyd <[email protected]> | 2013-04-19 14:58:46 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-04-19 14:58:46 +0000 |
commit | 26200dbdff0fee9c8ab64fbc5c081a7dd48974f5 (patch) | |
tree | d8d6c45e5cbc6e63397a008a39ecbec451d92dc0 /src/tls | |
parent | abbf2b764c6fd2339c9e4fbc4647072087683f48 (diff) |
Avoid using representable value for internal null alert
Diffstat (limited to 'src/tls')
-rw-r--r-- | src/tls/tls_alert.cpp | 15 | ||||
-rw-r--r-- | src/tls/tls_alert.h | 6 |
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 }; /** |