aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-04-11 16:07:26 +0000
committerlloyd <[email protected]>2013-04-11 16:07:26 +0000
commit3a4ed0a30a4e055205f871be427e39306f0204b2 (patch)
treeb24f9b8eadc19ea6a44836fe21cdbf34f98aa8c3
parent3666479a1ef057cb61bfd0448133097993554594 (diff)
In Channel, pre-size the IO buffers to 16K to avoid excess allocations.
Translate Integrity_Failure exceptions to bad_record_mac
-rw-r--r--src/tls/tls_channel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tls/tls_channel.cpp b/src/tls/tls_channel.cpp
index 5e9235f36..6bbb64a5d 100644
--- a/src/tls/tls_channel.cpp
+++ b/src/tls/tls_channel.cpp
@@ -30,6 +30,8 @@ Channel::Channel(std::function<void (const byte[], size_t)> output_fn,
m_rng(rng),
m_session_manager(session_manager)
{
+ m_writebuf.reserve(16*1024);
+ m_readbuf.reserve(16*1024);
}
Channel::~Channel()
@@ -396,6 +398,11 @@ size_t Channel::received_data(const byte input[], size_t input_size)
send_alert(Alert(e.type(), true));
throw;
}
+ catch(Integrity_Failure& e)
+ {
+ send_alert(Alert(Alert::BAD_RECORD_MAC, true));
+ throw;
+ }
catch(Decoding_Error& e)
{
send_alert(Alert(Alert::DECODE_ERROR, true));