Coverage Report

Created: 2019-12-03 15:21

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