diff options
Diffstat (limited to 'src/ext')
-rw-r--r-- | src/ext/.may_include | 10 | ||||
-rw-r--r-- | src/ext/csiphash.c | 18 | ||||
-rw-r--r-- | src/ext/include.am | 2 | ||||
-rw-r--r-- | src/ext/readpassphrase.c | 2 | ||||
-rw-r--r-- | src/ext/timeouts/.may_include | 5 | ||||
-rw-r--r-- | src/ext/timeouts/test-timeout.c | 2 | ||||
-rw-r--r-- | src/ext/timeouts/timeout.c | 11 | ||||
-rw-r--r-- | src/ext/timeouts/timeout.h | 4 | ||||
-rw-r--r-- | src/ext/tinytest.c | 6 | ||||
-rw-r--r-- | src/ext/tinytest.h | 3 | ||||
-rw-r--r-- | src/ext/trunnel/trunnel-impl.h | 2 | ||||
-rw-r--r-- | src/ext/trunnel/trunnel.c | 2 | ||||
-rw-r--r-- | src/ext/trunnel/trunnel.h | 2 |
13 files changed, 51 insertions, 18 deletions
diff --git a/src/ext/.may_include b/src/ext/.may_include new file mode 100644 index 0000000000..1eafff2eeb --- /dev/null +++ b/src/ext/.may_include @@ -0,0 +1,10 @@ + +orconfig.h + +lib/err/*.h +lib/cc/*.h + +tinytest*.h +ext/siphash.h +ext/byteorder.h +ext/tor_readpassphrase.h
\ No newline at end of file diff --git a/src/ext/csiphash.c b/src/ext/csiphash.c index a65b6fcbe6..e0f5b2e5c9 100644 --- a/src/ext/csiphash.c +++ b/src/ext/csiphash.c @@ -30,12 +30,12 @@ */ #include "lib/cc/torint.h" -#include "lib/log/util_bug.h" +#include "lib/err/torerr.h" -#include "siphash.h" +#include "ext/siphash.h" #include <string.h> #include <stdlib.h> -#include "byteorder.h" +#include "ext/byteorder.h" #define ROTATE(x, b) (uint64_t)( ((x) << (b)) | ( (x) >> (64 - (b))) ) @@ -87,6 +87,13 @@ uint64_t siphash24(const void *src, unsigned long src_sz, const struct sipkey *k v0 ^= mi; } +#ifdef __COVERITY__ + { + uint64_t mi = 0; + memcpy(&mi, m+i, (src_sz-blocks)); + last7 = _le64toh(mi) | (uint64_t)(src_sz & 0xff) << 56; + } +#else switch (src_sz - blocks) { case 7: last7 |= (uint64_t)m[i + 6] << 48; FALLTHROUGH; case 6: last7 |= (uint64_t)m[i + 5] << 40; FALLTHROUGH; @@ -98,6 +105,7 @@ uint64_t siphash24(const void *src, unsigned long src_sz, const struct sipkey *k case 0: default:; } +#endif v3 ^= last7; DOUBLE_ROUND(v0,v1,v2,v3); v0 ^= last7; @@ -112,13 +120,13 @@ static int the_siphash_key_is_set = 0; static struct sipkey the_siphash_key; uint64_t siphash24g(const void *src, unsigned long src_sz) { - tor_assert(the_siphash_key_is_set); + raw_assert(the_siphash_key_is_set); return siphash24(src, src_sz, &the_siphash_key); } void siphash_set_global_key(const struct sipkey *key) { - tor_assert(! the_siphash_key_is_set); + raw_assert(! the_siphash_key_is_set); the_siphash_key.k0 = key->k0; the_siphash_key.k1 = key->k1; the_siphash_key_is_set = 1; diff --git a/src/ext/include.am b/src/ext/include.am index 6bdce2d79e..317e25d78e 100644 --- a/src/ext/include.am +++ b/src/ext/include.am @@ -143,6 +143,7 @@ noinst_HEADERS += $(ED25519_DONNA_HDRS) LIBED25519_DONNA=src/ext/ed25519/donna/libed25519_donna.a noinst_LIBRARIES += $(LIBED25519_DONNA) +if BUILD_KECCAK_TINY src_ext_keccak_tiny_libkeccak_tiny_a_CFLAGS=\ @CFLAGS_CONSTTIME@ @@ -156,6 +157,7 @@ noinst_HEADERS += $(LIBKECCAK_TINY_HDRS) LIBKECCAK_TINY=src/ext/keccak-tiny/libkeccak-tiny.a noinst_LIBRARIES += $(LIBKECCAK_TINY) +endif EXTRA_DIST += \ src/ext/timeouts/bench/bench-add.lua \ diff --git a/src/ext/readpassphrase.c b/src/ext/readpassphrase.c index e0df05d7b7..16611af1e2 100644 --- a/src/ext/readpassphrase.c +++ b/src/ext/readpassphrase.c @@ -30,7 +30,7 @@ #include <signal.h> #include <ctype.h> #include <fcntl.h> -#include "tor_readpassphrase.h" +#include "ext/tor_readpassphrase.h" #include <errno.h> #include <string.h> #include <unistd.h> diff --git a/src/ext/timeouts/.may_include b/src/ext/timeouts/.may_include new file mode 100644 index 0000000000..92c7116555 --- /dev/null +++ b/src/ext/timeouts/.may_include @@ -0,0 +1,5 @@ +orconfig.h + +ext/tor_queue.h +ext/timeouts/*.h +ext/timeouts/timeout-bitops.c diff --git a/src/ext/timeouts/test-timeout.c b/src/ext/timeouts/test-timeout.c index 8077129376..52d2e31e0c 100644 --- a/src/ext/timeouts/test-timeout.c +++ b/src/ext/timeouts/test-timeout.c @@ -4,7 +4,7 @@ #include <assert.h> #include <limits.h> -#include "timeout.h" +#include "ext/timeouts/timeout.h" #define THE_END_OF_TIME ((timeout_t)-1) diff --git a/src/ext/timeouts/timeout.c b/src/ext/timeouts/timeout.c index d4b514d2c5..79fcc168ed 100644 --- a/src/ext/timeouts/timeout.c +++ b/src/ext/timeouts/timeout.c @@ -38,16 +38,16 @@ #include <errno.h> /* errno */ -#include "tor_queue.h" /* TAILQ(3) */ +#include "ext/tor_queue.h" /* TAILQ(3) */ -#include "timeout.h" +#include "ext/timeouts/timeout.h" #ifndef TIMEOUT_DEBUG #define TIMEOUT_DEBUG 0 #endif #if TIMEOUT_DEBUG - 0 -#include "timeout-debug.h" +#include "ext/timeouts/timeout-debug.h" #endif #ifdef TIMEOUT_DISABLE_RELATIVE_ACCESS @@ -141,7 +141,7 @@ #define WHEEL_MASK (WHEEL_LEN - 1) #define TIMEOUT_MAX ((TIMEOUT_C(1) << (WHEEL_BIT * WHEEL_NUM)) - 1) -#include "timeout-bitops.c" +#include "ext/timeouts/timeout-bitops.c" #if WHEEL_BIT == 6 #define ctz(n) ctz64(n) @@ -531,7 +531,7 @@ static timeout_t timeouts_int(struct timeouts *T) { timeout = MIN(_timeout, timeout); } - relmask <<= WHEEL_BIT; + relmask <<= WHEEL_BIT; relmask |= WHEEL_MASK; } @@ -751,4 +751,3 @@ TIMEOUT_PUBLIC int timeout_v_abi(void) { TIMEOUT_PUBLIC int timeout_v_api(void) { return TIMEOUT_V_API; } /* timeout_version() */ - diff --git a/src/ext/timeouts/timeout.h b/src/ext/timeouts/timeout.h index b35874e153..1ed309fd08 100644 --- a/src/ext/timeouts/timeout.h +++ b/src/ext/timeouts/timeout.h @@ -31,7 +31,7 @@ #include <inttypes.h> /* PRIu64 PRIx64 PRIX64 uint64_t */ -#include "tor_queue.h" /* TAILQ(3) */ +#include "ext/tor_queue.h" /* TAILQ(3) */ /* @@ -147,7 +147,7 @@ TIMEOUT_PUBLIC struct timeout *timeout_init(struct timeout *, int); #ifndef TIMEOUT_DISABLE_RELATIVE_ACCESS TIMEOUT_PUBLIC bool timeout_pending(struct timeout *); /* true if on timing wheel, false otherwise */ - + TIMEOUT_PUBLIC bool timeout_expired(struct timeout *); /* true if on expired queue, false otherwise */ diff --git a/src/ext/tinytest.c b/src/ext/tinytest.c index 16f11e4639..239fdd0a38 100644 --- a/src/ext/tinytest.c +++ b/src/ext/tinytest.c @@ -492,6 +492,12 @@ tinytest_set_test_skipped_(void) cur_test_outcome = SKIP; } +int +tinytest_cur_test_has_failed(void) +{ + return (cur_test_outcome == FAIL); +} + char * tinytest_format_hex_(const void *val_, unsigned long len) { diff --git a/src/ext/tinytest.h b/src/ext/tinytest.h index ed07b26bc0..05c2fda052 100644 --- a/src/ext/tinytest.h +++ b/src/ext/tinytest.h @@ -72,6 +72,9 @@ struct testlist_alias_t { }; #define END_OF_ALIASES { NULL, NULL } +/** Return true iff the current test has failed. */ +int tinytest_cur_test_has_failed(void); + /** Implementation: called from a test to indicate failure, before logging. */ void tinytest_set_test_failed_(void); /** Implementation: called from a test to indicate that we're skipping. */ diff --git a/src/ext/trunnel/trunnel-impl.h b/src/ext/trunnel/trunnel-impl.h index 15d1c8633e..52afa9ccd4 100644 --- a/src/ext/trunnel/trunnel-impl.h +++ b/src/ext/trunnel/trunnel-impl.h @@ -1,4 +1,4 @@ -/* trunnel-impl.h -- copied from Trunnel v1.5.2 +/* trunnel-impl.h -- copied from Trunnel v1.5.3 * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ diff --git a/src/ext/trunnel/trunnel.c b/src/ext/trunnel/trunnel.c index 3ae3fe02c8..01a55c5bec 100644 --- a/src/ext/trunnel/trunnel.c +++ b/src/ext/trunnel/trunnel.c @@ -1,4 +1,4 @@ -/* trunnel.c -- copied from Trunnel v1.5.2 +/* trunnel.c -- copied from Trunnel v1.5.3 * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ diff --git a/src/ext/trunnel/trunnel.h b/src/ext/trunnel/trunnel.h index 9b708437b8..87c75f4ec3 100644 --- a/src/ext/trunnel/trunnel.h +++ b/src/ext/trunnel/trunnel.h @@ -1,4 +1,4 @@ -/* trunnel.h -- copied from Trunnel v1.5.2 +/* trunnel.h -- copied from Trunnel v1.5.3 * https://gitweb.torproject.org/trunnel.git * You probably shouldn't edit this file. */ |