/src/botan/src/lib/tls/tls_handshake_hash.cpp
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 { |
12 | | |
13 | | namespace TLS { |
14 | | |
15 | | /** |
16 | | * Return a TLS Handshake Hash |
17 | | */ |
18 | | secure_vector<uint8_t> Handshake_Hash::final(const std::string& mac_algo) const |
19 | 6.18k | { |
20 | 6.18k | std::string hash_algo = mac_algo; |
21 | 6.18k | if(mac_algo == "SHA-1") |
22 | 2.80k | hash_algo = "SHA-256"; |
23 | | |
24 | 6.18k | std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_algo)); |
25 | 6.18k | hash->update(m_data); |
26 | 6.18k | return hash->final(); |
27 | 6.18k | } |
28 | | |
29 | | } |
30 | | |
31 | | } |