Botan
3.0.0
Crypto and TLS for C&
src
lib
tls
tls_handshake_transitions.h
Go to the documentation of this file.
1
/*
2
* TLS Handshake State Transitions
3
* (C) 2004-2006,2011,2012 Jack Lloyd
4
* 2017 Harry Reimann, Rohde & Schwarz Cybersecurity
5
* 2022 René Meusel, Hannes Rantzsch - neXenio GmbH
6
*
7
* Botan is released under the Simplified BSD License (see license.txt)
8
*/
9
10
#ifndef BOTAN_TLS_HANDSHAKE_TRANSITIONS_H_
11
#define BOTAN_TLS_HANDSHAKE_TRANSITIONS_H_
12
13
#include <vector>
14
15
#include <botan/tls_magic.h>
16
17
namespace
Botan::TLS
{
18
19
/**
20
* Manages the expectations for incoming handshake messages in both TLS 1.2 and 1.3.
21
* This does not bear any knowledge about the actual state machine but is a mere
22
* helper to implement state transition validation.
23
*/
24
class
BOTAN_TEST_API
Handshake_Transitions
25
{
26
public
:
27
/**
28
* Return true iff we have received a particular message already
29
* @param msg_type the message type
30
*/
31
bool
received_handshake_msg(
Handshake_Type
msg_type)
const
;
32
33
/**
34
* Confirm that we were expecting this message type
35
* @param msg_type the message type
36
*/
37
void
confirm_transition_to(
Handshake_Type
msg_type);
38
39
/**
40
* Record that we are expecting a particular message type next
41
* @param msg_type the message type
42
*/
43
void
set_expected_next(
Handshake_Type
msg_type);
44
45
/**
46
* Record that we are expecting one of the enumerated message types next.
47
* Note that receiving any of the expected messages in `confirm_transition_to`
48
* resets _all_ the expectations.
49
*
50
* @param msg_types the message types
51
*/
52
void
set_expected_next(
const
std::vector<Handshake_Type>& msg_types);
53
54
/**
55
* Check whether a Change Cipher Spec must be expected
56
*/
57
bool
change_cipher_spec_expected()
const
;
58
59
private
:
60
uint32_t m_hand_expecting_mask = 0;
61
uint32_t m_hand_received_mask = 0;
62
};
63
64
}
65
66
#endif
Botan::TLS::Handshake_Transitions
Definition:
tls_handshake_transitions.h:25
BOTAN_TEST_API
#define BOTAN_TEST_API
Definition:
compiler.h:51
Botan::TLS
Definition:
asio_async_ops.h:26
Botan::TLS::Handshake_Type
Handshake_Type
Definition:
tls_magic.h:53
Generated by
1.9.6