39#define P_KEY_ID_MASK 0x07
40#define P_OPCODE_SHIFT 3
43#define P_CONTROL_HARD_RESET_CLIENT_V1 1
44#define P_CONTROL_HARD_RESET_SERVER_V1 2
45#define P_CONTROL_SOFT_RESET_V1 3
52#define P_CONTROL_HARD_RESET_CLIENT_V2 7
53#define P_CONTROL_HARD_RESET_SERVER_V2 8
56#define P_CONTROL_HARD_RESET_CLIENT_V3 10
60#define P_CONTROL_WKC_V1 11
65#define P_FIRST_OPCODE 3
66#define P_LAST_OPCODE 11
71#define TLS_RELIABLE_N_SEND_BUFFERS 6
72#define TLS_RELIABLE_N_REC_BUFFERS 12
155 const struct buffer *buf);
181 int handwindow,
int offset);
232 bool request_resend_wkc);
248static inline const char *
254 return "P_CONTROL_HARD_RESET_CLIENT_V1";
257 return "P_CONTROL_HARD_RESET_SERVER_V1";
260 return "P_CONTROL_HARD_RESET_CLIENT_V2";
263 return "P_CONTROL_HARD_RESET_SERVER_V2";
266 return "P_CONTROL_HARD_RESET_CLIENT_V3";
269 return "P_CONTROL_SOFT_RESET_V1";
272 return "P_CONTROL_V1";
275 return "P_CONTROL_WKC_V1";
309 return &
session->tls_wrap_reneg;
322#define EARLY_NEG_MASK 0xff000000
323#define EARLY_NEG_START 0x0f000000
330#define TLV_TYPE_EARLY_NEG_FLAGS 0x0001
331#define EARLY_NEG_FLAG_RESEND_WKC 0x0001
mbedtls_md_context_t hmac_ctx_t
Generic HMAC context.
enum first_packet_verdict tls_pre_decrypt_lite(const struct tls_auth_standalone *tas, struct tls_pre_decrypt_state *state, const struct link_socket_actual *from, const struct buffer *buf)
Inspect an incoming packet for which no VPN tunnel is active, and determine whether a new VPN tunnel ...
Control Channel SSL library backend module.
Control Channel Common Data Structures.
bool check_session_id_hmac(struct tls_pre_decrypt_state *state, const struct openvpn_sockaddr *from, hmac_ctx_t *hmac, int handwindow)
Checks if a control packet has a correct HMAC server session id.
struct session_id calculate_session_id_hmac(struct session_id client_sid, const struct openvpn_sockaddr *from, hmac_ctx_t *hmac, int handwindow, int offset)
Calculates the HMAC based server session id based on a client session id and socket addr.
void free_tls_pre_decrypt_state(struct tls_pre_decrypt_state *state)
void write_control_auth(struct tls_session *session, struct key_state *ks, struct buffer *buf, struct link_socket_actual **to_link_addr, int opcode, int max_ack, bool prepend_ack)
#define P_CONTROL_HARD_RESET_CLIENT_V1
hmac_ctx_t * session_id_hmac_init(void)
static const char * packet_opcode_name(int op)
#define P_CONTROL_HARD_RESET_SERVER_V2
#define P_CONTROL_SOFT_RESET_V1
struct buffer extract_command_buffer(struct buffer *buf, struct gc_arena *gc)
Extracts a control channel message from buf and adjusts the size of buf after the message has been ex...
@ VERDICT_VALID_ACK_V1
This packet is a valid ACK control packet from the peer, i.e.
@ VERDICT_VALID_WKC_V1
The packet is a valid control packet with appended wrapped client key.
@ VERDICT_VALID_RESET_V2
This packet is a valid reset packet from the peer (all but tls-crypt-v2)
@ VERDICT_INVALID
the packet failed on of the various checks
@ VERDICT_VALID_RESET_V3
This is a valid v3 reset (tls-crypt-v2)
@ VERDICT_VALID_CONTROL_V1
This packet is a valid control packet from the peer.
bool read_control_auth(struct buffer *buf, struct tls_wrap_ctx *ctx, const struct link_socket_actual *from, const struct tls_options *opt)
#define P_CONTROL_HARD_RESET_CLIENT_V2
struct buffer tls_reset_standalone(struct tls_wrap_ctx *ctx, struct tls_auth_standalone *tas, struct session_id *own_sid, struct session_id *remote_sid, uint8_t header, bool request_resend_wkc)
This function creates a reset packet using the information from the tls pre decrypt state.
#define P_CONTROL_HARD_RESET_SERVER_V1
static struct tls_wrap_ctx * tls_session_get_tls_wrap(struct tls_session *session, int key_id)
Determines if the current session should use the renegotiation tls wrap struct instead the normal one...
#define P_CONTROL_HARD_RESET_CLIENT_V3
Wrapper structure for dynamically allocated memory.
int len
Length in bytes of the actual content within the allocated memory.
Packet geometry parameters.
Garbage collection arena used to keep track of dynamically allocated memory.
Security parameter state of one TLS and data channel key session.
struct tls_wrap_ctx tls_wrap
struct that stores the temporary data for the tls lite decrypt functions
struct session_id peer_session_id
struct session_id server_session_id
struct tls_wrap_ctx tls_wrap_tmp
Security parameter state of a single session within a VPN tunnel.
Control channel wrapping (–tls-auth/–tls-crypt) context.
@ TLS_WRAP_CRYPT
Control channel encryption and authentication.