From 221f9bd1469de9248b0233d366cdc2f0613fc182 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 19 Oct 2010 04:39:26 +0000 Subject: Run MAC as standalone object instead of running it through a Pipe at record layer. --- src/ssl/tls_record.h | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/ssl/tls_record.h') diff --git a/src/ssl/tls_record.h b/src/ssl/tls_record.h index d39f1b557..7ad866c6e 100644 --- a/src/ssl/tls_record.h +++ b/src/ssl/tls_record.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -23,8 +24,9 @@ namespace Botan { class BOTAN_DLL Record_Writer { public: - void send(byte, const byte[], size_t); - void send(byte, byte); + void send(byte type, const byte input[], size_t length); + void send(byte type, byte val) { send(type, &val, 1); } + void flush(); void alert(Alert_Level, Alert_Type); @@ -37,12 +39,16 @@ class BOTAN_DLL Record_Writer Record_Writer(Socket& socket); + ~Record_Writer() { delete mac; } private: - void send_record(byte, const byte[], size_t); - void send_record(byte, byte, byte, const byte[], size_t); + void send_record(byte type, const byte input[], size_t length); + void send_record(byte type, byte major, byte minor, + const byte input[], size_t length); Socket& socket; - Pipe cipher, mac; + Pipe cipher; + MessageAuthenticationCode* mac; + SecureVector buffer; size_t buf_pos; @@ -78,11 +84,14 @@ class BOTAN_DLL Record_Reader void reset(); - Record_Reader() { reset(); } + Record_Reader() { mac = 0; reset(); } + + ~Record_Reader() { delete mac; } private: SecureQueue input_queue; - Pipe cipher, mac; + Pipe cipher; + MessageAuthenticationCode* mac; size_t block_size, mac_size, iv_size; u64bit seq_no; byte major, minor; -- cgit v1.2.3