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

Go to the source code of this file.

Functions

bool key_state_export_keying_material (struct tls_session *session, const char *label, size_t label_size, void *ekm, size_t ekm_size)
 Keying Material Exporters [RFC 5705] allows additional keying material to be derived from existing TLS channel. More...
 
static void test_check_ncp_ciphers_list (void **state)
 
static void test_extract_client_ciphers (void **state)
 
static void test_poor_man (void **state)
 
static void test_ncp_best (void **state)
 
int main (void)
 

Variables

const char * bf_chacha = "BF-CBC:CHACHA20-POLY1305"
 
const char * aes_chacha = "AES-128-CBC:CHACHA20-POLY1305"
 
const char * aes_ciphers = "AES-256-GCM:AES-128-GCM"
 
const struct CMUnitTest ncp_tests []
 

Function Documentation

◆ key_state_export_keying_material()

bool key_state_export_keying_material ( struct tls_session session,
const char *  label,
size_t  label_size,
void *  ekm,
size_t  ekm_size 
)

Keying Material Exporters [RFC 5705] allows additional keying material to be derived from existing TLS channel.

This exported keying material can then be used for a variety of purposes.

Parameters
sessionThe session associated with the given key_state
labelThe label to use when exporting the key
label_sizeThe size of the label to use when exporting the key
ekmBuffer to return the exported key material in
ekm_sizeThe size of ekm, in bytes
Returns
true if exporting succeeded, false otherwise

Definition at line 50 of file test_ncp.c.

References ASSERT.

◆ main()

int main ( void  )

Definition at line 274 of file test_ncp.c.

References ncp_tests, and openvpn_unit_test_setup().

◆ test_check_ncp_ciphers_list()

static void test_check_ncp_ciphers_list ( void **  state)
static

◆ test_extract_client_ciphers()

static void test_extract_client_ciphers ( void **  state)
static

Definition at line 138 of file test_ncp.c.

References aes_ciphers, gc_free(), gc_new(), tls_peer_ncp_list(), and tls_peer_supports_ncp().

◆ test_ncp_best()

static void test_ncp_best ( void **  state)
static

Definition at line 226 of file test_ncp.c.

References gc_free(), gc_new(), and ncp_get_best_cipher().

◆ test_poor_man()

static void test_poor_man ( void **  state)
static

Definition at line 177 of file test_ncp.c.

References gc_free(), gc_new(), and ncp_get_best_cipher().

Variable Documentation

◆ aes_chacha

const char* aes_chacha = "AES-128-CBC:CHACHA20-POLY1305"

Definition at line 43 of file test_ncp.c.

Referenced by test_check_ncp_ciphers_list().

◆ aes_ciphers

const char* aes_ciphers = "AES-256-GCM:AES-128-GCM"

Definition at line 44 of file test_ncp.c.

Referenced by test_check_ncp_ciphers_list(), and test_extract_client_ciphers().

◆ bf_chacha

const char* bf_chacha = "BF-CBC:CHACHA20-POLY1305"

Definition at line 42 of file test_ncp.c.

Referenced by test_check_ncp_ciphers_list().

◆ ncp_tests

const struct CMUnitTest ncp_tests[]
Initial value:
= {
cmocka_unit_test(test_check_ncp_ciphers_list),
cmocka_unit_test(test_extract_client_ciphers),
cmocka_unit_test(test_poor_man),
cmocka_unit_test(test_ncp_best)
}

Definition at line 265 of file test_ncp.c.

Referenced by main().

test_poor_man
static void test_poor_man(void **state)
Definition: test_ncp.c:177
test_check_ncp_ciphers_list
static void test_check_ncp_ciphers_list(void **state)
Definition: test_ncp.c:58
test_ncp_best
static void test_ncp_best(void **state)
Definition: test_ncp.c:226
test_extract_client_ciphers
static void test_extract_client_ciphers(void **state)
Definition: test_ncp.c:138