aboutsummaryrefslogtreecommitdiffstats
path: root/src/ssl/tls_record.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ssl/tls_record.h')
-rw-r--r--src/ssl/tls_record.h46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/ssl/tls_record.h b/src/ssl/tls_record.h
index 3bec2e8ef..2058933d0 100644
--- a/src/ssl/tls_record.h
+++ b/src/ssl/tls_record.h
@@ -1,6 +1,6 @@
/**
-* TLS Record Handling
-* (C) 2004-2006 Jack Lloyd
+* TLS Record Handling
+* (C) 2004-2010 Jack Lloyd
*
* Released under the terms of the Botan license
*/
@@ -12,6 +12,7 @@
#include <botan/socket.h>
#include <botan/tls_suites.h>
#include <botan/pipe.h>
+#include <botan/secqueue.h>
#include <vector>
namespace Botan {
@@ -29,24 +30,26 @@ class BOTAN_DLL Record_Writer
void alert(Alert_Level, Alert_Type);
void set_keys(const CipherSuite&, const SessionKeys&, Connection_Side);
- void set_compressor(Filter*);
void set_version(Version_Code);
void reset();
- Record_Writer(Socket&);
+ Record_Writer(Socket& socket);
+
private:
void send_record(byte, const byte[], u32bit);
void send_record(byte, byte, byte, const byte[], u32bit);
Socket& socket;
- Pipe compress, cipher, mac;
+ Pipe cipher, mac;
SecureVector<byte> buffer;
- u32bit pad_amount, mac_size, buf_pos;
+ u32bit buf_pos;
+
+ u32bit block_size, mac_size, iv_size;
+
u64bit seq_no;
byte major, minor, buf_type;
- bool do_compress;
};
/**
@@ -55,23 +58,34 @@ class BOTAN_DLL Record_Writer
class BOTAN_DLL Record_Reader
{
public:
- SecureVector<byte> get_record(byte&);
+ void add_input(const byte input[], u32bit input_size);
- void set_keys(const CipherSuite&, const SessionKeys&, Connection_Side);
- void set_compressor(Filter*);
+ /**
+ * @param msg_type (output variable)
+ * @param buffer (output variable)
+ * @return Number of bytes still needed (minimum), or 0 if success
+ */
+ u32bit get_record(byte& msg_type,
+ MemoryRegion<byte>& buffer);
- void set_version(Version_Code);
+ SecureVector<byte> get_record(byte& msg_type);
+
+ void set_keys(const CipherSuite& suite,
+ const SessionKeys& keys,
+ Connection_Side side);
+
+ void set_version(Version_Code version);
void reset();
- Record_Reader(Socket&);
+ Record_Reader() { reset(); }
private:
- Socket& socket;
- Pipe compress, cipher, mac;
- u32bit pad_amount, mac_size;
+ SecureQueue input_queue;
+
+ Pipe cipher, mac;
+ u32bit block_size, mac_size, iv_size;
u64bit seq_no;
byte major, minor;
- bool do_compress;
};
}