diff options
Diffstat (limited to 'src/tls/tls_handshake_hash.h')
-rw-r--r-- | src/tls/tls_handshake_hash.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/tls/tls_handshake_hash.h b/src/tls/tls_handshake_hash.h new file mode 100644 index 000000000..c13f97aa8 --- /dev/null +++ b/src/tls/tls_handshake_hash.h @@ -0,0 +1,55 @@ +/* +* TLS Handshake Hash +* (C) 2004-2006,2011 Jack Lloyd +* +* Released under the terms of the Botan license +*/ + +#ifndef BOTAN_TLS_HANDSHAKE_HASH_H__ +#define BOTAN_TLS_HANDSHAKE_HASH_H__ + +#include <botan/secmem.h> +#include <botan/tls_version.h> +#include <botan/tls_magic.h> + +namespace Botan { + +namespace TLS { + +using namespace Botan; + +/** +* TLS Handshake Hash +*/ +class Handshake_Hash + { + public: + void update(const byte in[], size_t length) + { data += std::make_pair(in, length); } + + void update(const MemoryRegion<byte>& in) + { data += in; } + + void update(byte in) + { data.push_back(in); } + + void update(Handshake_Type handshake_type, + const MemoryRegion<byte>& handshake_msg); + + SecureVector<byte> final(Protocol_Version version, + const std::string& mac_algo); + + SecureVector<byte> final_ssl3(const MemoryRegion<byte>& master_secret); + + const SecureVector<byte>& get_contents() const + { return data; } + + private: + SecureVector<byte> data; + }; + +} + +} + +#endif |