Botan 2.19.1
Crypto and TLS for C&
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/hash.h>
10
11namespace Botan {
12
13namespace TLS {
14
15/**
16* Return a TLS Handshake Hash
17*/
19 const std::string& mac_algo) const
20 {
21 std::string hash_algo = mac_algo;
23 hash_algo = "Parallel(MD5,SHA-160)";
24 else if(mac_algo == "MD5" || mac_algo == "SHA-1")
25 hash_algo = "SHA-256";
26
27 std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_algo));
28 hash->update(m_data);
29 return hash->final();
30 }
31
32}
33
34}
static std::unique_ptr< HashFunction > create_or_throw(const std::string &algo_spec, const std::string &provider="")
Definition: hash.cpp:344
secure_vector< uint8_t > final(Protocol_Version version, const std::string &mac_algo) const
bool supports_ciphersuite_specific_prf() const
Definition: tls_version.cpp:72
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65
MechanismType hash
AlgorithmIdentifier hash_algo
Definition: x509_obj.cpp:22