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 "mock_msg.h"
#include "mss.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)
 
void test_des_encrypt (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 uint8_t good_prf [32]
 
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 152 of file test_crypto.c.

References good_prf, ipsumlorem, and ssl_tls1_PRF().

Referenced by main().

◆ crypto_translate_cipher_names()

static void crypto_translate_cipher_names ( void **  state)
static

Definition at line 129 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 91 of file test_crypto.c.

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

Referenced by crypto_translate_cipher_names().

◆ test_des_encrypt()

void test_des_encrypt ( void **  state)

Definition at line 217 of file test_crypto.c.

References cipher_des_encrypt_ecb(), and DES_KEY_LENGTH.

Referenced by main().

◆ 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 75 of file test_crypto.c.

References cipher_kt_name(), and cipher_valid().

Referenced by test_cipher_names().

Variable Documentation

◆ good_prf

uint8_t good_prf[32]
static
Initial value:
= {0xd9, 0x8c, 0x85, 0x18, 0xc8, 0x5e, 0x94, 0x69,
0x27, 0x91, 0x6a, 0xcf, 0xc2, 0xd5, 0x92, 0xfb,
0xb1, 0x56, 0x7e, 0x4b, 0x4b, 0x14, 0x59, 0xe6,
0xa9, 0x04, 0xac, 0x2d, 0xda, 0xb7, 0x2d, 0x67}

Definition at line 142 of file test_crypto.c.

Referenced by crypto_test_tls_prf().

◆ 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 171 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 147 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 170 of file test_crypto.c.

Referenced by crypto_test_hmac().

◆ testtext

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

Definition at line 46 of file test_crypto.c.

Referenced by crypto_pem_encode_decode_loopback().