Coverage Report

Created: 2021-02-21 07:20

/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
2.51k
   {
21
2.51k
   std::string hash_algo = mac_algo;
22
2.51k
   if(!version.supports_ciphersuite_specific_prf())
23
0
      hash_algo = "Parallel(MD5,SHA-160)";
24
2.51k
   else if(mac_algo == "MD5" || mac_algo == "SHA-1")
25
712
      hash_algo = "SHA-256";
26
27
2.51k
   std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_algo));
28
2.51k
   hash->update(m_data);
29
2.51k
   return hash->final();
30
2.51k
   }
31
32
}
33
34
}