OpenVPN
Functions | Variables
test_crypto.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 "mss.h"
#include "test_common.h"
Include dependency graph for test_crypto.c:

Go to the source code of this file.

Functions

static void crypto_pem_encode_decode_loopback (void **state)
 
static void test_translate_cipher (const char *ciphername, const char *openvpn_name)
 
static void test_cipher_names (const char *ciphername, const char *openvpn_name)
 
static void crypto_translate_cipher_names (void **state)
 
static void crypto_test_tls_prf (void **state)
 
static void crypto_test_hmac (void **state)
 
static void test_occ_mtu_calculation (void **state)
 
static void test_mssfix_mtu_calculation (void **state)
 
int main (void)
 

Variables

static const char testtext [] = "Dummy text to test PEM encoding"
 
static const char * ipsumlorem
 
static uint8_t testkey [20] = {0x0b, 0x00}
 
static uint8_t goodhash [20]
 

Function Documentation

◆ crypto_pem_encode_decode_loopback()

static void crypto_pem_encode_decode_loopback ( void **  state)
static

◆ crypto_test_hmac()

static void crypto_test_hmac ( void **  state)
static

◆ crypto_test_tls_prf()

static void crypto_test_tls_prf ( void **  state)
static

Definition at line 145 of file test_crypto.c.

References ipsumlorem, and ssl_tls1_PRF().

Referenced by main().

◆ crypto_translate_cipher_names()

static void crypto_translate_cipher_names ( void **  state)
static

Definition at line 127 of file test_crypto.c.

References test_cipher_names().

Referenced by main().

◆ main()

int main ( void  )

◆ test_cipher_names()

static void test_cipher_names ( const char *  ciphername,
const char *  openvpn_name 
)
static

Definition at line 89 of file test_crypto.c.

References gc_free(), gc_new(), string_alloc(), and test_translate_cipher().

Referenced by crypto_translate_cipher_names().

◆ test_mssfix_mtu_calculation()

static void test_mssfix_mtu_calculation ( void **  state)
static

◆ test_occ_mtu_calculation()

static void test_occ_mtu_calculation ( void **  state)
static

◆ test_translate_cipher()

static void test_translate_cipher ( const char *  ciphername,
const char *  openvpn_name 
)
static

Definition at line 73 of file test_crypto.c.

References cipher_kt_name(), and cipher_valid().

Referenced by test_cipher_names().

Variable Documentation

◆ goodhash

uint8_t goodhash[20]
static
Initial value:
= {0x58, 0xea, 0x5a, 0xf0, 0x42, 0x94, 0xe9, 0x17,
0xed, 0x84, 0xb9, 0xf0, 0x83, 0x30, 0x23, 0xae,
0x8b, 0xa7, 0x7e, 0xb8}

Definition at line 174 of file test_crypto.c.

Referenced by crypto_test_hmac().

◆ ipsumlorem

const char* ipsumlorem
static
Initial value:
= "Lorem ipsum dolor sit amet, consectetur "
"adipisici elit, sed eiusmod tempor incidunt "
"ut labore et dolore magna aliqua."

Definition at line 140 of file test_crypto.c.

Referenced by crypto_test_hmac(), and crypto_test_tls_prf().

◆ testkey

uint8_t testkey[20] = {0x0b, 0x00}
static

Definition at line 173 of file test_crypto.c.

Referenced by crypto_test_hmac().

◆ testtext

const char testtext[] = "Dummy text to test PEM encoding"
static

Definition at line 44 of file test_crypto.c.

Referenced by crypto_pem_encode_decode_loopback().