OpenVPN
|
#include "syshead.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <setjmp.h>
#include <cmocka.h>
#include "crypto.h"
#include "options.h"
#include "ssl_backend.h"
#include "options_util.h"
#include "mock_msg.h"
#include "mss.h"
#include "ssl_verify_backend.h"
#include "win32.h"
#include "test_common.h"
#include "ssl.h"
#include "buffer.h"
#include "packet_id.h"
Go to the source code of this file.
Functions | |
const char * | strerror_win32 (DWORD errnum, struct gc_arena *gc) |
void | throw_signal (const int signum) |
Throw a hard signal. More... | |
static const char * | get_tmp_dir (void) |
static void | crypto_pem_encode_certificate (void **state) |
static void | init_implicit_iv (struct crypto_options *co) |
static void | init_frame_parameters (struct frame *frame) |
static void | do_data_channel_round_trip (struct crypto_options *co) |
struct crypto_options | init_crypto_options (const char *cipher, const char *auth) |
static void | uninit_crypto_options (struct crypto_options *co) |
static void | run_data_channel_with_cipher (const char *cipher, const char *auth) |
static void | test_data_channel_roundtrip_aes_128_gcm (void **state) |
static void | test_data_channel_roundtrip_aes_192_gcm (void **state) |
static void | test_data_channel_roundtrip_aes_256_gcm (void **state) |
static void | test_data_channel_roundtrip_aes_128_cbc (void **state) |
static void | test_data_channel_roundtrip_aes_192_cbc (void **state) |
static void | test_data_channel_roundtrip_aes_256_cbc (void **state) |
static void | test_data_channel_roundtrip_chacha20_poly1305 (void **state) |
static void | test_data_channel_roundtrip_bf_cbc (void **state) |
int | main (void) |
Variables | |
struct signal_info | siginfo_static |
const char * | unittest_cert |
|
static |
Definition at line 97 of file test_ssl.c.
References backend_x509_write_pem(), BSTR, buffer_read_from_file(), tls_root_ctx::ctx, gc_free(), gc_new(), get_tmp_dir(), platform_create_temp_file(), tls_ctx_client_new(), tls_ctx_free(), tls_ctx_load_cert_file(), and unittest_cert.
Referenced by main().
|
static |
Definition at line 180 of file test_ssl.c.
References alloc_buf_gc(), ASSERT, BLEN, BPTR, frame::buf, buf_init, BUF_SIZE, buf_write_alloc(), buffer::capacity, clear_buf(), gc_free(), gc_new(), frame::headroom, init_frame_parameters(), init_implicit_iv(), buffer::len, openvpn_decrypt(), openvpn_encrypt(), frame::payload_size, rand_bytes(), and update_time().
Referenced by run_data_channel_with_cipher().
|
static |
Definition at line 84 of file test_ssl.c.
References win_get_tempdir().
Referenced by crypto_pem_encode_certificate().
struct crypto_options init_crypto_options | ( | const char * | cipher, |
const char * | auth | ||
) |
Definition at line 241 of file test_ssl.c.
References ASSERT, key_type::cipher, key::cipher, create_kt(), key::hmac, init_key_ctx_bi(), crypto_options::key_ctx_bi, key2::keys, key2::n, crypto_options::packet_id, packet_id_init(), and rand_bytes().
Referenced by run_data_channel_with_cipher().
|
static |
Definition at line 149 of file test_ssl.c.
References ACK_SIZE, frame::buf, frame::headroom, frame::payload_size, RELIABLE_ACK_SIZE, frame::tailroom, and frame::tun_mtu.
Referenced by do_data_channel_round_trip().
|
static |
Definition at line 127 of file test_ssl.c.
References ASSERT, key_ctx::cipher, cipher_ctx_iv_length(), cipher_ctx_mode_aead(), key_ctx_bi::decrypt, key_ctx_bi::encrypt, key_ctx::implicit_iv, key_ctx::implicit_iv_len, crypto_options::key_ctx_bi, OPENVPN_AEAD_MIN_IV_LEN, OPENVPN_MAX_IV_LENGTH, and rand_bytes().
Referenced by do_data_channel_round_trip().
int main | ( | void | ) |
Definition at line 337 of file test_ssl.c.
References crypto_pem_encode_certificate(), openvpn_unit_test_setup(), test_data_channel_roundtrip_aes_128_cbc(), test_data_channel_roundtrip_aes_128_gcm(), test_data_channel_roundtrip_aes_192_cbc(), test_data_channel_roundtrip_aes_192_gcm(), test_data_channel_roundtrip_aes_256_cbc(), test_data_channel_roundtrip_aes_256_gcm(), test_data_channel_roundtrip_bf_cbc(), test_data_channel_roundtrip_chacha20_poly1305(), tls_free_lib(), and tls_init_lib().
|
static |
Definition at line 270 of file test_ssl.c.
References do_data_channel_round_trip(), init_crypto_options(), and uninit_crypto_options().
Referenced by test_data_channel_roundtrip_aes_128_cbc(), test_data_channel_roundtrip_aes_128_gcm(), test_data_channel_roundtrip_aes_192_cbc(), test_data_channel_roundtrip_aes_192_gcm(), test_data_channel_roundtrip_aes_256_cbc(), test_data_channel_roundtrip_aes_256_gcm(), test_data_channel_roundtrip_bf_cbc(), and test_data_channel_roundtrip_chacha20_poly1305().
const char* strerror_win32 | ( | DWORD | errnum, |
struct gc_arena * | gc | ||
) |
Definition at line 57 of file test_ssl.c.
References alloc_buf_gc(), ASSERT, BSTR, buf_printf(), SIZE, status, and utf16to8().
|
static |
Definition at line 296 of file test_ssl.c.
References run_data_channel_with_cipher().
Referenced by main().
|
static |
Definition at line 278 of file test_ssl.c.
References run_data_channel_with_cipher().
Referenced by main().
|
static |
Definition at line 302 of file test_ssl.c.
References run_data_channel_with_cipher().
Referenced by main().
|
static |
Definition at line 284 of file test_ssl.c.
References run_data_channel_with_cipher().
Referenced by main().
|
static |
Definition at line 308 of file test_ssl.c.
References run_data_channel_with_cipher().
Referenced by main().
|
static |
Definition at line 290 of file test_ssl.c.
References run_data_channel_with_cipher().
Referenced by main().
|
static |
Definition at line 325 of file test_ssl.c.
References cipher_valid(), and run_data_channel_with_cipher().
Referenced by main().
|
static |
Definition at line 314 of file test_ssl.c.
References cipher_valid(), and run_data_channel_with_cipher().
Referenced by main().
void throw_signal | ( | const int | signum | ) |
Throw a hard signal.
Called from management and when windows signals are received through ctrl-c, exit event etc.
Definition at line 63 of file test_ssl.c.
References ASSERT, block_async_signals(), D_SIGNAL_DEBUG, ignored_hard_signals_mask, msg, SIG_SOURCE_HARD, siginfo_static, signal_name(), signal_info::signal_received, try_throw_signal(), and unblock_async_signals().
|
static |
Definition at line 261 of file test_ssl.c.
References free_key_ctx_bi(), crypto_options::key_ctx_bi, crypto_options::packet_id, and packet_id_free().
Referenced by run_data_channel_with_cipher().
struct signal_info siginfo_static |
Definition at line 54 of file test_ssl.c.
Referenced by get_signal().
const char* unittest_cert |
Definition at line 70 of file test_ssl.c.
Referenced by crypto_pem_encode_certificate().