Botan  2.1.0
Crypto and TLS for C++11
tls_handshake_hash.cpp
Go to the documentation of this file.
1 /*
2 * TLS Handshake Hash
3 * (C) 2004-2006,2011,2012 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #include <botan/internal/tls_handshake_hash.h>
9 #include <botan/tls_exceptn.h>
10 #include <botan/hash.h>
11 
12 namespace Botan {
13 
14 namespace TLS {
15 
16 /**
17 * Return a TLS Handshake Hash
18 */
20  const std::string& mac_algo) const
21  {
22  std::string hash_algo = mac_algo;
24  hash_algo = "Parallel(MD5,SHA-160)";
25  else if(mac_algo == "MD5" || mac_algo == "SHA-1")
26  hash_algo = "SHA-256";
27 
28  std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_algo));
29  hash->update(m_data);
30  return hash->final();
31  }
32 
33 }
34 
35 }
static std::unique_ptr< HashFunction > create_or_throw(const std::string &algo_spec, const std::string &provider="")
Definition: hash.cpp:303
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Definition: alg_id.cpp:13
secure_vector< uint8_t > final(Protocol_Version version, const std::string &mac_algo) const
bool supports_ciphersuite_specific_prf() const
Definition: tls_version.cpp:75
MechanismType hash