Go to the documentation of this file.
49 #define KEY_EXPANSION_ID "OpenVPN"
55 #define CONTROL_SEND_ACK_MAX 4
60 #define TLS_MULTI_REFRESH 15
61 #define TLS_MULTI_HORIZON 2
69 #define TLS_OPTIONS_LEN 512
80 #define IV_PROTO_DATA_V2 (1<<1)
84 #define IV_PROTO_REQUEST_PUSH (1<<2)
87 #define IV_PROTO_TLS_KEY_EXPORT (1<<3)
90 #define IV_PROTO_AUTH_PENDING_KW (1<<4)
95 #define IV_PROTO_NCP_P2P (1<<5)
98 #define IV_PROTO_DNS_OPTION (1<<6)
102 #define IV_PROTO_CC_EXIT_NOTIFY (1<<7)
105 #define IV_PROTO_AUTH_FAIL_TEMP (1<<8)
108 #define IV_PROTO_DYN_TLS_CRYPT (1<<9)
111 #define X509_USERNAME_FIELD_DEFAULT "CN"
113 #define KEY_METHOD_2 2
116 #define KEY_METHOD_MASK 0x0F
222 #define TLSMP_INACTIVE 0
223 #define TLSMP_ACTIVE 1
225 #define TLSMP_RECONNECT 3
297 const uint8_t **ad_start);
417 #ifdef ENABLE_MANAGEMENT
467 struct frame *frame_fragment,
525 #define PD_TLS_AUTH_HMAC_SIZE_MASK 0xFF
526 #define PD_SHOW_DATA (1<<8)
527 #define PD_TLS (1<<9)
528 #define PD_VERBOSE (1<<10)
529 #define PD_TLS_CRYPT (1<<11)
539 #ifdef MEASURE_TLS_HANDSHAKE_STATS
540 void show_tls_performance_stats(
void);
561 const char *cipher_list_tls13,
562 const char *tls_cert_profile);
void load_xkey_provider(void)
Load ovpn.xkey provider used for external key signing.
void tls_init_control_channel_frame_parameters(struct frame *frame, int tls_mtu)
void ssl_set_auth_token_user(const char *username)
void enable_auth_user_pass(void)
struct key2 original_wrap_keydata
original key data to be xored in to the key for dynamic tls-crypt.
static int tls_test_payload_len(const struct tls_multi *multi)
void ssl_set_auth_nocache(void)
bool ssl_get_auth_nocache(void)
bool tls_rec_payload(struct tls_multi *multi, struct buffer *buf)
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.
static bool packet_id_initialized(const struct packet_id *pid)
Is this struct packet_id initialized?
bool tls_send_payload(struct key_state *ks, const uint8_t *data, int size)
void show_available_tls_ciphers(const char *cipher_list, const char *cipher_list_tls13, const char *tls_cert_profile)
Packet geometry parameters.
Security parameter state for a single VPN tunnel.
static void tls_wrap_free(struct tls_wrap_ctx *tls_wrap)
Free the elements of a tls_wrap_ctx structure.
Security parameter state of one TLS and data channel key session.
bool session_skip_to_pre_start(struct tls_session *session, struct tls_pre_decrypt_state *state, struct link_socket_actual *from)
static void tls_set_single_session(struct tls_multi *multi)
void tls_session_soft_reset(struct tls_multi *multi)
void free_key_ctx_bi(struct key_ctx_bi *ctx)
void ssl_purge_auth(const bool auth_user_pass_only)
static void secure_memzero(void *data, size_t len)
Securely zeroise memory.
struct crypto_options opt
Crypto state.
void ssl_put_auth_challenge(const char *cr_str)
#define S_ACTIVE
Operational key_state state immediately after negotiation has completed while still within the handsh...
Control channel wrapping (–tls-auth/–tls-crypt) context.
struct buffer work
Work buffer (only for –tls-crypt)
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)
struct that stores the temporary data for the tls lite decrypt functions
struct buffer tls_crypt_v2_metadata
Received from client.
void ssl_set_auth_token(const char *token)
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.
const char * protocol_dump(struct buffer *buffer, unsigned int flags, struct gc_arena *gc)
Wrapper structure for dynamically allocated memory.
Security parameter state of a single session within a VPN tunnel.
bool tls_session_generate_data_channel_keys(struct tls_multi *multi, struct tls_session *session)
Generate data channel keys for the supplied TLS session.
void tls_auth_standalone_free(struct tls_auth_standalone *tas)
Frees a standalone tls-auth verification object.
Garbage collection arena used to keep track of dynamically allocated memory.
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...
struct tls_auth_standalone * tls_auth_standalone_init(struct tls_options *tls_options, struct gc_arena *gc)
void tls_multi_free(struct tls_multi *multi, bool clear)
Cleanup a tls_multi structure and free associated memory allocations.
static bool tls_initial_packet_received(const struct tls_multi *multi)
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)
Update TLS session crypto parameters (cipher and auth) and derive data channel keys based on the supp...
void free_buf(struct buffer *buf)
int n_sessions
Number of sessions negotiated thus far.
void pem_password_setup(const char *auth_file)
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_multi_init_finalize(struct tls_multi *multi, int tls_mtu)
Finalize initialization of a tls_multi structure.
struct tls_multi * tls_multi_init(struct tls_options *tls_options)
Allocate and initialize a tls_multi structure.
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.
Structure that wraps the TLS context.
void ssl_purge_auth_challenge(void)
void tls_update_remote_addr(struct tls_multi *multi, const struct link_socket_actual *addr)
Updates remote address in TLS sessions.
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.
bool ssl_clean_auth_token(void)
struct key_ctx_bi key_ctx_bi
OpenSSL cipher and HMAC contexts for both sending and receiving directions.
void tls_post_encrypt(struct tls_multi *multi, struct buffer *buf)
Perform some accounting for the key state used.
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.
struct packet_id packet_id
Current packet ID state for both sending and receiving directions.
struct buffer plaintext_read_buf
void tls_multi_init_set_options(struct tls_multi *multi, const char *local, const char *remote)
void packet_id_free(struct packet_id *p)
void auth_user_pass_setup(const char *auth_file, bool is_inline, const struct static_challenge_info *sc_info)
bool cleanup_key_ctx
opt.key_ctx_bi is owned by this context
Security parameter state for processing data channel packets.
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...