Line | Count | Source |
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::TLS { | |
12 | ||
13 | /** | |
14 | * Return a TLS Handshake Hash | |
15 | */ | |
16 | secure_vector<uint8_t> Handshake_Hash::final(const std::string& mac_algo) const | |
17 | 1.67k | { |
18 | 1.67k | std::string hash_algo = mac_algo; |
19 | 1.67k | if(mac_algo == "SHA-1") |
20 | 597 | hash_algo = "SHA-256"; |
21 | ||
22 | 1.67k | std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_algo)); |
23 | 1.67k | hash->update(m_data); |
24 | 1.67k | return hash->final(); |
25 | 1.67k | } |
26 | ||
27 | } |