Botan 3.6.1
Crypto and TLS for C&
tls_handshake_hash.cpp
Go to the documentation of this file.
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
10#include <botan/hash.h>
11
12namespace Botan::TLS {
13
14/**
15* Return a TLS Handshake Hash
16*/
17secure_vector<uint8_t> Handshake_Hash::final(std::string_view mac_algo) const {
18 std::string hash_algo(mac_algo);
19 if(hash_algo == "SHA-1") {
20 hash_algo = "SHA-256";
21 }
22
23 auto hash = HashFunction::create_or_throw(hash_algo);
24 hash->update(m_data);
25 return hash->final();
26}
27
28} // namespace Botan::TLS
static std::unique_ptr< HashFunction > create_or_throw(std::string_view algo_spec, std::string_view provider="")
Definition hash.cpp:298
secure_vector< uint8_t > final(std::string_view mac_algo) const
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61