50#define KEY_EXPANSION_ID "OpenVPN"
56#define CONTROL_SEND_ACK_MAX 4
61#define TLS_MULTI_REFRESH 15
62#define TLS_MULTI_HORIZON 2
70#define TLS_OPTIONS_LEN 512
81#define IV_PROTO_DATA_V2 (1<<1)
85#define IV_PROTO_REQUEST_PUSH (1<<2)
88#define IV_PROTO_TLS_KEY_EXPORT (1<<3)
91#define IV_PROTO_AUTH_PENDING_KW (1<<4)
96#define IV_PROTO_NCP_P2P (1<<5)
99#define IV_PROTO_DNS_OPTION (1<<6)
103#define IV_PROTO_CC_EXIT_NOTIFY (1<<7)
106#define IV_PROTO_AUTH_FAIL_TEMP (1<<8)
109#define IV_PROTO_DYN_TLS_CRYPT (1<<9)
112#define IV_PROTO_DATA_EPOCH (1<<10)
115#define IV_PROTO_DNS_OPTION_V2 (1<<11)
118#define X509_USERNAME_FIELD_DEFAULT "CN"
120#define KEY_METHOD_2 2
123#define KEY_METHOD_MASK 0x0F
229#define TLSMP_INACTIVE 0
230#define TLSMP_ACTIVE 1
232#define TLSMP_RECONNECT 3
304 const uint8_t **ad_start);
424#ifdef ENABLE_MANAGEMENT
476 struct frame *frame_fragment,
535#define PD_TLS_AUTH_HMAC_SIZE_MASK 0xFF
536#define PD_SHOW_DATA (1<<8)
538#define PD_VERBOSE (1<<10)
539#define PD_TLS_CRYPT (1<<11)
549#ifdef MEASURE_TLS_HANDSHAKE_STATS
550void show_tls_performance_stats(
void);
571 const char *cipher_list_tls13,
572 const char *tls_cert_profile);
void free_buf(struct buffer *buf)
static void secure_memzero(void *data, size_t len)
Securely zeroise memory.
void free_key_ctx_bi(struct key_ctx_bi *ctx)
Data Channel Cryptography Module.
#define S_ACTIVE
Operational key_state state immediately after negotiation has completed while still within the handsh...
struct tls_auth_standalone * tls_auth_standalone_init(struct tls_options *tls_options, struct gc_arena *gc)
void tls_init_control_channel_frame_parameters(struct frame *frame, int tls_mtu)
void tls_multi_free(struct tls_multi *multi, bool clear)
Cleanup a tls_multi structure and free associated memory allocations.
struct tls_multi * tls_multi_init(struct tls_options *tls_options)
Allocate and initialize a tls_multi structure.
void tls_multi_init_finalize(struct tls_multi *multi, int tls_mtu)
Finalize initialization of a tls_multi structure.
void tls_auth_standalone_free(struct tls_auth_standalone *tas)
Frees a standalone tls-auth verification object.
void tls_multi_init_set_options(struct tls_multi *multi, const char *local, const char *remote)
void tls_post_encrypt(struct tls_multi *multi, struct buffer *buf)
Perform some accounting for the key state used.
struct key_state * tls_select_encryption_key(struct tls_multi *multi)
Selects the primary encryption that should be used to encrypt data of an outgoing packet.
void tls_prepend_opcode_v1(const struct tls_multi *multi, struct buffer *buf)
Prepend a one-byte OpenVPN data channel P_DATA_V1 opcode to the packet.
void tls_pre_encrypt(struct tls_multi *multi, struct buffer *buf, struct crypto_options **opt)
Choose the appropriate security parameters with which to process an outgoing packet.
void tls_prepend_opcode_v2(const struct tls_multi *multi, struct buffer *buf)
Prepend an OpenVPN data channel P_DATA_V2 header to the packet.
bool tls_pre_decrypt(struct tls_multi *multi, const struct link_socket_actual *from, struct buffer *buf, struct crypto_options **opt, bool floated, const uint8_t **ad_start)
Determine whether an incoming packet is a data channel or control channel packet, and process accordi...
void packet_id_free(struct packet_id *p)
static bool packet_id_initialized(const struct packet_id *pid)
Is this struct packet_id initialized?
Reliability Layer module header file.
void ssl_purge_auth(const bool auth_user_pass_only)
void ssl_set_auth_token_user(const char *username)
void tls_session_soft_reset(struct tls_multi *multi)
void load_xkey_provider(void)
Load ovpn.xkey provider used for external key signing.
void ssl_set_auth_nocache(void)
static void tls_wrap_free(struct tls_wrap_ctx *tls_wrap)
Free the elements of a tls_wrap_ctx structure.
void ssl_put_auth_challenge(const char *cr_str)
void auth_user_pass_setup(const char *auth_file, bool is_inline, const struct static_challenge_info *sc_info)
void tls_update_remote_addr(struct tls_multi *multi, const struct link_socket_actual *addr)
Updates remote address in TLS sessions.
bool tls_send_payload(struct key_state *ks, const uint8_t *data, int size)
bool tls_rec_payload(struct tls_multi *multi, struct buffer *buf)
bool tls_session_generate_data_channel_keys(struct tls_multi *multi, struct tls_session *session)
Generate data channel keys for the supplied TLS session.
static bool tls_initial_packet_received(const struct tls_multi *multi)
bool is_hard_reset_method2(int op)
Given a key_method, return true if opcode represents the one of the hard_reset op codes for key-metho...
bool session_skip_to_pre_start(struct tls_session *session, struct tls_pre_decrypt_state *state, struct link_socket_actual *from)
void ssl_set_auth_token(const char *token)
int tls_multi_process(struct tls_multi *multi, struct buffer *to_link, struct link_socket_actual **to_link_addr, struct link_socket_info *to_link_socket_info, interval_t *wakeup)
static void tls_set_single_session(struct tls_multi *multi)
bool ssl_get_auth_nocache(void)
void pem_password_setup(const char *auth_file)
bool tls_session_update_crypto_params(struct tls_multi *multi, struct tls_session *session, struct options *options, struct frame *frame, struct frame *frame_fragment, struct link_socket_info *lsi, dco_context_t *dco)
Update TLS session crypto parameters (cipher and auth) and derive data channel keys based on the supp...
void init_ssl(const struct options *options, struct tls_root_ctx *ctx, bool in_chroot)
Build master SSL context object that serves for the whole of OpenVPN instantiation.
static int tls_test_payload_len(const struct tls_multi *multi)
bool ssl_clean_auth_token(void)
void enable_auth_user_pass(void)
void ssl_purge_auth_challenge(void)
void show_available_tls_ciphers(const char *cipher_list, const char *cipher_list_tls13, const char *tls_cert_profile)
const char * protocol_dump(struct buffer *buffer, unsigned int flags, struct gc_arena *gc)
Control Channel SSL library backend module.
Control Channel Common Data Structures.
static const struct key_state * get_primary_key(const struct tls_multi *multi)
gets an item of key_state objects in the order they should be scanned by data channel modules.
SSL control channel wrap/unwrap and decode functions.
Wrapper structure for dynamically allocated memory.
Security parameter state for processing data channel packets.
struct key_ctx_bi key_ctx_bi
OpenSSL cipher and HMAC contexts for both sending and receiving directions.
struct packet_id packet_id
Current packet ID state for both sending and receiving directions.
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 buffer plaintext_read_buf
Security parameter state for a single VPN tunnel.
int n_sessions
Number of sessions negotiated thus far.
struct that stores the temporary data for the tls lite decrypt functions
Structure that wraps the TLS context.
Security parameter state of a single session within a VPN tunnel.
Control channel wrapping (–tls-auth/–tls-crypt) context.
struct buffer tls_crypt_v2_metadata
Received from client.
bool cleanup_key_ctx
opt.key_ctx_bi is owned by this context
struct crypto_options opt
Crypto state.
struct buffer work
Work buffer (only for –tls-crypt)
struct key2 original_wrap_keydata
original key data to be xored in to the key for dynamic tls-crypt.