aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls/tls_handshake_hash.h
blob: 050f3a4541ecaccf71e8b0d628b8a9021186d5b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* TLS Handshake Hash
* (C) 2004-2006,2011,2012 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#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 {

/**
* 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;

      const std::vector<byte>& get_contents() const { return data; }

      void reset() { data.clear(); }
   private:
      std::vector<byte> data;
   };

}

}

#endif