FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
wireguard_noise.c File Reference
+ Include dependency graph for wireguard_noise.c:

Go to the source code of this file.

Functions

static noise_keypair_tnoise_remote_keypair_allocate (noise_remote_t *)
 
static void noise_remote_keypair_free (vlib_main_t *vm, noise_remote_t *, noise_keypair_t **)
 
static uint32_t noise_remote_handshake_index_get (noise_remote_t *)
 
static void noise_remote_handshake_index_drop (noise_remote_t *)
 
static uint64_t noise_counter_send (noise_counter_t *)
 
static bool noise_counter_recv (noise_counter_t *, uint64_t)
 
static void noise_kdf (uint8_t *, uint8_t *, uint8_t *, const uint8_t *, size_t, size_t, size_t, size_t, const uint8_t[NOISE_HASH_LEN])
 
static bool noise_mix_dh (uint8_t[NOISE_HASH_LEN], uint8_t[NOISE_SYMMETRIC_KEY_LEN], const uint8_t[NOISE_PUBLIC_KEY_LEN], const uint8_t[NOISE_PUBLIC_KEY_LEN])
 
static bool noise_mix_ss (uint8_t ck[NOISE_HASH_LEN], uint8_t key[NOISE_SYMMETRIC_KEY_LEN], const uint8_t ss[NOISE_PUBLIC_KEY_LEN])
 
static void noise_mix_hash (uint8_t[NOISE_HASH_LEN], const uint8_t *, size_t)
 
static void noise_mix_psk (uint8_t[NOISE_HASH_LEN], uint8_t[NOISE_HASH_LEN], uint8_t[NOISE_SYMMETRIC_KEY_LEN], const uint8_t[NOISE_SYMMETRIC_KEY_LEN])
 
static void noise_param_init (uint8_t[NOISE_HASH_LEN], uint8_t[NOISE_HASH_LEN], const uint8_t[NOISE_PUBLIC_KEY_LEN])
 
static void noise_msg_encrypt (vlib_main_t *vm, uint8_t *, uint8_t *, size_t, uint32_t key_idx, uint8_t[NOISE_HASH_LEN])
 
static bool noise_msg_decrypt (vlib_main_t *vm, uint8_t *, uint8_t *, size_t, uint32_t key_idx, uint8_t[NOISE_HASH_LEN])
 
static void noise_msg_ephemeral (uint8_t[NOISE_HASH_LEN], uint8_t[NOISE_HASH_LEN], const uint8_t src[NOISE_PUBLIC_KEY_LEN])
 
static void noise_tai64n_now (uint8_t[NOISE_TIMESTAMP_LEN])
 
static void secure_zero_memory (void *v, size_t n)
 
void noise_local_init (noise_local_t *l, struct noise_upcall *upcall)
 
bool noise_local_set_private (noise_local_t *l, const uint8_t private[NOISE_PUBLIC_KEY_LEN])
 
void noise_remote_init (noise_remote_t *r, uint32_t peer_pool_idx, const uint8_t public[NOISE_PUBLIC_KEY_LEN], u32 noise_local_idx)
 
void noise_remote_precompute (noise_remote_t *r)
 
bool noise_create_initiation (vlib_main_t *vm, noise_remote_t *r, uint32_t *s_idx, uint8_t ue[NOISE_PUBLIC_KEY_LEN], uint8_t es[NOISE_PUBLIC_KEY_LEN+NOISE_AUTHTAG_LEN], uint8_t ets[NOISE_TIMESTAMP_LEN+NOISE_AUTHTAG_LEN])
 
bool noise_consume_initiation (vlib_main_t *vm, noise_local_t *l, noise_remote_t **rp, uint32_t s_idx, uint8_t ue[NOISE_PUBLIC_KEY_LEN], uint8_t es[NOISE_PUBLIC_KEY_LEN+NOISE_AUTHTAG_LEN], uint8_t ets[NOISE_TIMESTAMP_LEN+NOISE_AUTHTAG_LEN])
 
bool noise_create_response (vlib_main_t *vm, noise_remote_t *r, uint32_t *s_idx, uint32_t *r_idx, uint8_t ue[NOISE_PUBLIC_KEY_LEN], uint8_t en[0+NOISE_AUTHTAG_LEN])
 
bool noise_consume_response (vlib_main_t *vm, noise_remote_t *r, uint32_t s_idx, uint32_t r_idx, uint8_t ue[NOISE_PUBLIC_KEY_LEN], uint8_t en[0+NOISE_AUTHTAG_LEN])
 
bool noise_remote_begin_session (vlib_main_t *vm, noise_remote_t *r)
 
void noise_remote_clear (vlib_main_t *vm, noise_remote_t *r)
 
void noise_remote_expire_current (noise_remote_t *r)
 
bool noise_remote_ready (noise_remote_t *r)
 
static bool chacha20poly1305_calc (vlib_main_t *vm, u8 *src, u32 src_len, u8 *dst, u8 *aad, u32 aad_len, u64 nonce, vnet_crypto_op_id_t op_id, vnet_crypto_key_index_t key_index)
 
enum noise_state_crypt noise_remote_encrypt (vlib_main_t *vm, noise_remote_t *r, uint32_t *r_idx, uint64_t *nonce, uint8_t *src, size_t srclen, uint8_t *dst)
 
enum noise_state_crypt noise_remote_decrypt (vlib_main_t *vm, noise_remote_t *r, uint32_t r_idx, uint64_t nonce, uint8_t *src, size_t srclen, uint8_t *dst)
 

Variables

noise_local_tnoise_local_pool
 

Function Documentation

◆ chacha20poly1305_calc()

static bool chacha20poly1305_calc ( vlib_main_t vm,
u8 src,
u32  src_len,
u8 dst,
u8 aad,
u32  aad_len,
u64  nonce,
vnet_crypto_op_id_t  op_id,
vnet_crypto_key_index_t  key_index 
)
static

Definition at line 496 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_consume_initiation()

bool noise_consume_initiation ( vlib_main_t vm,
noise_local_t l,
noise_remote_t **  rp,
uint32_t  s_idx,
uint8_t  ue[NOISE_PUBLIC_KEY_LEN],
uint8_t  es[NOISE_PUBLIC_KEY_LEN+NOISE_AUTHTAG_LEN],
uint8_t  ets[NOISE_TIMESTAMP_LEN+NOISE_AUTHTAG_LEN] 
)

Definition at line 170 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_consume_response()

bool noise_consume_response ( vlib_main_t vm,
noise_remote_t r,
uint32_t  s_idx,
uint32_t  r_idx,
uint8_t  ue[NOISE_PUBLIC_KEY_LEN],
uint8_t  en[0+NOISE_AUTHTAG_LEN] 
)

Definition at line 307 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_counter_recv()

static bool noise_counter_recv ( noise_counter_t ctr,
uint64_t  recv 
)
static

Definition at line 734 of file wireguard_noise.c.

+ Here is the caller graph for this function:

◆ noise_counter_send()

static uint64_t noise_counter_send ( noise_counter_t ctr)
static

Definition at line 726 of file wireguard_noise.c.

+ Here is the caller graph for this function:

◆ noise_create_initiation()

bool noise_create_initiation ( vlib_main_t vm,
noise_remote_t r,
uint32_t *  s_idx,
uint8_t  ue[NOISE_PUBLIC_KEY_LEN],
uint8_t  es[NOISE_PUBLIC_KEY_LEN+NOISE_AUTHTAG_LEN],
uint8_t  ets[NOISE_TIMESTAMP_LEN+NOISE_AUTHTAG_LEN] 
)

Definition at line 118 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_create_response()

bool noise_create_response ( vlib_main_t vm,
noise_remote_t r,
uint32_t *  s_idx,
uint32_t *  r_idx,
uint8_t  ue[NOISE_PUBLIC_KEY_LEN],
uint8_t  en[0+NOISE_AUTHTAG_LEN] 
)

Definition at line 254 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_kdf()

static void noise_kdf ( uint8_t *  a,
uint8_t *  b,
uint8_t *  c,
const uint8_t *  x,
size_t  a_len,
size_t  b_len,
size_t  c_len,
size_t  x_len,
const uint8_t  ck[NOISE_HASH_LEN] 
)
static

Definition at line 775 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_local_init()

void noise_local_init ( noise_local_t l,
struct noise_upcall *  upcall 
)

Definition at line 74 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_local_set_private()

bool noise_local_set_private ( noise_local_t l,
const uint8_t  private[NOISE_PUBLIC_KEY_LEN] 
)

Definition at line 81 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_mix_dh()

static bool noise_mix_dh ( uint8_t  ck[NOISE_HASH_LEN],
uint8_t  key[NOISE_SYMMETRIC_KEY_LEN],
const uint8_t  private[NOISE_PUBLIC_KEY_LEN],
const uint8_t  public[NOISE_PUBLIC_KEY_LEN] 
)
static

Definition at line 823 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_mix_hash()

static void noise_mix_hash ( uint8_t  hash[NOISE_HASH_LEN],
const uint8_t *  src,
size_t  src_len 
)
static

Definition at line 853 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_mix_psk()

static void noise_mix_psk ( uint8_t  ck[NOISE_HASH_LEN],
uint8_t  hash[NOISE_HASH_LEN],
uint8_t  key[NOISE_SYMMETRIC_KEY_LEN],
const uint8_t  psk[NOISE_SYMMETRIC_KEY_LEN] 
)
static

Definition at line 865 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_mix_ss()

static bool noise_mix_ss ( uint8_t  ck[NOISE_HASH_LEN],
uint8_t  key[NOISE_SYMMETRIC_KEY_LEN],
const uint8_t  ss[NOISE_PUBLIC_KEY_LEN] 
)
static

Definition at line 839 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_msg_decrypt()

static bool noise_msg_decrypt ( vlib_main_t vm,
uint8_t *  dst,
uint8_t *  src,
size_t  src_len,
uint32_t  key_idx,
uint8_t  hash[NOISE_HASH_LEN] 
)
static

Definition at line 908 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_msg_encrypt()

static void noise_msg_encrypt ( vlib_main_t vm,
uint8_t *  dst,
uint8_t *  src,
size_t  src_len,
uint32_t  key_idx,
uint8_t  hash[NOISE_HASH_LEN] 
)
static

Definition at line 897 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_msg_ephemeral()

static void noise_msg_ephemeral ( uint8_t  ck[NOISE_HASH_LEN],
uint8_t  hash[NOISE_HASH_LEN],
const uint8_t  src[NOISE_PUBLIC_KEY_LEN] 
)
static

Definition at line 921 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_param_init()

static void noise_param_init ( uint8_t  ck[NOISE_HASH_LEN],
uint8_t  hash[NOISE_HASH_LEN],
const uint8_t  s[NOISE_PUBLIC_KEY_LEN] 
)
static

Definition at line 879 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_begin_session()

bool noise_remote_begin_session ( vlib_main_t vm,
noise_remote_t r 
)

Definition at line 368 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_clear()

void noise_remote_clear ( vlib_main_t vm,
noise_remote_t r 
)

Definition at line 450 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_decrypt()

enum noise_state_crypt noise_remote_decrypt ( vlib_main_t vm,
noise_remote_t r,
uint32_t  r_idx,
uint64_t  nonce,
uint8_t *  src,
size_t  srclen,
uint8_t *  dst 
)

Definition at line 596 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_encrypt()

enum noise_state_crypt noise_remote_encrypt ( vlib_main_t vm,
noise_remote_t r,
uint32_t *  r_idx,
uint64_t *  nonce,
uint8_t *  src,
size_t  srclen,
uint8_t *  dst 
)

Definition at line 544 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_expire_current()

void noise_remote_expire_current ( noise_remote_t r)

Definition at line 466 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_handshake_index_drop()

static void noise_remote_handshake_index_drop ( noise_remote_t r)
static

Definition at line 716 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_handshake_index_get()

static uint32_t noise_remote_handshake_index_get ( noise_remote_t r)
static

Definition at line 708 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_init()

void noise_remote_init ( noise_remote_t r,
uint32_t  peer_pool_idx,
const uint8_t  public[NOISE_PUBLIC_KEY_LEN],
u32  noise_local_idx 
)

Definition at line 90 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_keypair_allocate()

static noise_keypair_t * noise_remote_keypair_allocate ( noise_remote_t r)
static

Definition at line 685 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_keypair_free()

static void noise_remote_keypair_free ( vlib_main_t vm,
noise_remote_t r,
noise_keypair_t **  kp 
)
static

Definition at line 693 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_precompute()

void noise_remote_precompute ( noise_remote_t r)

Definition at line 105 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_remote_ready()

bool noise_remote_ready ( noise_remote_t r)

Definition at line 477 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noise_tai64n_now()

static void noise_tai64n_now ( uint8_t  output[NOISE_TIMESTAMP_LEN])
static

Definition at line 930 of file wireguard_noise.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ secure_zero_memory()

static void secure_zero_memory ( void *  v,
size_t  n 
)
static

Definition at line 953 of file wireguard_noise.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ noise_local_pool

noise_local_t* noise_local_pool

Definition at line 29 of file wireguard_noise.c.