OpenVPN
Macros | Functions
siphash.h File Reference
#include <stdint.h>
#include <stdio.h>
#include "crypto.h"
#include <openssl/opensslv.h>
Include dependency graph for siphash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SIPHASH_KEY_SIZE   16
 

Functions

void siphash_reference (const void *in, size_t inlen, const void *k, uint8_t *out, size_t outlen)
 Calculates SIPHASH using the reference implementation.
 
static void siphash (const void *in, size_t inlen, const void *k, uint8_t *out, size_t outlen)
 
static void siphash_key_init (uint8_t *key)
 Initialises a SIPHASH key with a random value.
 
uint64_t siphash_hash_func (const uint8_t *k, uint32_t length, const uint8_t hash_key[SIPHASH_KEY_SIZE])
 Wrapper of the siphash function to be able to use it in the hash map.
 

Macro Definition Documentation

◆ SIPHASH_KEY_SIZE

#define SIPHASH_KEY_SIZE   16

Definition at line 35 of file siphash.h.

Function Documentation

◆ siphash()

static void siphash ( const void *  in,
size_t  inlen,
const void *  k,
uint8_t *  out,
size_t  outlen 
)
inlinestatic

Definition at line 70 of file siphash.h.

References siphash_reference().

Referenced by calculate_session_id_hmac(), and siphash_hash_func().

◆ siphash_hash_func()

uint64_t siphash_hash_func ( const uint8_t *  k,
uint32_t  length,
const uint8_t  hash_key[SIPHASH_KEY_SIZE] 
)

Wrapper of the siphash function to be able to use it in the hash map.

Parameters
kthe data to hash
lengthlength of the data to hash
hash_keythe siphash key
Returns
a uint64_t containing the result of the hashing

Definition at line 37 of file siphash.c.

References siphash().

Referenced by mroute_addr_hash_function(), and word_hash_function().

◆ siphash_key_init()

static void siphash_key_init ( uint8_t *  key)
inlinestatic

Initialises a SIPHASH key with a random value.

Parameters
keythe key to be initialised

Definition at line 85 of file siphash.h.

References prng_bytes(), and SIPHASH_KEY_SIZE.

Referenced by do_init_crypto_tls(), test_verify_hmac_none(), test_verify_hmac_none_out_of_range_ack(), and test_verify_hmac_tls_auth().

◆ siphash_reference()

void siphash_reference ( const void *  in,
size_t  inlen,
const void *  k,
uint8_t *  out,
size_t  outlen 
)

Calculates SIPHASH using the reference implementation.

Definition at line 103 of file siphash_reference.c.

References cROUNDS, dROUNDS, SIPROUND, TRACE, U64TO8_LE, and U8TO64_LE.

Referenced by siphash(), test_siphash(), and test_siphash_openssl().