Botan: Botan::HandshakeHash Class Reference

Botan 1.10.17

Public Member Functions | List of all members
Botan::HandshakeHash Class Reference

`#include <tls_handshake_hash.h>`

## Public Member Functions
SecureVector< byte > | final ()
SecureVector< byte > | final_ssl3 (const MemoryRegion< byte > &)
void | update (const byte in[], size_t length)
void | update (const MemoryRegion< byte > &in)
void | update (byte in)

## Detailed Description

TLS Handshake Hash

Definition at line 20 of file tls_handshake_hash.h.

## Member Function Documentation

## ◆ final()

SecureVector< byte > Botan::HandshakeHash::final | ( |  | ) |

Return a TLS Handshake Hash

Definition at line 18 of file tls_handshake_hash.cpp.

References Botan::Buffered_Computation::final(), and Botan::Buffered_Computation::update().

Referenced by Botan::Certificate_Verify::verify().

19 {
20 MD5 md5;
21 SHA_160 sha1;
22
23 md5.update(data);
24 sha1.update(data);
25
26 SecureVector<byte> output;
27 output += md5.final();
28 output += sha1.final();
29 return output;
30 }

## ◆ final_ssl3()

SecureVector< byte > Botan::HandshakeHash::final_ssl3 | ( | const MemoryRegion< byte > & | secret | ) |

Return a SSLv3 Handshake Hash

Definition at line 35 of file tls_handshake_hash.cpp.

References Botan::Buffered_Computation::final(), and Botan::Buffered_Computation::update().

36 {
37 const byte PAD_INNER = 0x36, PAD_OUTER = 0x5C;
38
39 MD5 md5;
40 SHA_160 sha1;
41
42 md5.update(data);
43 sha1.update(data);
44
45 md5.update(secret);
46 sha1.update(secret);
47
48 for(size_t i = 0; i != 48; ++i)
49 md5.update(PAD_INNER);
50 for(size_t i = 0; i != 40; ++i)
51 sha1.update(PAD_INNER);
52
53 SecureVector<byte> inner_md5 = md5.final(), inner_sha1 = sha1.final();
54
55 md5.update(secret);
56 sha1.update(secret);
57 for(size_t i = 0; i != 48; ++i)
58 md5.update(PAD_OUTER);
59 for(size_t i = 0; i != 40; ++i)
60 sha1.update(PAD_OUTER);
61 md5.update(inner_md5);
62 sha1.update(inner_sha1);
63
64 SecureVector<byte> output;
65 output += md5.final();
66 output += sha1.final();
67 return output;
68 }
Botan::byte
unsigned char byte
Definition: types.h:22

## ◆ update() [1/3]

void Botan::HandshakeHash::update | ( | const byte | in[],
|  | size_t | length
| ) |  |
| inline

Definition at line 23 of file tls_handshake_hash.h.

Referenced by Botan::HandshakeMessage::send().

24 { data += std::make_pair(in, length); }

## ◆ update() [2/3]

void Botan::HandshakeHash::update | ( | const MemoryRegion< byte > & | in | ) |
| inline

Definition at line 26 of file tls_handshake_hash.h.

27 { data += in; }

## ◆ update() [3/3]

void Botan::HandshakeHash::update | ( | byte | in | ) |
| inline

Definition at line 29 of file tls_handshake_hash.h.

References Botan::MemoryRegion< T >::push_back().

30 { data.push_back(in); }
Botan::MemoryRegion::push_back
void push_back(T x)
Definition: secmem.h:149

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

- src/ssl/tls_handshake_hash.h
- src/ssl/tls_handshake_hash.cpp