OpenVPN
Data Structures | Functions | Variables
test_pkt.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 "test_common.h"
#include "crypto.h"
#include "options.h"
#include "ssl_backend.h"
#include "ssl_pkt.h"
#include "tls_crypt.h"
#include "mss.h"
#include "reliable.h"
Include dependency graph for test_pkt.c:

Go to the source code of this file.

Data Structures

struct  test_pkt_context
 

Functions

int parse_line (const char *line, char **p, const int n, const char *file, const int line_num, int msglevel, struct gc_arena *gc)
 
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...
 
const char * print_link_socket_actual (const struct link_socket_actual *act, struct gc_arena *gc)
 
struct tls_auth_standalone init_tas_auth (int key_direction)
 
struct tls_auth_standalone init_tas_crypt (bool server)
 
void free_tas (struct tls_auth_standalone *tas)
 
void test_tls_decrypt_lite_crypt (void **ut_state)
 
void test_tls_decrypt_lite_auth (void **ut_state)
 
void test_tls_decrypt_lite_none (void **ut_state)
 
static void test_parse_ack (void **ut_state)
 
static void test_verify_hmac_tls_auth (void **ut_state)
 
static void test_verify_hmac_none (void **ut_state)
 
static hmac_ctx_tinit_static_hmac (void)
 
static void test_calc_session_id_hmac_static (void **ut_state)
 
static void test_generate_reset_packet_plain (void **ut_state)
 
static void test_generate_reset_packet_tls_auth (void **ut_state)
 
int main (void)
 

Variables

const char static_key []
 
const uint8_t client_reset_v2_none []
 
const uint8_t client_reset_v2_tls_auth []
 
const uint8_t client_reset_v2_tls_crypt []
 
const uint8_t client_ack_tls_auth_randomid []
 
const uint8_t client_control_with_ack []
 
const uint8_t client_ack_none_random_id []
 

Function Documentation

◆ free_tas()

void free_tas ( struct tls_auth_standalone tas)

◆ init_static_hmac()

static hmac_ctx_t* init_static_hmac ( void  )
static

◆ init_tas_auth()

struct tls_auth_standalone init_tas_auth ( int  key_direction)

◆ init_tas_crypt()

struct tls_auth_standalone init_tas_crypt ( bool  server)

◆ 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 59 of file test_pkt.c.

References ASSERT.

◆ main()

int main ( void  )

◆ parse_line()

int parse_line ( const char *  line,
char **  p,
const int  n,
const char *  file,
const int  line_num,
int  msglevel,
struct gc_arena gc 
)

Definition at line 48 of file test_pkt.c.

◆ print_link_socket_actual()

const char* print_link_socket_actual ( const struct link_socket_actual act,
struct gc_arena gc 
)

Definition at line 67 of file test_pkt.c.

References print_link_socket_actual_ex(), PS_SHOW_PKTINFO, and PS_SHOW_PORT.

◆ test_calc_session_id_hmac_static()

static void test_calc_session_id_hmac_static ( void **  ut_state)
static

◆ test_generate_reset_packet_plain()

static void test_generate_reset_packet_plain ( void **  ut_state)
static

◆ test_generate_reset_packet_tls_auth()

static void test_generate_reset_packet_tls_auth ( void **  ut_state)
static

◆ test_parse_ack()

static void test_parse_ack ( void **  ut_state)
static

◆ test_tls_decrypt_lite_auth()

void test_tls_decrypt_lite_auth ( void **  ut_state)

◆ test_tls_decrypt_lite_crypt()

void test_tls_decrypt_lite_crypt ( void **  ut_state)

◆ test_tls_decrypt_lite_none()

void test_tls_decrypt_lite_none ( void **  ut_state)

◆ test_verify_hmac_none()

static void test_verify_hmac_none ( void **  ut_state)
static

◆ test_verify_hmac_tls_auth()

static void test_verify_hmac_tls_auth ( void **  ut_state)
static

Variable Documentation

◆ client_ack_none_random_id

const uint8_t client_ack_none_random_id[]
Initial value:
= {
0x28, 0xae, 0xb9, 0xaf, 0xe1, 0xf0, 0x1d, 0x79,
0xc8, 0x01, 0x00, 0x00, 0x00, 0x00, 0xdd,
0x85, 0xdb, 0x53, 0x56, 0x23, 0xb0, 0x2e
}

Definition at line 172 of file test_pkt.c.

Referenced by test_parse_ack(), and test_verify_hmac_none().

◆ client_ack_tls_auth_randomid

const uint8_t client_ack_tls_auth_randomid[]

◆ client_control_with_ack

const uint8_t client_control_with_ack[]
Initial value:
= {
0x20, 0x78, 0x19, 0xbf, 0x2e, 0xbc, 0xd1, 0x9a,
0x45, 0x01, 0x00, 0x00, 0x00, 0x00, 0xea,
0xfe, 0xbf, 0xa4, 0x41, 0x8a, 0xe3, 0x1b,
0x00, 0x00, 0x00, 0x01, 0x16, 0x03, 0x01
}

Definition at line 165 of file test_pkt.c.

Referenced by test_parse_ack().

◆ client_reset_v2_none

const uint8_t client_reset_v2_none[]
Initial value:
=
{ 0x38, 0x68, 0x91, 0x92, 0x3f, 0xa3, 0x10, 0x34,
0x37, 0x00, 0x00, 0x00, 0x00, 0x00 }

Definition at line 98 of file test_pkt.c.

Referenced by test_parse_ack(), test_tls_decrypt_lite_auth(), test_tls_decrypt_lite_crypt(), and test_tls_decrypt_lite_none().

◆ client_reset_v2_tls_auth

const uint8_t client_reset_v2_tls_auth[]
Initial value:
=
{ 0x38, 0xde, 0x69, 0x4c, 0x5c, 0x7b, 0xfb, 0xa2,
0x74, 0x93, 0x53, 0x7c, 0x1d, 0xed, 0x4e, 0x78,
0x15, 0x29, 0xae, 0x7c, 0xfe, 0x4b, 0x8c, 0x6d,
0x6b, 0x2b, 0x51, 0xf0, 0x5a, 0x00, 0x00, 0x00,
0x01, 0x61, 0xd3, 0xbf, 0x6c, 0x00, 0x00, 0x00,
0x00, 0x00}

Definition at line 102 of file test_pkt.c.

Referenced by test_tls_decrypt_lite_auth(), test_tls_decrypt_lite_crypt(), and test_tls_decrypt_lite_none().

◆ client_reset_v2_tls_crypt

const uint8_t client_reset_v2_tls_crypt[]
Initial value:
=
{0x38, 0xf4, 0x19, 0xcb, 0x12, 0xd1, 0xf9, 0xe4,
0x8f, 0x00, 0x00, 0x00, 0x01, 0x61, 0xd3, 0xf8,
0xe1, 0x33, 0x02, 0x06, 0xf5, 0x68, 0x02, 0xbe,
0x44, 0xfb, 0xed, 0x90, 0x50, 0x64, 0xe3, 0xdb,
0x43, 0x41, 0x6b, 0xec, 0x5e, 0x52, 0x67, 0x19,
0x46, 0x2b, 0x7e, 0xb9, 0x0c, 0x96, 0xde, 0xfc,
0x9b, 0x05, 0xc4, 0x48, 0x79, 0xf7}

Definition at line 110 of file test_pkt.c.

Referenced by test_tls_decrypt_lite_crypt(), and test_tls_decrypt_lite_none().

◆ static_key

const char static_key[]
Initial value:
= "<tls-auth>\n"
"-----BEGIN OpenVPN Static key V1-----\n"
"37268ea8f95d7f71f9fb8fc03770c460\n"
"daf714a483d815c013ce0a537efc18f2\n"
"8f4f172669d9e6a413bac6741d8ea054\n"
"00f49b7fd6326470f23798c606bf53d4\n"
"de63ebc64ec59d57ce5d04d5b62e68b5\n"
"3ca6e5354351097fa370446c4d269f18\n"
"7bb6ae54af2dc70ff7317fe2f8754b82\n"
"82aad4202f9fa42c8640245d883e2c54\n"
"a0c1c489a036cf3a8964d8d289c1583b\n"
"9447c262b1da5fd167a5d27bd5ac5143\n"
"17bc2343a31a2efc38dd920d910375f5\n"
"1c2e27f3afd36c49269da079f7ce466e\n"
"bb0f9ad13e9bbb4665974e6bc24b513c\n"
"5700393bf4a3e7f967e2f384069ac8a8\n"
"e78b18b15604993fd16515cce9c0f3e4\n"
"2b4126b999005ade802797b0eeb8b9e6\n"
"-----END OpenVPN Static key V1-----\n"
"</tls-auth>\n"

Definition at line 77 of file test_pkt.c.

Referenced by init_tas_auth(), and init_tas_crypt().