diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-21 10:53:29 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-21 11:03:39 -0400 |
commit | a403ee6bb31168e19cf4173fff0e9acf9548231f (patch) | |
tree | 841bd1a24df1e9aefa6e8370635170a561e80a75 /src/common/di_ops.h | |
parent | 275aff6917260209dc53e553d895ec886f6c8c52 (diff) | |
download | tor-a403ee6bb31168e19cf4173fff0e9acf9548231f.tar.gz tor-a403ee6bb31168e19cf4173fff0e9acf9548231f.zip |
Move consttime library code into its own directory.
Diffstat (limited to 'src/common/di_ops.h')
-rw-r--r-- | src/common/di_ops.h | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/common/di_ops.h b/src/common/di_ops.h deleted file mode 100644 index 8298bfa73a..0000000000 --- a/src/common/di_ops.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2003-2004, Roger Dingledine - * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2018, The Tor Project, Inc. */ -/* See LICENSE for licensing information */ - -/** - * \file di_ops.h - * \brief Headers for di_ops.c - **/ - -#ifndef TOR_DI_OPS_H -#define TOR_DI_OPS_H - -#include "orconfig.h" -#include "common/torint.h" - -int tor_memcmp(const void *a, const void *b, size_t sz); -int tor_memeq(const void *a, const void *b, size_t sz); -#define tor_memneq(a,b,sz) (!tor_memeq((a),(b),(sz))) - -/** Alias for the platform's memcmp() function. This function is - * <em>not</em> data-independent: we define this alias so that we can - * mark cases where we are deliberately using a data-dependent memcmp() - * implementation. - */ -#define fast_memcmp(a,b,c) (memcmp((a),(b),(c))) -#define fast_memeq(a,b,c) (0==memcmp((a),(b),(c))) -#define fast_memneq(a,b,c) (0!=memcmp((a),(b),(c))) - -int safe_mem_is_zero(const void *mem, size_t sz); - -/** A type for a map from DIGEST256_LEN-byte blobs to void*, such that - * data lookups take an amount of time proportional only to the size - * of the map, and not to the position or presence of the item in the map. - * - * Not efficient for large maps! */ -typedef struct di_digest256_map_t di_digest256_map_t; -typedef void (*dimap_free_fn)(void *); - -void dimap_free_(di_digest256_map_t *map, dimap_free_fn free_fn); -#define dimap_free(map, free_fn) \ - do { \ - dimap_free_((map), (free_fn)); \ - (map) = NULL; \ - } while (0) -void dimap_add_entry(di_digest256_map_t **map, - const uint8_t *key, void *val); -void *dimap_search(const di_digest256_map_t *map, const uint8_t *key, - void *dflt_val); -int select_array_member_cumulative_timei(const uint64_t *entries, - int n_entries, - uint64_t total, uint64_t rand_val); - -#endif /* !defined(TOR_DI_OPS_H) */ - |