OpenVPN
Functions | Variables
test_ssl.c File Reference
#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"
Include dependency graph for test_ssl.c:

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
 

Function Documentation

◆ crypto_pem_encode_certificate()

static void crypto_pem_encode_certificate ( void **  state)
static

◆ do_data_channel_round_trip()

static void do_data_channel_round_trip ( struct crypto_options co)
static

◆ get_tmp_dir()

static const char* get_tmp_dir ( void  )
static

Definition at line 84 of file test_ssl.c.

References win_get_tempdir().

Referenced by crypto_pem_encode_certificate().

◆ init_crypto_options()

struct crypto_options init_crypto_options ( const char *  cipher,
const char *  auth 
)

◆ init_frame_parameters()

static void init_frame_parameters ( struct frame frame)
static

◆ init_implicit_iv()

static void init_implicit_iv ( struct crypto_options co)
static

◆ main()

int main ( void  )

◆ run_data_channel_with_cipher()

static void run_data_channel_with_cipher ( const char *  cipher,
const char *  auth 
)
static

◆ strerror_win32()

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().

◆ test_data_channel_roundtrip_aes_128_cbc()

static void test_data_channel_roundtrip_aes_128_cbc ( void **  state)
static

Definition at line 296 of file test_ssl.c.

References run_data_channel_with_cipher().

Referenced by main().

◆ test_data_channel_roundtrip_aes_128_gcm()

static void test_data_channel_roundtrip_aes_128_gcm ( void **  state)
static

Definition at line 278 of file test_ssl.c.

References run_data_channel_with_cipher().

Referenced by main().

◆ test_data_channel_roundtrip_aes_192_cbc()

static void test_data_channel_roundtrip_aes_192_cbc ( void **  state)
static

Definition at line 302 of file test_ssl.c.

References run_data_channel_with_cipher().

Referenced by main().

◆ test_data_channel_roundtrip_aes_192_gcm()

static void test_data_channel_roundtrip_aes_192_gcm ( void **  state)
static

Definition at line 284 of file test_ssl.c.

References run_data_channel_with_cipher().

Referenced by main().

◆ test_data_channel_roundtrip_aes_256_cbc()

static void test_data_channel_roundtrip_aes_256_cbc ( void **  state)
static

Definition at line 308 of file test_ssl.c.

References run_data_channel_with_cipher().

Referenced by main().

◆ test_data_channel_roundtrip_aes_256_gcm()

static void test_data_channel_roundtrip_aes_256_gcm ( void **  state)
static

Definition at line 290 of file test_ssl.c.

References run_data_channel_with_cipher().

Referenced by main().

◆ test_data_channel_roundtrip_bf_cbc()

static void test_data_channel_roundtrip_bf_cbc ( void **  state)
static

Definition at line 325 of file test_ssl.c.

References cipher_valid(), and run_data_channel_with_cipher().

Referenced by main().

◆ test_data_channel_roundtrip_chacha20_poly1305()

static void test_data_channel_roundtrip_chacha20_poly1305 ( void **  state)
static

Definition at line 314 of file test_ssl.c.

References cipher_valid(), and run_data_channel_with_cipher().

Referenced by main().

◆ throw_signal()

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().

◆ uninit_crypto_options()

static void uninit_crypto_options ( struct crypto_options co)
static

Variable Documentation

◆ siginfo_static

struct signal_info siginfo_static

Definition at line 54 of file test_ssl.c.

Referenced by get_signal().

◆ unittest_cert

const char* unittest_cert
Initial value:
= "-----BEGIN CERTIFICATE-----\n"
"MIIBuTCCAUCgAwIBAgIUTLtjSBzx53qZRvZ6Ur7D9kgoOHkwCgYIKoZIzj0EAwIw\n"
"EzERMA8GA1UEAwwIdW5pdHRlc3QwIBcNMjMxMTIxMDk1NDQ3WhgPMjA3ODA4MjQw\n"
"OTU0NDdaMBMxETAPBgNVBAMMCHVuaXR0ZXN0MHYwEAYHKoZIzj0CAQYFK4EEACID\n"
"YgAEHYB2hn2xx3f4lClXDtdi36P19pMZA+kI1Dkv/Vn10vBZ/j9oa+P99T8duz/e\n"
"QlPeHpesNJO4fX8iEDj6+vMeWejOT7jAQ4MmG5EZjpcBKxCfwFooEvzu8bVujUcu\n"
"wTQEo1MwUTAdBgNVHQ4EFgQUPcgBEVXjF5vYfDsInoE3dF6UfQswHwYDVR0jBBgw\n"
"FoAUPcgBEVXjF5vYfDsInoE3dF6UfQswDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjO\n"
"PQQDAgNnADBkAjBLPAGrQAyinigqiu0RomoV8TVaknVLFSq6H6A8jgvzfsFCUK1O\n"
"dvNZhFPM6idKB+oCME2JLOBANCSV8o7aJzq7SYHKwPyb1J4JFlwKe/0Jpv7oh9b1\n"
"IJbuaM9Z/VSKbrIXGg==\n"
"-----END CERTIFICATE-----\n"

Definition at line 70 of file test_ssl.c.

Referenced by crypto_pem_encode_certificate().