Coverage Report

Created: 2020-11-21 08:34

/src/botan/src/lib/tls/tls_handshake_hash.cpp
Line
Count
Source (jump to first uncovered line)
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
11
namespace Botan {
12
13
namespace TLS {
14
15
/**
16
* Return a TLS Handshake Hash
17
*/
18
secure_vector<uint8_t> Handshake_Hash::final(Protocol_Version version,
19
                                          const std::string& mac_algo) const
20
6.59k
   {
21
6.59k
   std::string hash_algo = mac_algo;
22
6.59k
   if(!version.supports_ciphersuite_specific_prf())
23
0
      hash_algo = "Parallel(MD5,SHA-160)";
24
6.59k
   else if(mac_algo == "MD5" || mac_algo == "SHA-1")
25
4.16k
      hash_algo = "SHA-256";
26
27
6.59k
   std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_algo));
28
6.59k
   hash->update(m_data);
29
6.59k
   return hash->final();
30
6.59k
   }
31
32
}
33
34
}