aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls/tls_handshake_hash.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-10 03:41:59 +0000
committerlloyd <[email protected]>2014-01-10 03:41:59 +0000
commit6894dca64c04936d07048c0e8cbf7e25858548c3 (patch)
tree5d572bfde9fe667dab14e3f04b5285a85d8acd95 /src/lib/tls/tls_handshake_hash.h
parent9efa3be92442afb3d0b69890a36c7f122df18eda (diff)
Move lib into src
Diffstat (limited to 'src/lib/tls/tls_handshake_hash.h')
-rw-r--r--src/lib/tls/tls_handshake_hash.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/lib/tls/tls_handshake_hash.h b/src/lib/tls/tls_handshake_hash.h
new file mode 100644
index 000000000..840895963
--- /dev/null
+++ b/src/lib/tls/tls_handshake_hash.h
@@ -0,0 +1,50 @@
+/*
+* TLS Handshake Hash
+* (C) 2004-2006,2011,2012 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 std::vector<byte>& in)
+ { data += in; }
+
+ secure_vector<byte> final(Protocol_Version version,
+ const std::string& mac_algo) const;
+
+ secure_vector<byte> final_ssl3(const secure_vector<byte>& master_secret) const;
+
+ const std::vector<byte>& get_contents() const
+ { return data; }
+
+ void reset() { data.clear(); }
+ private:
+ std::vector<byte> data;
+ };
+
+}
+
+}
+
+#endif