Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | List of all members
Botan::TLS::Handshake_Hash Class Referencefinal

`#include <tls_handshake_hash.h>`

## Public Member Functions
secure_vector< uint8_t > | final (Protocol_Version version, const std::string &mac_algo) const
const std::vector< uint8_t > & | get_contents () const
void | reset ()
void | update (const std::vector< uint8_t > &in)
void | update (const uint8_t in[], size_t length)

## Detailed Description

TLS Handshake Hash

Definition at line 21 of file tls_handshake_hash.h.

## Member Function Documentation

## ◆ final()

secure_vector< uint8_t > Botan::TLS::Handshake_Hash::final | ( | Protocol_Version | version,
|  | const std::string & | mac_algo
| ) |  | const

Return a TLS Handshake Hash

Definition at line 18 of file tls_handshake_hash.cpp.

20 {
21 std::string hash_algo = mac_algo;
22 if(!version.supports_ciphersuite_specific_prf())
23 hash_algo = "Parallel(MD5,SHA-160)";
24 else if(mac_algo == "MD5" || mac_algo == "SHA-1")
25 hash_algo = "SHA-256";
26
27 std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_algo));
28 hash->update(m_data);
29 return hash->final();
30 }
Botan::HashFunction::create_or_throw
static std::unique_ptr< HashFunction > create_or_throw(const std::string &algo_spec, const std::string &provider="")
Definition: hash.cpp:329
hash
MechanismType hash
Definition: p11_mechanism.cpp:64
hash_algo
AlgorithmIdentifier hash_algo
Definition: x509_obj.cpp:22

References Botan::HashFunction::create_or_throw(), hash, hash_algo, and Botan::TLS::Protocol_Version::supports_ciphersuite_specific_prf().

Referenced by Botan::TLS::Session_Keys::Session_Keys().

## ◆ get_contents()

const std::vector< uint8_t > & Botan::TLS::Handshake_Hash::get_contents | ( |  | ) | const
| inline

Definition at line 33 of file tls_handshake_hash.h.

33{ return m_data; }

Referenced by Botan::TLS::Certificate_Verify::Certificate_Verify(), and Botan::TLS::Certificate_Verify::verify().

## ◆ reset()

void Botan::TLS::Handshake_Hash::reset | ( |  | ) |
| inline

Definition at line 35 of file tls_handshake_hash.h.

35{ m_data.clear(); }

Referenced by Botan::TLS::Handshake_State::client_hello(), and Botan::TLS::Handshake_State::hello_verify_request().

## ◆ update() [1/2]

void Botan::TLS::Handshake_Hash::update | ( | const std::vector< uint8_t > & | in | ) |
| inline

Definition at line 27 of file tls_handshake_hash.h.

28 { m_data += in; }

## ◆ update() [2/2]

void Botan::TLS::Handshake_Hash::update | ( | const uint8_t | in[],
|  | size_t | length
| ) |  |
| inline

Definition at line 24 of file tls_handshake_hash.h.

25 { m_data += std::make_pair(in, length); }

Referenced by Botan::TLS::Certificate_Verify::Certificate_Verify(), Botan::TLS::Finished::Finished(), Botan::TLS::Handshake_State::hello_verify_request(), and Botan::TLS::Server_Key_Exchange::Server_Key_Exchange().

The documentation for this class was generated from the following files:

- src/lib/tls/tls_handshake_hash.h
- src/lib/tls/tls_handshake_hash.cpp