aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-07-28 22:32:11 +0000
committerlloyd <[email protected]>2012-07-28 22:32:11 +0000
commit47804d48d8634869f059132fd9112206aa534cee (patch)
tree26e4144e0e89c8c50eaa96f0e201ebb9522f2e7c /src/tls
parent368ebec8078f61abce34488cfbdf4e6d6a464851 (diff)
Helper func for loading 24 bit value
Diffstat (limited to 'src/tls')
-rw-r--r--src/tls/tls_handshake_reader.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/tls/tls_handshake_reader.cpp b/src/tls/tls_handshake_reader.cpp
index b61f301dc..1f271d70a 100644
--- a/src/tls/tls_handshake_reader.cpp
+++ b/src/tls/tls_handshake_reader.cpp
@@ -12,6 +12,19 @@ namespace Botan {
namespace TLS {
+namespace {
+
+inline size_t load_be24(const byte q[3])
+ {
+ return make_u32bit(0,
+ q[0],
+ q[1],
+ q[2]);
+ }
+
+}
+
+
void Stream_Handshake_Reader::add_input(const byte record[],
size_t record_size)
{
@@ -27,10 +40,7 @@ bool Stream_Handshake_Reader::have_full_record() const
{
if(m_queue.size() >= 4)
{
- const size_t length = make_u32bit(0,
- m_queue[1],
- m_queue[2],
- m_queue[3]);
+ const size_t length = load_be24(&m_queue[1]);
return (m_queue.size() >= length + 4);
}
@@ -42,10 +52,7 @@ std::pair<Handshake_Type, std::vector<byte> > Stream_Handshake_Reader::get_next_
{
if(m_queue.size() >= 4)
{
- const size_t length = make_u32bit(0,
- m_queue[1],
- m_queue[2],
- m_queue[3]);
+ const size_t length = load_be24(&m_queue[1]);
if(m_queue.size() >= length + 4)
{