53 for (uint32_t i = 0; i < h->
n_buckets; ++i)
223 ASSERT(start_bucket <= end_bucket);
#define ALLOC_OBJ_CLEAR(dptr, type)
Allocate and zero-initialise memory for a single object of the given type.
#define ALLOC_ARRAY(dptr, type, n)
Allocate memory for an array of n elements of the given type.
void prng_bytes(uint8_t *output, int len)
Data Channel Cryptography Module.
static size_t adjust_power_of_2(size_t u)
static void hash_remove_marked(struct hash *hash, struct hash_bucket *bucket)
void hash_iterator_free(struct hash_iterator *hi)
struct hash_element * hash_iterator_next(struct hash_iterator *hi)
void hash_iterator_delete_element(struct hash_iterator *hi)
void hash_iterator_init(struct hash *hash, struct hash_iterator *hi)
struct hash * hash_init(const uint32_t n_buckets, uint64_t(*hash_function)(const void *key, const uint8_t hash_key[HASH_KEY_LEN]), bool(*compare_function)(const void *key1, const void *key2))
static void hash_iterator_lock(struct hash_iterator *hi, struct hash_bucket *b)
static void hash_iterator_unlock(struct hash_iterator *hi)
bool hash_remove_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint64_t hv)
void hash_free(struct hash *hash)
struct hash_element * hash_lookup_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint64_t hv)
bool hash_add(struct hash *hash, const void *key, void *value, bool replace)
void hash_remove_by_value(struct hash *hash, void *value)
static void hash_iterator_advance(struct hash_iterator *hi)
void hash_iterator_init_range(struct hash *hash, struct hash_iterator *hi, uint32_t start_bucket, uint32_t end_bucket)
static void hash_add_fast(struct hash *hash, struct hash_bucket *bucket, const void *key, uint64_t hv, void *value)
static uint64_t hash_value(const struct hash *hash, const void *key)
struct hash_element * list
struct hash_element * next
uint32_t bucket_index_end
struct hash_bucket * bucket
struct hash_element * elem
uint32_t bucket_index_start
struct hash_element * last
struct hash_bucket * buckets
uint64_t(* hash_function)(const void *key, const uint8_t hash_key[HASH_KEY_LEN])
uint8_t hash_key[HASH_KEY_LEN]
key/iv used for the hash function.
bool(* compare_function)(const void *key1, const void *key2)
Container for bidirectional cipher and HMAC key material.
Container for unidirectional cipher and HMAC key material.