OpenVPN
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.
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)
static void test_ncp_default (void **state)
static void test_ncp_expand (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 49 of file test_ncp.c.

References ASSERT.

◆ main()

int main ( void )

Definition at line 407 of file test_ncp.c.

References ncp_tests, and openvpn_unit_test_setup().

◆ test_check_ncp_ciphers_list()

void test_check_ncp_ciphers_list ( void ** state)
static

◆ test_extract_client_ciphers()

void test_extract_client_ciphers ( void ** state)
static

Definition at line 158 of file test_ncp.c.

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

◆ test_ncp_best()

void test_ncp_best ( void ** state)
static

Definition at line 237 of file test_ncp.c.

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

◆ test_ncp_default()

void test_ncp_default ( void ** state)
static

◆ test_ncp_expand()

void test_ncp_expand ( void ** state)
static

◆ test_poor_man()

void test_poor_man ( void ** state)
static

Definition at line 197 of file test_ncp.c.

References gc, 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 42 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 43 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 41 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),
cmocka_unit_test(test_ncp_default),
cmocka_unit_test(test_ncp_expand),
}
static void test_extract_client_ciphers(void **state)
Definition test_ncp.c:158
static void test_ncp_default(void **state)
Definition test_ncp.c:270
static void test_ncp_expand(void **state)
Definition test_ncp.c:356
static void test_check_ncp_ciphers_list(void **state)
Definition test_ncp.c:67
static void test_poor_man(void **state)
Definition test_ncp.c:197
static void test_ncp_best(void **state)
Definition test_ncp.c:237

Definition at line 396 of file test_ncp.c.

Referenced by main().