OpenVPN
|
Go to the source code of this file.
Data Structures | |
struct | buffer |
Wrapper structure for dynamically allocated memory. More... | |
struct | gc_entry |
Garbage collection entry for one dynamically allocated block of memory. More... | |
struct | gc_entry_special |
Garbage collection entry for a specially allocated structure that needs a custom free function to be freed like struct addrinfo. More... | |
struct | gc_arena |
Garbage collection arena used to keep track of dynamically allocated memory. More... | |
struct | buffer_entry |
struct | buffer_list |
Macros | |
#define | BUF_SIZE_MAX 1000000 |
#define | BPTR(buf) (buf_bptr(buf)) |
#define | BEND(buf) (buf_bend(buf)) |
#define | BLAST(buf) (buf_blast(buf)) |
#define | BLEN(buf) (buf_len(buf)) |
#define | BDEF(buf) (buf_defined(buf)) |
#define | BSTR(buf) (buf_str(buf)) |
#define | BCAP(buf) (buf_forward_capacity(buf)) |
#define | PA_BRACKET (1<<0) |
#define | buf_init(buf, offset) buf_init_dowork(buf, offset) |
#define | FHE_SPACE_BREAK_MASK 0xFF /* space_break parameter in lower 8 bits */ |
#define | FHE_CAPS 0x100 /* output hex in caps */ |
#define | CC_ANY (1<<0) |
any character More... | |
#define | CC_NULL (1<<1) |
null character \0 More... | |
#define | CC_ALNUM (1<<2) |
alphanumeric isalnum() More... | |
#define | CC_ALPHA (1<<3) |
alphabetic isalpha() More... | |
#define | CC_ASCII (1<<4) |
ASCII character. More... | |
#define | CC_CNTRL (1<<5) |
control character iscntrl() More... | |
#define | CC_DIGIT (1<<6) |
digit isdigit() More... | |
#define | CC_PRINT (1<<7) |
printable (>= 32, != 127) More... | |
#define | CC_PUNCT (1<<8) |
punctuation ispunct() More... | |
#define | CC_SPACE (1<<9) |
whitespace isspace() More... | |
#define | CC_XDIGIT (1<<10) |
hex digit isxdigit() More... | |
#define | CC_BLANK (1<<11) |
space or tab More... | |
#define | CC_NEWLINE (1<<12) |
newline More... | |
#define | CC_CR (1<<13) |
carriage return More... | |
#define | CC_BACKSLASH (1<<14) |
backslash More... | |
#define | CC_UNDERBAR (1<<15) |
underscore More... | |
#define | CC_DASH (1<<16) |
dash More... | |
#define | CC_DOT (1<<17) |
dot More... | |
#define | CC_COMMA (1<<18) |
comma More... | |
#define | CC_COLON (1<<19) |
colon More... | |
#define | CC_SLASH (1<<20) |
slash More... | |
#define | CC_SINGLE_QUOTE (1<<21) |
single quote More... | |
#define | CC_DOUBLE_QUOTE (1<<22) |
double quote More... | |
#define | CC_REVERSE_QUOTE (1<<23) |
reverse quote More... | |
#define | CC_AT (1<<24) |
at sign More... | |
#define | CC_EQUAL (1<<25) |
equal sign More... | |
#define | CC_LESS_THAN (1<<26) |
less than sign More... | |
#define | CC_GREATER_THAN (1<<27) |
greater than sign More... | |
#define | CC_PIPE (1<<28) |
pipe More... | |
#define | CC_QUESTION_MARK (1<<29) |
question mark More... | |
#define | CC_ASTERISK (1<<30) |
asterisk More... | |
#define | CC_NAME (CC_ALNUM|CC_UNDERBAR) |
alphanumeric plus underscore More... | |
#define | CC_CRLF (CC_CR|CC_NEWLINE) |
carriage return or newline More... | |
#define | verify_align_4(ptr) |
#define | ALLOC_OBJ(dptr, type) |
#define | ALLOC_OBJ_CLEAR(dptr, type) |
#define | ALLOC_ARRAY(dptr, type, n) |
#define | ALLOC_ARRAY_GC(dptr, type, n, gc) |
#define | ALLOC_ARRAY_CLEAR(dptr, type, n) |
#define | ALLOC_ARRAY_CLEAR_GC(dptr, type, n, gc) |
#define | ALLOC_VAR_ARRAY_CLEAR_GC(dptr, type, atype, n, gc) |
#define | ALLOC_OBJ_GC(dptr, type, gc) |
#define | ALLOC_OBJ_CLEAR_GC(dptr, type, gc) |
Functions | |
void | buf_clear (struct buffer *buf) |
void | free_buf (struct buffer *buf) |
bool | buf_assign (struct buffer *dest, const struct buffer *src) |
void | string_clear (char *str) |
int | string_array_len (const char **array) |
size_t | array_mult_safe (const size_t m1, const size_t m2, const size_t extra) |
char * | print_argv (const char **p, struct gc_arena *gc, const unsigned int flags) |
void | buf_size_error (const size_t size) |
struct buffer | alloc_buf (size_t size) |
struct buffer | alloc_buf_gc (size_t size, struct gc_arena *gc) |
struct buffer | clone_buf (const struct buffer *buf) |
void * | gc_malloc (size_t size, bool clear, struct gc_arena *a) |
char * | string_alloc (const char *str, struct gc_arena *gc) |
struct buffer | string_alloc_buf (const char *str, struct gc_arena *gc) |
void | gc_addspecial (void *addr, void(*free_function)(void *), struct gc_arena *a) |
void * | gc_realloc (void *ptr, size_t size, struct gc_arena *a) |
allows to realloc a pointer previously allocated by gc_malloc or gc_realloc More... | |
static void | gc_freeaddrinfo_callback (void *addr) |
static struct buffer | clear_buf (void) |
Return an empty struct buffer. More... | |
static bool | buf_defined (const struct buffer *buf) |
static bool | buf_valid (const struct buffer *buf) |
static uint8_t * | buf_bptr (const struct buffer *buf) |
static int | buf_len (const struct buffer *buf) |
static uint8_t * | buf_bend (const struct buffer *buf) |
static uint8_t * | buf_blast (const struct buffer *buf) |
static bool | buf_size_valid (const size_t size) |
static bool | buf_size_valid_signed (const int size) |
static char * | buf_str (const struct buffer *buf) |
static void | buf_reset (struct buffer *buf) |
static void | buf_reset_len (struct buffer *buf) |
static bool | buf_init_dowork (struct buffer *buf, int offset) |
static void | buf_set_write (struct buffer *buf, uint8_t *data, int size) |
static void | buf_set_read (struct buffer *buf, const uint8_t *data, size_t size) |
static void | strncpynt (char *dest, const char *src, size_t maxlen) |
static bool | has_digit (const char *src) |
static void | secure_memzero (void *data, size_t len) |
Securely zeroise memory. More... | |
bool | buf_printf (struct buffer *buf, const char *format,...) |
bool | buf_puts (struct buffer *buf, const char *str) |
void | buf_null_terminate (struct buffer *buf) |
void | buf_chomp (struct buffer *buf) |
void | buf_rmtail (struct buffer *buf, uint8_t remove) |
void | chomp (char *str) |
void | rm_trailing_chars (char *str, const char *what_to_delete) |
const char * | skip_leading_whitespace (const char *str) |
void | string_null_terminate (char *str, int len, int capacity) |
bool | buffer_write_file (const char *filename, const struct buffer *buf) |
Write buffer contents to file. More... | |
void | buf_catrunc (struct buffer *buf, const char *str) |
void | convert_to_one_line (struct buffer *buf) |
bool | buf_parse (struct buffer *buf, const int delim, char *line, const int size) |
char * | format_hex_ex (const uint8_t *data, int size, int maxoutput, unsigned int space_break_flags, const char *separator, struct gc_arena *gc) |
static char * | format_hex (const uint8_t *data, int size, int maxoutput, struct gc_arena *gc) |
struct buffer | buf_sub (struct buffer *buf, int size, bool prepend) |
static bool | buf_safe (const struct buffer *buf, size_t len) |
static bool | buf_safe_bidir (const struct buffer *buf, int len) |
static int | buf_forward_capacity (const struct buffer *buf) |
static int | buf_forward_capacity_total (const struct buffer *buf) |
static int | buf_reverse_capacity (const struct buffer *buf) |
static bool | buf_inc_len (struct buffer *buf, int inc) |
static uint8_t * | buf_prepend (struct buffer *buf, int size) |
static bool | buf_advance (struct buffer *buf, int size) |
static uint8_t * | buf_write_alloc (struct buffer *buf, size_t size) |
static uint8_t * | buf_write_alloc_prepend (struct buffer *buf, int size, bool prepend) |
static uint8_t * | buf_read_alloc (struct buffer *buf, int size) |
static bool | buf_write (struct buffer *dest, const void *src, size_t size) |
static bool | buf_write_prepend (struct buffer *dest, const void *src, int size) |
static bool | buf_write_u8 (struct buffer *dest, uint8_t data) |
static bool | buf_write_u16 (struct buffer *dest, uint16_t data) |
static bool | buf_write_u32 (struct buffer *dest, uint32_t data) |
static bool | buf_copy (struct buffer *dest, const struct buffer *src) |
static bool | buf_copy_n (struct buffer *dest, struct buffer *src, int n) |
static bool | buf_copy_range (struct buffer *dest, int dest_index, const struct buffer *src, int src_index, int src_len) |
static bool | buf_copy_excess (struct buffer *dest, struct buffer *src, int len) |
static bool | buf_read (struct buffer *src, void *dest, int size) |
static int | buf_read_u8 (struct buffer *buf) |
static int | buf_read_u16 (struct buffer *buf) |
static uint32_t | buf_read_u32 (struct buffer *buf, bool *good) |
static bool | buf_equal (const struct buffer *a, const struct buffer *b) |
Return true if buffer contents are equal. More... | |
static bool | buf_string_match (const struct buffer *src, const void *match, int size) |
Compare src buffer contents with match. More... | |
static bool | buf_string_match_head (const struct buffer *src, const void *match, int size) |
Compare first size bytes of src buffer contents with match. More... | |
bool | buf_string_match_head_str (const struct buffer *src, const char *match) |
bool | buf_string_compare_advance (struct buffer *src, const char *match) |
int | buf_substring_len (const struct buffer *buf, int delim) |
const char * | np (const char *str) |
bool | char_class (const unsigned char c, const unsigned int flags) |
bool | string_class (const char *str, const unsigned int inclusive, const unsigned int exclusive) |
bool | string_mod (char *str, const unsigned int inclusive, const unsigned int exclusive, const char replace) |
Modifies a string in place by replacing certain classes of characters of it with a specified character. More... | |
bool | string_check_buf (struct buffer *buf, const unsigned int inclusive, const unsigned int exclusive) |
Check a buffer if it only consists of allowed characters. More... | |
const char * | string_mod_const (const char *str, const unsigned int inclusive, const unsigned int exclusive, const char replace, struct gc_arena *gc) |
Returns a copy of a string with certain classes of characters of it replaced with a specified character. More... | |
void | string_replace_leading (char *str, const char match, const char replace) |
static bool | strprefix (const char *str, const char *prefix) |
Return true iff str starts with prefix. More... | |
void | gc_transfer (struct gc_arena *dest, struct gc_arena *src) |
void | x_gc_free (struct gc_arena *a) |
void | x_gc_freespecial (struct gc_arena *a) |
static bool | gc_defined (struct gc_arena *a) |
static void | gc_init (struct gc_arena *a) |
static void | gc_detach (struct gc_arena *a) |
static struct gc_arena | gc_new (void) |
static void | gc_free (struct gc_arena *a) |
static void | gc_reset (struct gc_arena *a) |
static void | check_malloc_return (void *p) |
struct buffer_list * | buffer_list_new (void) |
Allocate an empty buffer list of capacity max_size . More... | |
void | buffer_list_free (struct buffer_list *ol) |
Frees a buffer list and all the buffers in it. More... | |
bool | buffer_list_defined (const struct buffer_list *ol) |
Checks if the list is valid and non-empty. More... | |
void | buffer_list_reset (struct buffer_list *ol) |
Empty the list ol and frees all the contained buffers. More... | |
void | buffer_list_push (struct buffer_list *ol, const char *str) |
Allocates and appends a new buffer containing str as data to ol . More... | |
struct buffer_entry * | buffer_list_push_data (struct buffer_list *ol, const void *data, size_t size) |
Allocates and appends a new buffer containing data of length size . More... | |
struct buffer * | buffer_list_peek (struct buffer_list *ol) |
Retrieve the head buffer. More... | |
void | buffer_list_advance (struct buffer_list *ol, int n) |
void | buffer_list_pop (struct buffer_list *ol) |
void | buffer_list_aggregate (struct buffer_list *bl, const size_t max) |
Aggregates as many buffers as possible from bl in a new buffer of maximum length max_len . More... | |
void | buffer_list_aggregate_separator (struct buffer_list *bl, const size_t max_len, const char *sep) |
Aggregates as many buffers as possible from bl in a new buffer of maximum length max_len . More... | |
struct buffer_list * | buffer_list_file (const char *fn, int max_line_len) |
struct buffer | buffer_read_from_file (const char *filename, struct gc_arena *gc) |
buffer_read_from_file - copy the content of a file into a buffer More... | |
#define ALLOC_ARRAY | ( | dptr, | |
type, | |||
n | |||
) |
#define ALLOC_ARRAY_CLEAR | ( | dptr, | |
type, | |||
n | |||
) |
#define ALLOC_ARRAY_CLEAR_GC | ( | dptr, | |
type, | |||
n, | |||
gc | |||
) |
#define ALLOC_ARRAY_GC | ( | dptr, | |
type, | |||
n, | |||
gc | |||
) |
#define ALLOC_OBJ | ( | dptr, | |
type | |||
) |
#define ALLOC_OBJ_CLEAR | ( | dptr, | |
type | |||
) |
#define ALLOC_OBJ_CLEAR_GC | ( | dptr, | |
type, | |||
gc | |||
) |
#define ALLOC_OBJ_GC | ( | dptr, | |
type, | |||
gc | |||
) |
#define ALLOC_VAR_ARRAY_CLEAR_GC | ( | dptr, | |
type, | |||
atype, | |||
n, | |||
gc | |||
) |
#define BCAP | ( | buf | ) | (buf_forward_capacity(buf)) |
#define BDEF | ( | buf | ) | (buf_defined(buf)) |
#define buf_init | ( | buf, | |
offset | |||
) | buf_init_dowork(buf, offset) |
#define CC_CRLF (CC_CR|CC_NEWLINE) |
#define CC_NAME (CC_ALNUM|CC_UNDERBAR) |
#define FHE_SPACE_BREAK_MASK 0xFF /* space_break parameter in lower 8 bits */ |
struct buffer alloc_buf | ( | size_t | size | ) |
Definition at line 62 of file buffer.c.
References buf_size_error(), buf_size_valid(), buffer::capacity, check_malloc_return(), buffer::data, buffer::len, and buffer::offset.
Referenced by alloc_buf_sock_tun(), auth_token_init_secret(), buffer_list_aggregate_separator(), buffer_list_push_data(), check_inline_file(), command_line_new(), fragment_frame_init(), fragment_list_buf_init(), init_context_buffers(), init_tas_auth(), init_tas_crypt(), key_state_init(), management_query_cert(), management_query_pk_sig(), mutate_ncp_cipher_list(), openvpn_PRF(), options_string(), read_inline_file(), reliable_init(), send_line_crlf(), status_open(), stream_buf_init(), test_generate_reset_packet_plain(), test_parse_ack(), test_tls_crypt_setup(), test_tls_decrypt_lite_auth(), test_tls_decrypt_lite_crypt(), test_tls_decrypt_lite_none(), test_verify_hmac_none(), test_verify_hmac_tls_auth(), tls_crypt_v2_extract_client_key(), tls_crypt_v2_init_client_key(), tls_session_generate_dynamic_tls_crypt_key(), tls_session_init(), tun_show_debug(), and tuntap_dhcp_mask().
Definition at line 88 of file buffer.c.
References buf_size_error(), buf_size_valid(), buffer::capacity, buffer::data, gc_malloc(), buffer::len, and buffer::offset.
Referenced by __wrap_buffer_read_from_file(), add_option(), buffer_read_from_file(), ce_management_query_proxy(), ce_management_query_remote(), check_incoming_control_channel(), construct_name_value(), crypto_pem_encode(), dco_version_string(), do_data_channel_round_trip(), do_init_frame_tls(), fork_dhcp_action(), fork_register_dns_action(), format_common_name(), format_hex_ex(), format_ip_addr_string(), format_route_entry(), frame_print(), generate_auth_token(), get_device_guid(), get_unspecified_device_guid(), get_user_pass_cr(), hostname_randomize(), ifconfig_options_string(), ifconfig_pool_read(), ipset2ascii_all(), link_socket_connection_initiated(), log_entry_print(), management_callback_send_cc_message(), management_hold(), management_query_multiline(), management_query_user_pass(), mroute_addr_print_ex(), mroute_helper_regenerate(), msg_flags_string(), multi_instance_string(), netsh_get_id(), ntlm_phase_1(), options_string_compat_lzo(), options_string_version(), options_warning_safe_ml(), p2p_mode_ncp(), packet_id_net_print(), packet_id_persist_print(), platform_gen_path(), plugin_mask_string(), prepare_push_reply(), prepend_dir(), print_argv(), print_default_gateway(), print_in_port_t(), print_key_id(), print_link_socket_actual_ex(), print_netmask(), print_opt_route(), print_opt_route_gateway(), print_opt_route_gateway_dhcp(), print_opt_topology(), print_sockaddr_ex(), print_str(), print_str_int(), proto2ascii_all(), protocol_dump(), push_peer_info(), read_control_auth(), reliable_ack_print(), route_string(), send_auth_failed(), send_auth_pending_messages(), send_push_reply(), send_push_reply_auth_token(), server_pushed_info(), setenv_format_indexed_name(), setenv_route(), setenv_route_addr(), setenv_route_ipv6(), socket_stat(), strerror_win32(), system_error_message(), tap_win_getinfo(), test_buffer_free_gc_one(), test_buffer_free_gc_two(), test_buffer_printf_catrunc(), test_character_string_mod_buf(), test_crypto(), test_tls_crypt_v2_setup(), time_string(), tls_crypt_v2_wrap_client_key(), tls_crypt_v2_wrap_unwrap_dst_too_small(), tls_crypt_v2_wrap_unwrap_max_metadata(), tls_crypt_v2_wrap_unwrap_no_metadata(), tls_crypt_v2_write_client_key_file(), tun_stat(), tv_string(), username_password_as_base64(), verify_cert(), wide_cmd_line(), win32_version_string(), window_title_generate(), write_key_file(), write_outgoing_tls_ciphertext(), x509_get_sha1_fingerprint(), and x509_get_sha256_fingerprint().
size_t array_mult_safe | ( | const size_t | m1, |
const size_t | m2, | ||
const size_t | extra | ||
) |
|
inlinestatic |
Definition at line 623 of file buffer.h.
References buf_valid(), buffer::len, and buffer::offset.
Referenced by buf_copy_excess(), buf_read_u8(), buf_string_compare_advance(), buffer_list_advance(), check_incoming_control_channel(), do_pre_decrypt_check(), handle_data_channel_packet(), is_ipv_X(), key_method_2_read(), link_socket_write_post_size_adjust(), mss_fixup_ipv4(), mss_fixup_ipv6(), openvpn_decrypt_aead(), openvpn_decrypt_v1(), parse_auth_pending_keywords(), parse_early_negotiation_tlvs(), process_received_occ_msg(), read_control_auth(), receive_cr_response(), server_pushed_info(), server_pushed_signal(), test_parse_ack(), test_tls_crypt_secure_reneg_key(), tls_crypt_unwrap(), tls_crypt_v2_extract_client_key(), tls_crypt_v2_unwrap_client_key(), tls_pre_decrypt(), tls_pre_decrypt_lite(), and vlan_decapsulate().
Definition at line 173 of file buffer.c.
References BLEN, BPTR, buf_init, buf_write(), and buffer::offset.
Referenced by buffer_turnover().
|
inlinestatic |
Definition at line 266 of file buffer.h.
References buf_bptr(), and buf_len().
|
inlinestatic |
Definition at line 272 of file buffer.h.
References buf_bptr(), and buf_len().
|
inlinestatic |
Definition at line 240 of file buffer.h.
References buf_valid(), buffer::data, and buffer::offset.
Referenced by buf_bend(), buf_blast(), buf_str(), management_query_cert(), and management_query_pk_sig().
void buf_catrunc | ( | struct buffer * | buf, |
const char * | str | ||
) |
Definition at line 287 of file buffer.c.
References buf_forward_capacity(), buf_forward_capacity_total(), buffer::capacity, buffer::data, and buffer::len.
Referenced by format_hex_ex(), and test_buffer_printf_catrunc().
void buf_chomp | ( | struct buffer * | buf | ) |
Definition at line 572 of file buffer.c.
References BLAST, buf_inc_len(), buf_null_terminate(), CC_CRLF, CC_NULL, and char_class().
Referenced by command_line_get(), and key_state_check_auth_pending_file().
void buf_clear | ( | struct buffer * | buf | ) |
Definition at line 162 of file buffer.c.
References buffer::capacity, buffer::data, buffer::len, buffer::offset, and secure_memzero().
Referenced by command_line_add(), command_line_next(), command_line_reset(), do_close_free_key_schedule(), key_method_2_read(), openvpn_PRF(), read_control_auth(), read_inline_file(), read_key_file(), read_pem_key_file(), tls_crypt_fail_msg_too_long(), tls_crypt_fail_replay(), tls_crypt_ignore_replay(), tls_crypt_loopback_max_len(), tls_crypt_loopback_zero_len(), tls_crypt_v2_unwrap_client_key(), tls_crypt_v2_write_client_key_file(), tls_print_deferred_options_results(), write_key_file(), and write_pem_key_file().
Definition at line 717 of file buffer.h.
References BLEN, BPTR, and buf_write().
Referenced by buf_copy_excess(), buffer_list_aggregate_separator(), command_line_next(), fragment_outgoing(), read_control_auth(), read_inline_file(), send_hmac_reset_packet(), socket_send_queue(), stream_buf_read_setup_dowork(), tls_crypt_v2_unwrap_client_key(), tls_crypt_v2_wrap_client_key(), tls_pre_decrypt(), tls_rec_payload(), tls_wrap_control(), and tun_write_queue().
Definition at line 758 of file buffer.h.
References buf_advance(), buf_copy(), and buffer::len.
Referenced by command_line_get(), and stream_buf_added().
Definition at line 723 of file buffer.h.
References buf_read_alloc(), and buf_write().
Referenced by fragment_ready_to_send(), ipv6_send_icmp_unreachable(), and write_outgoing_tls_ciphertext().
|
inlinestatic |
Definition at line 734 of file buffer.h.
References buffer::capacity, buffer::data, buffer::len, and buffer::offset.
Referenced by fragment_incoming().
|
inlinestatic |
Definition at line 228 of file buffer.h.
References buffer::data.
Referenced by buf_printf(), recv_line(), socks_process_outgoing_udp(), status_close(), status_flush(), status_read(), stream_buf_get_final(), and stream_buf_get_next().
Return true if buffer contents are equal.
Definition at line 842 of file buffer.h.
Referenced by tls_crypt_v2_wrap_unwrap_max_metadata().
|
inlinestatic |
Definition at line 546 of file buffer.h.
References buf_valid(), buffer::capacity, buffer::len, and buffer::offset.
Referenced by bio_read(), buf_catrunc(), buf_printf(), buf_puts(), mutate_ncp_cipher_list(), and tls_crypt_v2_wrap_client_key().
|
inlinestatic |
Definition at line 564 of file buffer.h.
References buf_valid(), buffer::capacity, and buffer::offset.
Referenced by buf_catrunc(), and read_control_auth().
|
inlinestatic |
Definition at line 595 of file buffer.h.
References buf_safe_bidir(), and buffer::len.
Referenced by buf_chomp(), buf_null_terminate(), buffer_read_from_file(), generate_ephemeral_key(), openvpn_decrypt_aead(), openvpn_decrypt_v1(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), status_read(), test_character_string_mod_buf(), tls_crypt_unwrap(), tls_crypt_v2_extract_client_key(), tls_crypt_v2_unwrap_client_key(), tls_crypt_v2_wrap_client_key(), tls_crypt_v2_wrap_too_long_metadata(), tls_crypt_v2_write_client_key_file(), tls_crypt_wrap(), x509_get_sha1_fingerprint(), and x509_get_sha256_fingerprint().
|
inlinestatic |
Definition at line 319 of file buffer.h.
References buffer::capacity, buffer::data, buffer::len, and buffer::offset.
|
static |
Definition at line 253 of file buffer.h.
References buf_valid(), and buffer::len.
Referenced by add_delim_if_non_empty(), buf_bend(), buf_blast(), command_line_new(), do_init_tls_wrap_key(), mutate_ncp_cipher_list(), parse_early_negotiation_tlvs(), prepare_push_reply(), test_tls_crypt_secure_reneg_key(), tls_crypt_unwrap(), tls_crypt_v2_unwrap_client_key(), tls_print_deferred_options_results(), and write_outgoing_tls_ciphertext().
void buf_null_terminate | ( | struct buffer * | buf | ) |
Definition at line 551 of file buffer.c.
References BLAST, buf_inc_len(), buf_safe(), and buf_write_u8().
Referenced by buf_chomp(), buffer_read_from_file(), mutate_ncp_cipher_list(), and status_read().
bool buf_parse | ( | struct buffer * | buf, |
const int | delim, | ||
char * | line, | ||
const int | size | ||
) |
Definition at line 843 of file buffer.c.
References ASSERT, and buf_read_u8().
Referenced by apply_push_options(), get_user_pass_cr(), ifconfig_pool_read(), in_src_get(), make_inline_array(), man_kill(), man_output_peer_info_env(), options_warning_extract_parm1(), options_warning_safe_scan1(), options_warning_safe_scan2(), output_peer_info_env(), parse_auth_challenge(), parse_auth_pending_keywords(), push_update_digest(), and read_config_string().
|
inlinestatic |
Definition at line 611 of file buffer.h.
References BPTR, buf_valid(), buffer::len, and buffer::offset.
Referenced by buf_sub(), buf_write_alloc_prepend(), buf_write_prepend(), openvpn_encrypt_v1(), and vlan_encapsulate().
bool buf_printf | ( | struct buffer * | buf, |
const char * | format, | ||
... | |||
) |
Definition at line 240 of file buffer.c.
References BEND, buf_defined(), buf_forward_capacity(), buffer::capacity, buffer::data, and buffer::len.
Referenced by add_delim_if_non_empty(), add_option(), ce_management_query_proxy(), ce_management_query_remote(), check_inline_file(), construct_name_value(), dco_version_string(), fork_dhcp_action(), fork_register_dns_action(), format_common_name(), format_hex_ex(), format_ip_addr_string(), format_route_entry(), frame_print(), get_device_guid(), get_unspecified_device_guid(), get_user_pass_cr(), hostname_randomize(), ifconfig_options_string(), ipset2ascii_all(), link_socket_connection_initiated(), log_entry_print(), management_callback_send_cc_message(), management_hold(), management_query_multiline(), management_query_user_pass(), mroute_addr_print_ex(), mroute_helper_regenerate(), msg_flags_string(), multi_instance_string(), ntlm_phase_1(), options_string(), options_string_compat_lzo(), options_warning_safe_ml(), p2p_mode_ncp(), packet_id_net_print(), packet_id_persist_print(), platform_gen_path(), plugin_mask_string(), prepare_push_reply(), prepend_dir(), print_argv(), print_default_gateway(), print_in_port_t(), print_key_id(), print_link_socket_actual_ex(), print_netmask(), print_opt_route(), print_opt_route_gateway(), print_opt_route_gateway_dhcp(), print_opt_topology(), print_sockaddr_ex(), print_str(), print_str_int(), proto2ascii_all(), protocol_dump(), push_peer_info(), read_inline_file(), reliable_ack_print(), route_string(), send_auth_failed(), send_auth_pending_messages(), send_push_options(), send_push_reply(), send_push_reply_auth_token(), server_pushed_info(), setenv_format_indexed_name(), setenv_route(), setenv_route_addr(), setenv_route_ipv6(), setenv_str_safe(), socket_stat(), strerror_win32(), system_error_message(), test_buffer_printf_catrunc(), time_string(), tls_print_deferred_options_results(), tun_stat(), tv_string(), username_password_as_base64(), verify_cert(), wide_cmd_line(), win32_print_arch(), win32_version_string(), window_title_generate(), and write_key_file().
bool buf_puts | ( | struct buffer * | buf, |
const char * | str | ||
) |
Definition at line 267 of file buffer.c.
References BEND, buf_forward_capacity(), buffer::capacity, buffer::data, buffer::len, and strncpynt().
Referenced by mutate_ncp_cipher_list(), and print_sockaddr_ex().
|
inlinestatic |
Definition at line 783 of file buffer.h.
References buf_read_alloc().
Referenced by auth_token_init_secret(), buf_read_u16(), buf_read_u32(), fragment_incoming(), key_source2_read(), packet_id_read(), protocol_dump(), read_key(), read_string(), read_string_alloc(), reliable_ack_parse(), reliable_ack_print(), reliable_ack_read_packet_id(), session_id_read(), socks_process_incoming_udp(), stream_buf_added(), and tls_crypt_v2_init_client_key().
|
inlinestatic |
Definition at line 659 of file buffer.h.
References BPTR, buffer::len, and buffer::offset.
Referenced by buf_copy_n(), and buf_read().
|
inlinestatic |
Definition at line 808 of file buffer.h.
References buf_read().
Referenced by parse_early_negotiation_tlvs(), process_received_occ_msg(), read_string(), read_string_alloc(), and socks_process_incoming_udp().
|
inlinestatic |
Definition at line 819 of file buffer.h.
References buf_read().
|
inlinestatic |
Definition at line 795 of file buffer.h.
References BLEN, BPTR, and buf_advance().
Referenced by buf_parse(), buf_substring_len(), key_method_2_read(), parse_auth_pending_keywords(), process_incoming_push_reply(), process_received_occ_msg(), receive_cr_response(), server_pushed_info(), server_pushed_signal(), socks_process_incoming_udp(), status_read(), and tls_crypt_v2_verify_metadata().
|
inlinestatic |
Definition at line 303 of file buffer.h.
References buffer::capacity, buffer::data, buffer::len, and buffer::offset.
Referenced by multi_process_drop_outgoing_tun(), multi_tcp_process_outgoing_link(), process_incoming_link_part1(), process_incoming_link_part2(), process_incoming_tun(), process_outgoing_link(), process_outgoing_tun(), status_open(), and stream_buf_reset().
|
inlinestatic |
Definition at line 312 of file buffer.h.
References buffer::len, and buffer::offset.
Referenced by multi_process_incoming_tun(), send_hmac_reset_packet(), send_push_options(), send_push_reply(), test_parse_ack(), test_tls_decrypt_lite_auth(), test_tls_decrypt_lite_crypt(), test_tls_decrypt_lite_none(), test_verify_hmac_none(), and test_verify_hmac_tls_auth().
|
inlinestatic |
Definition at line 582 of file buffer.h.
References buf_valid(), and buffer::offset.
Referenced by vlan_encapsulate().
void buf_rmtail | ( | struct buffer * | buf, |
uint8_t | remove | ||
) |
Definition at line 536 of file buffer.c.
References BLAST, and buffer::len.
|
inlinestatic |
Definition at line 525 of file buffer.h.
References buf_size_valid(), buf_valid(), buffer::capacity, buffer::len, and buffer::offset.
Referenced by alloc_buf_sock_tun(), buf_null_terminate(), buf_write_alloc(), build_dhcp_options_string(), check_ping_send_dowork(), check_send_occ_msg_dowork(), ipv6_send_icmp_unreachable(), openvpn_decrypt_aead(), openvpn_decrypt_v1(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), push_peer_info(), read_incoming_tun(), read_inline_file(), stream_buf_set_next(), tls_crypt_unwrap(), tls_crypt_wrap(), write_dhcp_search_str(), write_dhcp_str(), write_dhcp_u32_array(), and write_dhcp_u8().
|
inlinestatic |
Definition at line 532 of file buffer.h.
References buf_size_valid_signed(), buf_valid(), buffer::capacity, buffer::len, and buffer::offset.
Referenced by buf_inc_len().
|
inlinestatic |
Definition at line 348 of file buffer.h.
References buf_size_error(), buf_size_valid(), buffer::capacity, buffer::data, buffer::len, and buffer::offset.
Referenced by crypto_pem_encode_decode_loopback(), get_user_pass_cr(), make_inline_array(), man_kill(), man_output_peer_info_env(), openvpn_decrypt_v1(), output_peer_info_env(), parse_auth_challenge(), read_config_string(), read_key_file(), read_pem_key_file(), string_alloc_buf(), and write_pem_key_file().
|
inlinestatic |
Definition at line 331 of file buffer.h.
References buf_size_error(), buf_size_valid(), buffer::capacity, buffer::data, buffer::len, and buffer::offset.
Referenced by crypto_pem_encode_decode_loopback(), get_device_guid(), get_unspecified_device_guid(), get_user_pass_cr(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), setenv_str_safe(), tls_crypt_v2_init_server_key(), tls_crypt_v2_unwrap_client_key(), and tls_print_deferred_options_results().
void buf_size_error | ( | const size_t | size | ) |
Definition at line 53 of file buffer.c.
Referenced by alloc_buf(), alloc_buf_gc(), buf_set_read(), and buf_set_write().
|
inlinestatic |
Definition at line 285 of file buffer.h.
References BUF_SIZE_MAX, and likely.
Referenced by alloc_buf(), alloc_buf_gc(), buf_safe(), buf_set_read(), and buf_set_write().
|
inlinestatic |
Definition at line 291 of file buffer.h.
References BUF_SIZE_MAX, and likely.
Referenced by buf_safe_bidir().
|
inlinestatic |
Definition at line 297 of file buffer.h.
References buf_bptr().
Referenced by mutate_ncp_cipher_list(), and prepare_push_reply().
bool buf_string_compare_advance | ( | struct buffer * | src, |
const char * | match | ||
) |
Definition at line 807 of file buffer.c.
References buf_advance(), and buf_string_match_head_str().
Referenced by process_incoming_push_msg(), and receive_auth_failed().
|
inlinestatic |
Compare src buffer contents with match.
NOT constant time. Do not use when comparing HMACs.
Definition at line 852 of file buffer.h.
References BPTR, and buffer::len.
Referenced by is_ping_msg().
|
inlinestatic |
Compare first size bytes of src buffer contents with match.
NOT constant time. Do not use when comparing HMACs.
Definition at line 866 of file buffer.h.
References BPTR, and buffer::len.
Referenced by is_occ_msg().
bool buf_string_match_head_str | ( | const struct buffer * | src, |
const char * | match | ||
) |
Definition at line 796 of file buffer.c.
References BPTR, and buffer::len.
Referenced by buf_string_compare_advance(), parse_incoming_control_channel_command(), and receive_auth_failed().
Definition at line 221 of file buffer.c.
References buf_prepend(), buf_write_alloc(), buffer::capacity, CLEAR, and buffer::data.
Referenced by reliable_ack_write(), and socks_process_outgoing_udp().
int buf_substring_len | ( | const struct buffer * | buf, |
int | delim | ||
) |
Definition at line 821 of file buffer.c.
References buf_read_u8().
Referenced by command_line_get().
|
inlinestatic |
Definition at line 234 of file buffer.h.
References buffer::data, buffer::len, and likely.
Referenced by buf_advance(), buf_bptr(), buf_forward_capacity(), buf_forward_capacity_total(), buf_len(), buf_prepend(), buf_reverse_capacity(), buf_safe(), buf_safe_bidir(), connection_entry_preload_key(), read_key_file(), and read_pem_key_file().
|
inlinestatic |
Definition at line 673 of file buffer.h.
References buf_write_alloc().
Referenced by __wrap_buffer_read_from_file(), buf_assign(), buf_copy(), buf_copy_n(), buf_write_u16(), buf_write_u32(), buf_write_u8(), buffer_list_aggregate_separator(), check_incoming_control_channel(), check_ping_send_dowork(), check_send_occ_msg_dowork(), crypto_pem_encode(), generate_auth_token(), management_query_cert(), management_query_pk_sig(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), openvpn_PRF(), options_string_compat_lzo(), packet_id_write(), random_bytes_to_buf(), read_wintun(), reliable_ack_write(), send_line_crlf(), session_id_write(), socks_process_outgoing_udp(), test_character_string_mod_buf(), test_parse_ack(), test_tls_crypt_setup(), test_tls_decrypt_lite_auth(), test_tls_decrypt_lite_crypt(), test_tls_decrypt_lite_none(), test_verify_hmac_none(), test_verify_hmac_tls_auth(), tls_crypt_v2_wrap_client_key(), tls_crypt_v2_write_client_key_file(), tls_reset_standalone(), tls_wrap_control(), write_dhcp_search_str(), write_dhcp_str(), write_key(), and write_string().
|
inlinestatic |
Definition at line 640 of file buffer.h.
References BPTR, buf_safe(), and buffer::len.
Referenced by buf_sub(), buf_write(), buf_write_alloc_prepend(), crypto_pem_decode(), do_data_channel_round_trip(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), test_crypto(), tls_crypt_fail_msg_too_long(), tls_crypt_loopback_max_len(), tls_crypt_v2_wrap_client_key(), tls_crypt_v2_wrap_unwrap_dst_too_small(), tls_crypt_v2_wrap_unwrap_max_metadata(), and tls_crypt_wrap().
|
inlinestatic |
Definition at line 653 of file buffer.h.
References buf_prepend(), and buf_write_alloc().
|
inlinestatic |
Definition at line 685 of file buffer.h.
References buf_prepend().
Referenced by fragment_prepend_flags(), ipv6_send_icmp_unreachable(), link_socket_write_tcp(), openvpn_encrypt_v1(), packet_id_write(), reliable_mark_active_outgoing(), session_id_write_prepend(), tls_prepend_opcode_v1(), tls_prepend_opcode_v2(), and tls_wrap_control().
|
inlinestatic |
Definition at line 703 of file buffer.h.
References buf_write(), and buffer::data.
Referenced by check_send_occ_msg_dowork(), socks_process_outgoing_udp(), tls_reset_standalone(), write_empty_string(), and write_string().
|
inlinestatic |
Definition at line 710 of file buffer.h.
References buf_write(), and buffer::data.
Referenced by build_dhcp_options_string(), key_method_2_write(), tls_reset_standalone(), and write_dhcp_u32_array().
|
inlinestatic |
Definition at line 697 of file buffer.h.
References buf_write(), and buffer::data.
Referenced by buf_null_terminate(), build_dhcp_options_string(), check_send_occ_msg_dowork(), command_line_add(), generate_auth_token(), key_method_2_write(), recv_line(), reliable_ack_write(), socks_process_outgoing_udp(), status_read(), tls_reset_standalone(), write_dhcp_search_str(), write_dhcp_str(), write_dhcp_u32_array(), and write_dhcp_u8().
void buffer_list_advance | ( | struct buffer_list * | ol, |
int | n | ||
) |
Definition at line 1339 of file buffer.c.
References ASSERT, BLEN, buffer_entry::buf, buf_advance(), buffer_list_pop(), and buffer_list::head.
Referenced by man_write().
void buffer_list_aggregate | ( | struct buffer_list * | bl, |
const size_t | max | ||
) |
Aggregates as many buffers as possible from bl
in a new buffer of maximum length max_len
.
All the aggregated buffers are removed from the list and replaced by the new one, followed by any additional (non-aggregated) data.
bl | the list of buffer to aggregate |
max | the maximum length of the aggregated buffer |
Definition at line 1316 of file buffer.c.
References buffer_list_aggregate_separator().
Referenced by man_write(), and management_query_multiline_flatten().
void buffer_list_aggregate_separator | ( | struct buffer_list * | bl, |
const size_t | max_len, | ||
const char * | sep | ||
) |
Aggregates as many buffers as possible from bl
in a new buffer of maximum length max_len
.
sep
is written after each copied buffer (also after the last one). All the aggregated buffers are removed from the list and replaced by the new one, followed by any additional (non-aggregated) data. Nothing happens if max_len
is not enough to aggregate at least 2 buffers.
bl | the list of buffer to aggregate |
max_len | the maximum length of the aggregated buffer |
sep | the separator to put between buffers during aggregation |
Definition at line 1270 of file buffer.c.
References alloc_buf(), ALLOC_OBJ_CLEAR, BLEN, buffer_entry::buf, buf_copy(), buf_write(), http-client::f, free_buf(), buffer_list::head, buffer_entry::next, buffer_list::size, and buffer_list::tail.
Referenced by buffer_list_aggregate(), management_query_multiline_flatten_newline(), test_buffer_list_aggregate_separator_all(), test_buffer_list_aggregate_separator_empty(), test_buffer_list_aggregate_separator_emptybuffers(), test_buffer_list_aggregate_separator_noop(), test_buffer_list_aggregate_separator_nosep(), test_buffer_list_aggregate_separator_two(), and test_buffer_list_aggregate_separator_zerolen().
bool buffer_list_defined | ( | const struct buffer_list * | ol | ) |
Checks if the list is valid and non-empty.
ol | the list to check |
ol
is not NULL and contains at least one buffer Definition at line 1195 of file buffer.c.
References buffer_list::head.
Referenced by man_update_io_state(), management_query_multiline_flatten(), and management_query_multiline_flatten_newline().
struct buffer_list* buffer_list_file | ( | const char * | fn, |
int | max_line_len | ||
) |
Definition at line 1353 of file buffer.c.
References buffer_list_new(), buffer_list_push(), and platform_fopen().
Referenced by key_state_check_auth_pending_file().
void buffer_list_free | ( | struct buffer_list * | ol | ) |
Frees a buffer list and all the buffers in it.
ol | the list to free |
Definition at line 1185 of file buffer.c.
References buffer_list_reset().
Referenced by in_extra_dispatch(), in_extra_reset(), key_state_check_auth_pending_file(), key_state_free(), man_connection_close(), management_client_auth(), management_query_multiline_flatten(), management_query_multiline_flatten_newline(), set_cc_config(), and test_buffer_list_teardown().
struct buffer_list* buffer_list_new | ( | void | ) |
Allocate an empty buffer list of capacity max_size
.
Definition at line 1176 of file buffer.c.
References ALLOC_OBJ_CLEAR, and buffer_list::size.
Referenced by buffer_list_file(), in_extra_reset(), man_connection_init(), test_buffer_list_setup(), and tls_send_payload().
struct buffer* buffer_list_peek | ( | struct buffer_list * | ol | ) |
Retrieve the head buffer.
ol | the list to retrieve the buffer from |
Definition at line 1257 of file buffer.c.
References buffer_entry::buf, and buffer_list::head.
Referenced by flush_payload_buffer(), man_write(), management_query_multiline_flatten(), management_query_multiline_flatten_newline(), test_buffer_list_aggregate_separator_all(), test_buffer_list_aggregate_separator_emptybuffers(), test_buffer_list_aggregate_separator_noop(), test_buffer_list_aggregate_separator_nosep(), test_buffer_list_aggregate_separator_two(), and test_buffer_list_aggregate_separator_zerolen().
void buffer_list_pop | ( | struct buffer_list * | ol | ) |
Definition at line 1322 of file buffer.c.
References buffer_entry::buf, free_buf(), buffer_list::head, buffer_entry::next, buffer_list::size, and buffer_list::tail.
Referenced by buffer_list_advance(), and flush_payload_buffer().
void buffer_list_push | ( | struct buffer_list * | ol, |
const char * | str | ||
) |
Allocates and appends a new buffer containing str
as data to ol
.
ol | the list to append the new buffer to |
str | the string to copy into the new buffer |
Definition at line 1216 of file buffer.c.
References buffer_entry::buf, buffer_list_push_data(), and buffer::len.
Referenced by buffer_list_file(), man_output_list_push_str(), man_read(), and test_buffer_list_setup().
struct buffer_entry* buffer_list_push_data | ( | struct buffer_list * | ol, |
const void * | data, | ||
size_t | size | ||
) |
Allocates and appends a new buffer containing data
of length size
.
ol | the list to append the new buffer to |
data | the data to copy into the new buffer |
size | the length of data to copy into the buffer |
Definition at line 1230 of file buffer.c.
References alloc_buf(), ALLOC_OBJ_CLEAR, ASSERT, buffer_entry::buf, buffer::data, buffer_list::head, buffer::len, buffer_entry::next, buffer_list::size, and buffer_list::tail.
Referenced by buffer_list_push(), test_buffer_list_setup(), and tls_send_payload().
void buffer_list_reset | ( | struct buffer_list * | ol | ) |
Empty the list ol
and frees all the contained buffers.
ol | the list to reset |
Definition at line 1201 of file buffer.c.
References buffer_entry::buf, free_buf(), buffer_list::head, buffer_entry::next, buffer_list::size, and buffer_list::tail.
Referenced by buffer_list_free(), man_new_connection_post(), man_read(), and man_reset_client_socket().
buffer_read_from_file - copy the content of a file into a buffer
file | path to the file to read |
gc | the garbage collector to use when allocating the buffer. It is passed to alloc_buf_gc() and therefore can be NULL. |
Definition at line 1376 of file buffer.c.
References alloc_buf_gc(), ASSERT, BPTR, buf_inc_len(), buf_null_terminate(), cleanup(), free_buf_gc(), platform_fopen(), and platform_stat().
Referenced by connection_entry_preload_key(), crypto_pem_encode_certificate(), key_state_check_auth_failed_message_file(), read_key_file(), and read_pem_key_file().
bool buffer_write_file | ( | const char * | filename, |
const struct buffer * | buf | ||
) |
Write buffer contents to file.
filename | The filename to write the buffer to. |
buf | The buffer to write to the file. |
Definition at line 318 of file buffer.c.
References BLEN, BPTR, cleanup(), M_ERRNO, msg, platform_open(), and write.
Referenced by tls_crypt_v2_verify_metadata(), tls_crypt_v2_write_client_key_file(), write_key_file(), and write_pem_key_file().
bool char_class | ( | const unsigned char | c, |
const unsigned int | flags | ||
) |
Definition at line 895 of file buffer.c.
References CC_ALNUM, CC_ALPHA, CC_ANY, CC_ASCII, CC_ASTERISK, CC_AT, CC_BACKSLASH, CC_BLANK, CC_CNTRL, CC_COLON, CC_COMMA, CC_CR, CC_DASH, CC_DIGIT, CC_DOT, CC_DOUBLE_QUOTE, CC_EQUAL, CC_GREATER_THAN, CC_LESS_THAN, CC_NEWLINE, CC_NULL, CC_PIPE, CC_PRINT, CC_PUNCT, CC_QUESTION_MARK, CC_REVERSE_QUOTE, CC_SINGLE_QUOTE, CC_SLASH, CC_SPACE, CC_UNDERBAR, and CC_XDIGIT.
Referenced by buf_chomp(), char_inc_exc(), and command_line_add().
|
inlinestatic |
Definition at line 1108 of file buffer.h.
References out_of_memory().
Referenced by alloc_buf(), cipher_ctx_new(), clone_buf(), do_setenv_x509(), env_block(), gc_addspecial(), gc_malloc(), gc_realloc(), hmac_ctx_new(), load_xkey_provider(), management_callback_remote_entry_get(), management_query_multiline_flatten(), management_query_multiline_flatten_newline(), md_ctx_new(), read_string_alloc(), string_alloc(), tls_ctx_use_external_rsa_key(), wide_cmd_line(), and x509_setenv().
void chomp | ( | char * | str | ) |
Definition at line 632 of file buffer.c.
References rm_trailing_chars().
Referenced by establish_http_proxy_passthru(), get_console_input(), get_console_input_win32(), get_proxy_authenticate(), get_user_pass_cr(), make_inline_array(), man_output_peer_info_env(), output_peer_info_env(), and status_printf().
|
inlinestatic |
Return an empty struct buffer.
Definition at line 222 of file buffer.h.
Referenced by do_data_channel_round_trip(), get_device_guid(), get_unspecified_device_guid(), management_query_multiline(), read_control_auth(), test_crypto(), tls_wrap_control(), and write_pem_key_file().
Definition at line 115 of file buffer.c.
References BLEN, BPTR, buffer::capacity, check_malloc_return(), buffer::data, buffer::len, and buffer::offset.
Referenced by mbuf_alloc_buf(), and tls_pre_decrypt_lite().
void convert_to_one_line | ( | struct buffer * | buf | ) |
Definition at line 303 of file buffer.c.
References BLEN, BPTR, and buffer::len.
|
inlinestatic |
Definition at line 510 of file buffer.h.
References format_hex_ex().
Referenced by check_incoming_control_channel(), establish_http_proxy_passthru(), generate_key_random(), init_key_ctx(), key_print(), key_source_print(), openvpn_decrypt_aead(), openvpn_decrypt_v1(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), protocol_dump(), session_id_print(), tls_crypt_unwrap(), tls_crypt_v2_unwrap_client_key(), tls_crypt_v2_wrap_client_key(), tls_crypt_wrap(), and tuntap_dhcp_mask().
char* format_hex_ex | ( | const uint8_t * | data, |
int | size, | ||
int | maxoutput, | ||
unsigned int | space_break_flags, | ||
const char * | separator, | ||
struct gc_arena * | gc | ||
) |
Definition at line 501 of file buffer.c.
References alloc_buf_gc(), buf_catrunc(), buf_printf(), buffer::data, FHE_CAPS, FHE_SPACE_BREAK_MASK, and static_assert.
Referenced by backend_x509_get_serial_hex(), backend_x509_get_username(), export_user_keying_material(), format_hex(), hostname_randomize(), mroute_addr_print_ex(), print_default_gateway(), push_peer_info(), read_key_file(), show_adapter(), show_settings(), test_buffer_format_hex_ex(), verify_cert(), verify_cert_set_env(), write_key_file(), and x509_setenv_track().
void free_buf | ( | struct buffer * | buf | ) |
Definition at line 183 of file buffer.c.
References CLEAR, and buffer::data.
Referenced by auth_token_init_secret(), buffer_list_aggregate_separator(), buffer_list_pop(), buffer_list_reset(), check_inline_file(), command_line_free(), do_close_free_key_schedule(), fragment_free(), fragment_list_buf_free(), free_context_buffers(), free_tas(), free_tls_pre_decrypt_state(), key_state_free(), link_socket_close(), management_query_cert(), management_query_pk_sig(), mbuf_free_buf(), mutate_ncp_cipher_list(), openvpn_PRF(), overlapped_io_close(), read_inline_file(), reliable_free(), send_line_crlf(), status_close(), stream_buf_close(), test_generate_reset_packet_plain(), test_parse_ack(), test_tls_crypt_teardown(), test_tls_decrypt_lite_auth(), test_tls_decrypt_lite_crypt(), test_tls_decrypt_lite_none(), test_verify_hmac_none(), test_verify_hmac_tls_auth(), tls_crypt_v2_write_client_key_file(), tls_wrap_free(), tun_show_debug(), and tuntap_dhcp_mask().
void gc_addspecial | ( | void * | addr, |
void(*)(void *) | free_function, | ||
struct gc_arena * | a | ||
) |
Definition at line 456 of file buffer.c.
References gc_entry_special::addr, ASSERT, check_malloc_return(), gc_entry_special::free_fnc, gc_arena::list_special, and gc_entry_special::next.
Referenced by do_preresolve_host(), gc_realloc(), and init_route_list().
|
inlinestatic |
Definition at line 1011 of file buffer.h.
References gc_arena::list.
|
inlinestatic |
Definition at line 1024 of file buffer.h.
References gc_init().
Referenced by inherit_context_top(), and options_detach().
|
inlinestatic |
Definition at line 1038 of file buffer.h.
References gc_arena::list, gc_arena::list_special, x_gc_free(), and x_gc_freespecial().
Referenced by adapter_index_of_ip(), add_option(), add_route(), add_route_ipapi(), add_route_ipv6(), argv_free(), argv_msg(), argv_msg_prefix(), argv_str__empty_argv__empty_output(), argv_str__multiple_argv__correct_output(), backend_x509_get_username(), ccs_gen_config_file(), ccs_gen_deferred_ret_file(), ce_management_query_proxy(), ce_management_query_remote(), check_addr_clash(), check_auth_pending_method(), check_file_access_chroot(), check_for_client_reason(), check_incoming_control_channel(), check_stale_routes(), check_subnet_conflict(), clear_route_ipv6_list(), clear_route_list(), close_instance(), close_tun(), context_gc_free(), crypto_pem_encode_certificate(), crypto_pem_encode_decode_loopback(), del_route_ipapi(), delete_route(), delete_route_ipv6(), delete_temp_addresses(), dhcp_extract_router_msg(), dhcp_masq_addr(), dhcp_release_by_adapter_index(), dhcp_renew_by_adapter_index(), dhcp_status(), do_address_service(), do_close_tun(), do_compute_occ_strings(), do_data_channel_round_trip(), do_dns_domain_service(), do_dns_service(), do_ifconfig_ipv4(), do_ifconfig_ipv6(), do_ifconfig_setenv(), do_open_tun(), do_pre_decrypt_check(), do_route_service(), do_set_mtu_service(), do_wins_service(), drop_if_recursive_routing(), ecdsa_sign_sig(), establish_http_proxy_passthru(), export_user_keying_material(), fork_dhcp_action(), fork_register_dns_action(), frame_print(), gc_reset(), generate_auth_token(), generate_key_random(), generate_prefix(), get_adapter_index_method_2(), get_bypass_addresses(), get_default_gateway(), get_default_gateway_ipv6(), get_default_gateway_row(), get_p2p_ncp_cipher(), get_user_pass_cr(), handle_data_channel_packet(), helper_client_server(), ifconfig_pool_init(), ifconfig_pool_list(), ifconfig_pool_read(), ifconfig_pool_verify_range(), ifconfig_sanity_check(), incoming_push_message(), init_key_ctx(), init_route_ipv6_list(), init_route_list(), init_ssl(), init_static(), ip_addr_string_to_array(), key_method_2_read(), key_print(), key_source_print(), key_state_gen_auth_control_files(), learn_address_script(), link_socket_bad_incoming_addr(), link_socket_connection_initiated(), linksock_print_addr(), man_connect(), man_dispatch_command(), man_history(), man_io_error(), man_kill(), man_listen(), man_new_connection_post(), man_output_extra_env(), man_process_command(), management_callback_send_cc_message(), management_echo(), management_hold(), management_learn_addr(), management_notify_client_cr_response(), management_query_multiline(), management_query_user_pass(), management_set_state(), mroute_extract_addr_ip(), mroute_helper_regenerate(), multi_add_iroutes(), multi_client_connect_call_script(), multi_client_connect_late_setup(), multi_client_connect_setenv(), multi_client_connect_source_ccd(), multi_client_set_protocol_options(), multi_create_instance(), multi_create_instance_tcp(), multi_get_create_instance_udp(), multi_get_instance_by_virtual_addr(), multi_instance_dec_refcount(), multi_learn_addr(), multi_print_status(), multi_process_float(), multi_process_incoming_link(), multi_reap_range(), multi_select_virtual_addr(), multi_tcp_post(), ncp_get_best_cipher(), netsh_ifconfig(), netsh_ifconfig_options(), netsh_set_dns6_servers(), open_tun(), openvpn_decrypt_aead(), openvpn_decrypt_v1(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), openvpn_execve(), openvpn_execve_check(), openvpn_getaddrinfo(), openvpn_popen(), options_cmp_equal_safe(), options_warning_extract_parm1(), options_warning_safe_ml(), options_warning_safe_scan1(), options_warning_safe_scan2(), p2p_mode_ncp(), packet_id_persist_load(), packet_id_persist_save(), parse_auth_failed_temp(), parse_hash_fingerprint_multiline(), platform_access(), platform_chdir(), platform_fopen(), platform_open(), platform_stat(), platform_unlink(), plugin_call_item(), plugin_call_ssl(), plugin_common_open(), plugin_init_item(), plugin_open_item(), plugin_option_list_print(), plugin_vlog(), pre_connect_restore(), print_client_nat_list(), print_default_gateway(), print_key_id_not_found_reason(), print_pkt(), print_route(), print_status(), process_incoming_link_part1(), process_incoming_push_request(), process_incoming_tun(), process_outgoing_link(), push_peer_info(), read_control_auth(), read_key_file(), read_pem_key_file(), recv_socks_reply(), redirect_stdout_stderr(), register_dns_service(), reliable_ack_read(), reliable_can_get(), reliable_can_send(), reliable_get_buf_output_sequenced(), reliable_get_num_output_sequenced_available(), reliable_not_replay(), reliable_send_timeout(), reliable_wont_break_sequentiality(), remove_iroutes_from_push_route_list(), resolve_bind_local(), resolve_remote(), route_ipv6_ipapi(), route_quota_exceeded(), run_up_down(), send_auth_failed(), send_auth_pending_messages(), send_control_channel_string_dowork(), send_msg_iservice(), send_push_reply(), send_push_reply_auth_token(), server_pushed_info(), service_enable_dhcp(), service_register_ring_buffers(), session_move_pre_start(), setenv_dns_options(), setenv_int_i(), setenv_route(), setenv_route_addr(), setenv_route_ipv6(), setenv_str_ex(), setenv_str_i(), show_adapters(), show_dco_version(), show_dhcp_option_addrs(), show_dns_options(), show_p2mp_parms(), show_routes(), show_settings(), show_tap_win_adapters(), show_windows_version(), socket_bind(), socket_connect(), socket_do_listen(), socket_listen_accept(), socket_recv_queue(), socket_send_queue(), tap_allow_nonadmin_access(), tcp_connection_established(), test_buffer_format_hex_ex(), test_buffer_free_gc_one(), test_buffer_free_gc_two(), test_buffer_gc_realloc(), test_buffer_printf_catrunc(), test_character_string_mod_buf(), test_check_ncp_ciphers_list(), test_cipher_names(), test_compat_lzo_string(), test_crypto(), test_extract_client_ciphers(), test_list(), test_local_addr(), test_mssfix_mtu_calculation(), test_ncp_best(), test_occ_mtu_calculation(), test_poor_man(), test_routes(), test_tls_crypt_secure_reneg_key(), test_tls_crypt_v2_teardown(), tls_authentication_status(), tls_crypt_unwrap(), tls_crypt_v2_unwrap_client_key(), tls_crypt_v2_verify_metadata(), tls_crypt_v2_write_client_key_file(), tls_crypt_wrap(), tls_ctx_set_tls_groups(), tls_multi_process(), tls_pre_decrypt(), tls_pre_decrypt_lite(), tls_pre_encrypt(), tls_session_init(), tls_update_remote_addr(), trigger_ping_timeout_signal(), tun_read_queue(), tun_write_queue(), tuntap_dhcp_mask(), tuntap_set_ip_addr(), tuntap_set_ptp(), undo_ifconfig_ipv4(), undo_ifconfig_ipv6(), uninit_options(), verify_255_255_255_252(), verify_callback(), verify_cert(), verify_cert_call_command(), verify_cert_set_env(), verify_check_crl_dir(), verify_common_subnet(), verify_crresponse_script(), verify_final_auth_checks(), verify_user_pass_script(), virtual_output_callback_func(), warn_on_use_of_common_subnets(), win32_signal_open(), win_wfp_block_service(), win_wfp_msg_handler(), window_title_generate(), windows_route_find_if_index(), write_key_file(), write_outgoing_tls_ciphertext(), write_pem_key_file(), x509_setenv_track(), x_check_status(), and x_msg_va().
|
inlinestatic |
Definition at line 215 of file buffer.h.
Referenced by do_preresolve_host(), and init_route_list().
|
inlinestatic |
Definition at line 1017 of file buffer.h.
References gc_arena::list, and gc_arena::list_special.
Referenced by gc_detach(), gc_new(), init_instance(), init_options(), openvpn_decrypt_aead(), openvpn_decrypt_v1(), openvpn_encrypt_aead(), openvpn_encrypt_v1(), openvpn_main(), plugin_vlog(), tls_crypt_unwrap(), tls_crypt_wrap(), and x_msg_va().
void* gc_malloc | ( | size_t | size, |
bool | clear, | ||
struct gc_arena * | a | ||
) |
Definition at line 354 of file buffer.c.
References check_malloc_return(), gc_arena::list, and gc_entry::next.
Referenced by add_route_ipv6(), alloc_buf_gc(), append_cipher_to_ncp_list(), argv_prep_format(), argv_printf_arglist(), delete_route_ipv6(), ecdsa_sign_sig(), establish_http_proxy_passthru(), export_user_keying_material(), get_adapter_info_list(), get_device_instance_id_interface(), get_interface_info_list(), get_ipv6_addr_no_netbits(), get_panel_reg(), get_per_adapter_info(), get_user_pass_cr(), get_windows_routing_table(), options_string_extract_option(), options_warning_extract_parm1(), options_warning_safe_scan1(), options_warning_safe_scan2(), parse_auth_challenge(), parse_line(), plugin_vlog(), print_in6_addr(), print_in_addr_t(), route_ipv6_ipapi(), sanitize_control_message(), setenv_str_incr(), string_alloc(), string_substitute(), utf16to8(), wide_cmd_line(), wide_string(), x509_get_subject(), and x_msg_va().
|
inlinestatic |
Definition at line 1030 of file buffer.h.
References gc_init().
Referenced by adapter_index_of_ip(), add_option(), add_route(), add_route_ipapi(), add_route_ipv6(), argv_init(), argv_msg(), argv_msg_prefix(), argv_str__empty_argv__empty_output(), argv_str__multiple_argv__correct_output(), backend_x509_get_username(), ccs_gen_config_file(), ccs_gen_deferred_ret_file(), ce_management_query_proxy(), ce_management_query_remote(), check_addr_clash(), check_auth_pending_method(), check_file_access_chroot(), check_for_client_reason(), check_incoming_control_channel(), check_stale_routes(), check_subnet_conflict(), close_tun(), crypto_pem_encode_certificate(), crypto_pem_encode_decode_loopback(), del_route_ipapi(), delete_route(), delete_route_ipv6(), delete_temp_addresses(), dhcp_extract_router_msg(), dhcp_masq_addr(), dhcp_release_by_adapter_index(), dhcp_renew_by_adapter_index(), dhcp_status(), do_address_service(), do_close_tun(), do_compute_occ_strings(), do_data_channel_round_trip(), do_dns_domain_service(), do_dns_service(), do_ifconfig_ipv4(), do_ifconfig_ipv6(), do_ifconfig_setenv(), do_open_tun(), do_pre_decrypt_check(), do_route_service(), do_set_mtu_service(), do_wins_service(), drop_if_recursive_routing(), ecdsa_sign_sig(), establish_http_proxy_passthru(), export_user_keying_material(), fork_dhcp_action(), fork_register_dns_action(), frame_print(), generate_auth_token(), generate_key_random(), generate_prefix(), get_adapter_index_method_2(), get_bypass_addresses(), get_default_gateway(), get_default_gateway_ipv6(), get_default_gateway_row(), get_p2p_ncp_cipher(), get_user_pass_cr(), handle_data_channel_packet(), helper_client_server(), ifconfig_pool_init(), ifconfig_pool_list(), ifconfig_pool_read(), ifconfig_pool_verify_range(), ifconfig_sanity_check(), incoming_push_message(), inherit_context_child(), init_key_ctx(), init_route_ipv6_list(), init_route_list(), init_ssl(), init_static(), ip_addr_string_to_array(), key_method_2_read(), key_print(), key_source_print(), key_state_gen_auth_control_files(), learn_address_script(), link_socket_bad_incoming_addr(), link_socket_connection_initiated(), linksock_print_addr(), man_connect(), man_dispatch_command(), man_history(), man_io_error(), man_kill(), man_listen(), man_new_connection_post(), man_output_extra_env(), man_process_command(), management_callback_send_cc_message(), management_echo(), management_hold(), management_learn_addr(), management_notify_client_cr_response(), management_query_multiline(), management_query_user_pass(), management_set_state(), mroute_extract_addr_ip(), mroute_helper_regenerate(), multi_add_iroutes(), multi_client_connect_call_script(), multi_client_connect_late_setup(), multi_client_connect_setenv(), multi_client_connect_source_ccd(), multi_client_set_protocol_options(), multi_create_instance(), multi_create_instance_tcp(), multi_get_create_instance_udp(), multi_get_instance_by_virtual_addr(), multi_learn_addr(), multi_print_status(), multi_process_float(), multi_process_incoming_link(), multi_reap_range(), multi_select_virtual_addr(), multi_tcp_post(), ncp_get_best_cipher(), netsh_ifconfig(), netsh_ifconfig_options(), netsh_set_dns6_servers(), open_tun(), openvpn_execve(), openvpn_execve_check(), openvpn_getaddrinfo(), openvpn_popen(), options_cmp_equal_safe(), options_warning_extract_parm1(), options_warning_safe_ml(), options_warning_safe_scan1(), options_warning_safe_scan2(), p2p_mode_ncp(), packet_id_persist_load(), packet_id_persist_save(), parse_auth_failed_temp(), parse_hash_fingerprint_multiline(), platform_access(), platform_chdir(), platform_fopen(), platform_open(), platform_stat(), platform_unlink(), plugin_call_item(), plugin_call_ssl(), plugin_common_open(), plugin_init_item(), plugin_open_item(), plugin_option_list_print(), pre_connect_restore(), print_client_nat_list(), print_default_gateway(), print_key_id_not_found_reason(), print_pkt(), print_route(), print_status(), process_incoming_link_part1(), process_incoming_push_request(), process_incoming_tun(), process_outgoing_link(), push_peer_info(), read_control_auth(), read_key_file(), read_pem_key_file(), recv_socks_reply(), redirect_stdout_stderr(), register_dns_service(), reliable_ack_read(), reliable_can_get(), reliable_can_send(), reliable_get_buf_output_sequenced(), reliable_get_num_output_sequenced_available(), reliable_not_replay(), reliable_send_timeout(), reliable_wont_break_sequentiality(), remove_iroutes_from_push_route_list(), resolve_bind_local(), resolve_remote(), route_ipv6_ipapi(), route_quota_exceeded(), run_up_down(), send_auth_failed(), send_auth_pending_messages(), send_control_channel_string_dowork(), send_msg_iservice(), send_push_reply(), send_push_reply_auth_token(), server_pushed_info(), service_enable_dhcp(), service_register_ring_buffers(), session_move_pre_start(), setenv_dns_options(), setenv_int_i(), setenv_route(), setenv_route_addr(), setenv_route_ipv6(), setenv_str_ex(), setenv_str_i(), show_adapters(), show_dco_version(), show_dhcp_option_addrs(), show_dns_options(), show_p2mp_parms(), show_routes(), show_settings(), show_tap_win_adapters(), show_windows_version(), socket_bind(), socket_connect(), socket_do_listen(), socket_listen_accept(), socket_recv_queue(), socket_send_queue(), tap_allow_nonadmin_access(), tcp_connection_established(), test_buffer_format_hex_ex(), test_buffer_free_gc_one(), test_buffer_free_gc_two(), test_buffer_gc_realloc(), test_buffer_printf_catrunc(), test_character_string_mod_buf(), test_check_ncp_ciphers_list(), test_cipher_names(), test_compat_lzo_string(), test_crypto(), test_extract_client_ciphers(), test_list(), test_local_addr(), test_mssfix_mtu_calculation(), test_ncp_best(), test_occ_mtu_calculation(), test_poor_man(), test_routes(), test_tls_crypt_secure_reneg_key(), test_tls_crypt_v2_setup(), tls_authentication_status(), tls_crypt_v2_unwrap_client_key(), tls_crypt_v2_verify_metadata(), tls_crypt_v2_write_client_key_file(), tls_ctx_set_tls_groups(), tls_multi_process(), tls_pre_decrypt(), tls_pre_decrypt_lite(), tls_pre_encrypt(), tls_session_init(), tls_update_remote_addr(), trigger_ping_timeout_signal(), tun_read_queue(), tun_write_queue(), tuntap_dhcp_mask(), tuntap_set_ip_addr(), tuntap_set_ptp(), undo_ifconfig_ipv4(), undo_ifconfig_ipv6(), verify_255_255_255_252(), verify_callback(), verify_cert(), verify_cert_call_command(), verify_cert_set_env(), verify_check_crl_dir(), verify_common_subnet(), verify_crresponse_script(), verify_final_auth_checks(), verify_user_pass_script(), virtual_output_callback_func(), warn_on_use_of_common_subnets(), win32_signal_open(), win_wfp_block_service(), win_wfp_msg_handler(), window_title_generate(), windows_route_find_if_index(), windows_set_mtu(), write_key_file(), write_outgoing_tls_ciphertext(), write_pem_key_file(), x509_setenv_track(), and x_check_status().
void* gc_realloc | ( | void * | ptr, |
size_t | size, | ||
struct gc_arena * | a | ||
) |
allows to realloc a pointer previously allocated by gc_malloc or gc_realloc
ptr | Pointer of the previously allocated memory |
size | New size |
a | gc_arena to use |
Definition at line 388 of file buffer.c.
References gc_entry_special::addr, ASSERT, check_malloc_return(), gc_addspecial(), gc_arena::list_special, and gc_entry_special::next.
Referenced by alloc_connection_entry(), alloc_remote_entry(), and test_buffer_gc_realloc().
|
inlinestatic |
Definition at line 478 of file buffer.c.
References gc_arena::list, and gc_entry::next.
Referenced by add_option().
|
inlinestatic |
Definition at line 372 of file buffer.h.
Referenced by tun_name_is_fixed().
char* print_argv | ( | const char ** | p, |
struct gc_arena * | gc, | ||
const unsigned int | flags | ||
) |
Definition at line 735 of file buffer.c.
References alloc_buf_gc(), BSTR, buf_printf(), and PA_BRACKET.
Referenced by argv_str(), plugin_open_item(), plugin_option_list_print(), and push_options().
void rm_trailing_chars | ( | char * | str, |
const char * | what_to_delete | ||
) |
|
inlinestatic |
Securely zeroise memory.
This code and description are based on code supplied by Zhaomo Yang, of the University of California, San Diego (which was released into the public domain).
The secure_memzero function attempts to ensure that an optimizing compiler does not remove the intended operation if cleared memory is not accessed again by the program. This code has been tested under Clang 3.9.0 and GCC 6.2 with optimization flags -O, -Os, -O0, -O1, -O2, and -O3 on Ubuntu 16.04.1 LTS; under Clang 3.9.0 with optimization flags -O, -Os, -O0, -O1, -O2, and -O3 on FreeBSD 10.2-RELEASE; under Microsoft Visual Studio 2015 with optimization flags /O1, /O2 and /Ox on Windows 10.
Theory of operation:
data | Pointer to data to zeroise. |
len | Length of data, in bytes. |
Definition at line 414 of file buffer.h.
Referenced by buf_clear(), crypto_read_openvpn_key(), export_user_keying_material(), generate_key_expansion(), generate_key_expansion_openvpn_prf(), key_method_2_read(), key_method_2_write(), key_state_export_keying_material(), key_state_free(), management_query_user_pass(), move_session(), purge_user_pass(), read_config_file(), read_config_string(), read_inline_file(), remove_env_item(), socks_username_password_auth(), string_clear(), tls_crypt_v2_extract_client_key(), tls_crypt_v2_init_server_key(), tls_crypt_v2_unwrap_client_key(), tls_crypt_v2_write_client_key_file(), tls_multi_free(), tls_session_free(), tls_session_generate_data_channel_keys(), tls_session_generate_dynamic_tls_crypt_key(), tls_wrap_free(), wipe_auth_token(), write_key_file(), and write_pem_key_file().
const char* skip_leading_whitespace | ( | const char * | str | ) |
Definition at line 597 of file buffer.c.
Referenced by make_inline_array().
char* string_alloc | ( | const char * | str, |
struct gc_arena * | gc | ||
) |
Definition at line 667 of file buffer.c.
References check_malloc_return(), and gc_malloc().
Referenced by add_env_item(), argv_clone(), argv_insert_head(), argv_parse_cmd(), auth_set_client_reason(), backend_x509_get_serial(), ccs_gen_config_file(), ccs_gen_deferred_ret_file(), check_file_access(), check_inline_file(), cipher_kt_block_size(), clone_push_list(), do_close_tun(), do_init_route_ipv6_list(), extract_var_peer_info(), fork_to_self(), generate_auth_token(), get_device_instance_id_interface(), get_ipv6_addr_no_netbits(), get_p2p_ncp_cipher(), get_pa_var(), get_panel_reg(), get_proxy_authenticate(), get_tap_reg(), ifconfig_pool_acquire(), ifconfig_pool_set(), init_options_dev(), key_method_2_read(), key_state_gen_auth_control_files(), log_history_add(), make_arg_array(), make_base64_string2(), make_inline_array(), management_callback_proxy_cmd(), mutate_ncp_cipher_list(), ncp_get_best_cipher(), open_null(), open_syslog(), options_warning_extract_parm1(), parse_auth_challenge(), parse_auth_failed_temp(), parse_hash_fingerprint_multiline(), parse_http_proxy_override(), push_option_fmt(), read_inline_file(), set_common_name(), set_win_sys_path(), ssl_put_auth_challenge(), status_open(), string_alloc_buf(), string_mod_const(), test_cipher_names(), test_list(), tls_ctx_set_tls_groups(), tls_item_in_cipher_list(), tls_lock_common_name(), tls_lock_username(), tls_poor_mans_ncp(), and tun_open_device().
Definition at line 770 of file buffer.c.
References ASSERT, buf_set_read(), buffer::len, and string_alloc().
Referenced by options_warning_extract_parm1().
int string_array_len | ( | const char ** | array | ) |
Definition at line 721 of file buffer.c.
Referenced by make_arg_copy(), make_extended_arg_array(), no_more_than_n_args(), and openvpn_plugin_open_v3().
bool string_check_buf | ( | struct buffer * | buf, |
const unsigned int | inclusive, | ||
const unsigned int | exclusive | ||
) |
Check a buffer if it only consists of allowed characters.
buf | The buffer to be checked. |
inclusive | The character classes that are allowed. |
exclusive | Character classes that are not allowed even if they are also in inclusive. |
Definition at line 1091 of file buffer.c.
References ASSERT, BLEN, BSTR, and char_inc_exc().
Referenced by check_incoming_control_channel(), and test_character_string_mod_buf().
bool string_class | ( | const char * | str, |
const unsigned int | inclusive, | ||
const unsigned int | exclusive | ||
) |
Definition at line 1040 of file buffer.c.
References ASSERT, and char_inc_exc().
Referenced by dns_addr_safe(), openvpn_inet_aton(), push_option_ex(), and wide_cmd_line().
void string_clear | ( | char * | str | ) |
Definition at line 709 of file buffer.c.
References secure_memzero().
Referenced by do_init_crypto_tls_c1(), get_user_pass_cr(), and openvpn_plugin_string_list_item_free().
bool string_mod | ( | char * | str, |
const unsigned int | inclusive, | ||
const unsigned int | exclusive, | ||
const char | replace | ||
) |
Modifies a string in place by replacing certain classes of characters of it with a specified character.
Guaranteed to not increase the length of the string. If replace is 0, characters are skipped instead of replaced.
str | The string to be modified. |
inclusive | The character classes not to be replaced. |
exclusive | Character classes to be replaced even if they are also in inclusive. |
replace | The character to replace the specified character classes with. |
Definition at line 1059 of file buffer.c.
References ASSERT, and char_inc_exc().
Referenced by do_setenv_x509(), get_user_pass_cr(), string_mod_const(), string_mod_remap_name(), test_character_class(), verify_user_pass(), wide_cmd_line(), and x509_setenv().
const char* string_mod_const | ( | const char * | str, |
const unsigned int | inclusive, | ||
const unsigned int | exclusive, | ||
const char | replace, | ||
struct gc_arena * | gc | ||
) |
Returns a copy of a string with certain classes of characters of it replaced with a specified character.
If replace is 0, characters are skipped instead of replaced.
str | The input string to be modified. |
inclusive | Character classes not to be replaced. |
exclusive | Character classes to be replaced even if they are also in inclusive. |
replace | The character to replace the specified character classes with. |
gc | The garbage collector arena to allocate memory from. |
Definition at line 1108 of file buffer.c.
References string_alloc(), and string_mod().
Referenced by platform_gen_path(), safe_print(), and setenv_str_ex().
void string_null_terminate | ( | char * | str, |
int | len, | ||
int | capacity | ||
) |
Definition at line 615 of file buffer.c.
References ASSERT, buffer::capacity, and buffer::len.
Referenced by get_console_input_win32().
void string_replace_leading | ( | char * | str, |
const char | match, | ||
const char | replace | ||
) |
|
inlinestatic |
Definition at line 361 of file buffer.h.
Referenced by buf_puts(), check_send_auth_token(), do_dns_domain_service(), do_set_mtu_service(), EVP_PKEY_get_group_name(), extract_x509_field_ssl(), generate_prefix(), get_highest_preference_tls_cipher(), get_user_pass_cr(), key_method_2_write(), man_query_user_pass(), management_callback_remote_cmd(), options_string_version(), pem_password_callback(), set_auth_token(), and socks_proxy_new().
|
inlinestatic |
Return true iff str starts with prefix.
Definition at line 982 of file buffer.h.
Referenced by options_warning_safe_scan2(), push_update_digest(), and test_buffer_strprefix().
void x_gc_free | ( | struct gc_arena * | a | ) |
Definition at line 421 of file buffer.c.
References gc_arena::list, and gc_entry::next.
Referenced by gc_free().
void x_gc_freespecial | ( | struct gc_arena * | a | ) |
Definition at line 440 of file buffer.c.
References gc_entry_special::addr, gc_entry_special::free_fnc, gc_arena::list_special, and gc_entry_special::next.
Referenced by gc_free().