From a4124ddf481bfc56859007b34dea646ecb7f8a25 Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 11 Jan 2010 22:57:21 +0000 Subject: Import latest version of Ajisai into src/ssl; once this hits mainline I'll officially kill off Ajisai (instead of it just lingering as a zombine as it is currently). Apparently I broke something (or multiple things) during the import process; servers crash and clients gets MAC errors on connect. --- src/ssl/tls_record.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/ssl/tls_record.h (limited to 'src/ssl/tls_record.h') diff --git a/src/ssl/tls_record.h b/src/ssl/tls_record.h new file mode 100644 index 000000000..b362d3fb7 --- /dev/null +++ b/src/ssl/tls_record.h @@ -0,0 +1,79 @@ +/** +* TLS Record Handling Header File +* (C) 2004-2006 Jack Lloyd +* +* Released under the terms of the Botan license +*/ + +#ifndef BOTAN_RECORDS_H__ +#define BOTAN_RECORDS_H__ + +#include +#include +#include +#include +#include + +namespace Botan { + +/** +* TLS Record Writer +*/ +class BOTAN_DLL Record_Writer + { + public: + void send(byte, const byte[], u32bit); + void send(byte, byte); + void flush(); + + 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&); + private: + void send_record(byte, const byte[], u32bit); + void send_record(byte, byte, byte, const byte[], u32bit); + + Socket& socket; + Pipe compress, cipher, mac; + SecureVector buffer; + u32bit pad_amount, mac_size, buf_pos; + u64bit seq_no; + byte major, minor, buf_type; + bool do_compress; + }; + +/** +* TLS Record Reader +*/ +class BOTAN_DLL Record_Reader + { + public: + SecureVector get_record(byte&); + + void set_keys(const CipherSuite&, const SessionKeys&, Connection_Side); + void set_compressor(Filter*); + + void set_version(Version_Code); + + void reset(); + + Record_Reader(Socket&); + private: + Socket& socket; + Pipe compress, cipher, mac; + u32bit pad_amount, mac_size; + u64bit seq_no; + byte major, minor; + bool do_compress; + }; + +} + +#endif -- cgit v1.2.3