aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/session_ticket.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-03-22 15:03:04 +0000
committerlloyd <[email protected]>2012-03-22 15:03:04 +0000
commitcc9e16e623466d3d7a71b69736a816e665302bd4 (patch)
tree1af83fc32beb625a2277fcc7914fbb1e1459e467 /src/tls/session_ticket.cpp
parent3192ec3acfbf03a3b64a5aeb75e409db5adaaaf2 (diff)
Correct ticket decoding/encoding
Diffstat (limited to 'src/tls/session_ticket.cpp')
-rw-r--r--src/tls/session_ticket.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/tls/session_ticket.cpp b/src/tls/session_ticket.cpp
index 8dceade28..6aa05c577 100644
--- a/src/tls/session_ticket.cpp
+++ b/src/tls/session_ticket.cpp
@@ -20,17 +20,18 @@ New_Session_Ticket::New_Session_Ticket(const MemoryRegion<byte>& buf) :
{
if(buf.size() >= 4)
{
- m_ticket_lifetime_hint = load_be<u32bit>(&buf[0], 0);
- m_ticket.resize(buf.size() - 4);
- copy_mem(&m_ticket[0], &buf[4], buf.size() - 4);
+ TLS_Data_Reader reader(buf);
+
+ m_ticket_lifetime_hint = reader.get_u32bit();
+ m_ticket = reader.get_range<byte>(2, 0, 65535);
}
}
MemoryVector<byte> New_Session_Ticket::serialize() const
{
- MemoryVector<byte> buf(4 + m_ticket.size());
+ MemoryVector<byte> buf(4);
store_be(m_ticket_lifetime_hint, &buf[0]);
- copy_mem(&buf[4], &m_ticket[0], m_ticket.size());
+ append_tls_length_value(buf, m_ticket, 2);
return buf;
}