diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tls/tls_handshake_reader.cpp | 28 | ||||
-rw-r--r-- | src/tls/tls_handshake_reader.h | 5 | ||||
-rw-r--r-- | src/tls/tls_record.h | 1 |
3 files changed, 18 insertions, 16 deletions
diff --git a/src/tls/tls_handshake_reader.cpp b/src/tls/tls_handshake_reader.cpp index a3fe48f71..b61f301dc 100644 --- a/src/tls/tls_handshake_reader.cpp +++ b/src/tls/tls_handshake_reader.cpp @@ -15,7 +15,7 @@ namespace TLS { void Stream_Handshake_Reader::add_input(const byte record[], size_t record_size) { - m_queue.write(record, record_size); + m_queue.insert(m_queue.end(), record, record + record_size); } bool Stream_Handshake_Reader::empty() const @@ -27,10 +27,10 @@ bool Stream_Handshake_Reader::have_full_record() const { if(m_queue.size() >= 4) { - byte head[4] = { 0 }; - m_queue.peek(head, 4); - - const size_t length = make_u32bit(0, head[1], head[2], head[3]); + const size_t length = make_u32bit(0, + m_queue[1], + m_queue[2], + m_queue[3]); return (m_queue.size() >= length + 4); } @@ -42,17 +42,19 @@ std::pair<Handshake_Type, std::vector<byte> > Stream_Handshake_Reader::get_next_ { if(m_queue.size() >= 4) { - byte head[4] = { 0 }; - m_queue.peek(head, 4); - - const size_t length = make_u32bit(0, head[1], head[2], head[3]); + const size_t length = make_u32bit(0, + m_queue[1], + m_queue[2], + m_queue[3]); if(m_queue.size() >= length + 4) { - Handshake_Type type = static_cast<Handshake_Type>(head[0]); - std::vector<byte> contents(length); - m_queue.read(head, 4); // discard - m_queue.read(&contents[0], contents.size()); + Handshake_Type type = static_cast<Handshake_Type>(m_queue[0]); + + std::vector<byte> contents(m_queue.begin() + 4, + m_queue.begin() + 4 + length); + + m_queue.erase(m_queue.begin(), m_queue.begin() + 4 + length); return std::make_pair(type, contents); } diff --git a/src/tls/tls_handshake_reader.h b/src/tls/tls_handshake_reader.h index 618e1878a..13c270d87 100644 --- a/src/tls/tls_handshake_reader.h +++ b/src/tls/tls_handshake_reader.h @@ -9,8 +9,9 @@ #define BOTAN_TLS_HANDSHAKE_READER_H__ #include <botan/tls_magic.h> -#include <botan/secqueue.h> #include <botan/loadstor.h> +#include <vector> +#include <deque> #include <utility> namespace Botan { @@ -48,7 +49,7 @@ class Stream_Handshake_Reader : public Handshake_Reader std::pair<Handshake_Type, std::vector<byte> > get_next_record(); private: - SecureQueue m_queue; + std::deque<byte> m_queue; }; } diff --git a/src/tls/tls_record.h b/src/tls/tls_record.h index a92dcbe9d..72d5e276d 100644 --- a/src/tls/tls_record.h +++ b/src/tls/tls_record.h @@ -14,7 +14,6 @@ #include <botan/tls_version.h> #include <botan/pipe.h> #include <botan/mac.h> -#include <botan/secqueue.h> #include <vector> #include <functional> |