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 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_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.

Referenced by export_user_keying_material(), generate_key_expansion_tls_export(), and p2p_ncp_set_options().

◆ main()

int main ( void  )

Definition at line 245 of file test_ncp.c.

References cmocka_run_group_tests.

◆ 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

◆ test_ncp_best()

static void test_ncp_best ( void **  state)
static

Definition at line 197 of file test_ncp.c.

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

◆ test_poor_man()

static void test_poor_man ( void **  state)
static

Variable Documentation

◆ 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 43 of file test_ncp.c.

Referenced by test_check_ncp_ciphers_list().

◆ ncp_tests

const struct CMUnitTest ncp_tests[]
Initial value:
= {
}
#define cmocka_unit_test(f)
Initializes a CMUnitTest structure.
Definition: cmocka.h:1653
static void test_poor_man(void **state)
Definition: test_ncp.c:148
static void test_extract_client_ciphers(void **state)
Definition: test_ncp.c:109
static void test_check_ncp_ciphers_list(void **state)
Definition: test_ncp.c:58
static void test_ncp_best(void **state)
Definition: test_ncp.c:197

Definition at line 236 of file test_ncp.c.