diff options
Diffstat (limited to 'src')
248 files changed, 579 insertions, 936 deletions
diff --git a/src/common/address.h b/src/common/address.h index 2c9c620c2a..317c7f329c 100644 --- a/src/common/address.h +++ b/src/common/address.h @@ -13,7 +13,7 @@ //#include <sys/sockio.h> #include "orconfig.h" -#include "common/torint.h" +#include "lib/cc/torint.h" #include "common/compat.h" #include "common/container.h" diff --git a/src/common/address_set.c b/src/common/address_set.c index 763db64280..65c4cbf1e1 100644 --- a/src/common/address_set.c +++ b/src/common/address_set.c @@ -15,7 +15,7 @@ #include "common/address.h" #include "common/compat.h" #include "common/container.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "common/util.h" #include "siphash.h" diff --git a/src/common/address_set.h b/src/common/address_set.h index f4986c9b02..cfee89cfb8 100644 --- a/src/common/address_set.h +++ b/src/common/address_set.h @@ -14,7 +14,7 @@ #define TOR_ADDRESS_SET_H #include "orconfig.h" -#include "common/torint.h" +#include "lib/cc/torint.h" /** * An address_set_t represents a set of tor_addr_t values. The implementation diff --git a/src/common/buffers.c b/src/common/buffers.c index 997bbdcccb..41f98ddf7c 100644 --- a/src/common/buffers.c +++ b/src/common/buffers.c @@ -23,9 +23,9 @@ #include <stddef.h> #include "common/buffers.h" #include "common/compat.h" -#include "common/compress.h" +#include "lib/compress/compress.h" #include "common/util.h" -#include "common/torint.h" +#include "lib/cc/torint.h" #include "common/torlog.h" #ifdef HAVE_UNISTD_H #include <unistd.h> diff --git a/src/common/buffers.h b/src/common/buffers.h index 5cd9d3ec67..80103af776 100644 --- a/src/common/buffers.h +++ b/src/common/buffers.h @@ -13,8 +13,8 @@ #define TOR_BUFFERS_H #include "common/compat.h" -#include "common/torint.h" -#include "common/testsupport.h" +#include "lib/cc/torint.h" +#include "lib/testsupport/testsupport.h" typedef struct buf_t buf_t; diff --git a/src/common/compat.h b/src/common/compat.h index da9bd8bcc4..dff29a42b0 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -14,8 +14,8 @@ #define SIO_IDEAL_SEND_BACKLOG_QUERY 0x4004747b #endif #endif -#include "common/torint.h" -#include "common/testsupport.h" +#include "lib/cc/torint.h" +#include "lib/testsupport/testsupport.h" #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> #endif @@ -45,7 +45,7 @@ #include <netinet6/in6.h> #endif -#include "common/compat_compiler.h" +#include "lib/cc/compat_compiler.h" #include "common/compat_time.h" #include <stdio.h> @@ -78,54 +78,6 @@ size_t strlcat(char *dst, const char *src, size_t siz) ATTR_NONNULL((1,2)); size_t strlcpy(char *dst, const char *src, size_t siz) ATTR_NONNULL((1,2)); #endif -#ifdef _MSC_VER -/** Casts the uint64_t value in <b>a</b> to the right type for an argument - * to printf. */ -#define U64_PRINTF_ARG(a) (a) -/** Casts the uint64_t* value in <b>a</b> to the right type for an argument - * to scanf. */ -#define U64_SCANF_ARG(a) (a) -/** Expands to a literal uint64_t-typed constant for the value <b>n</b>. */ -#define U64_LITERAL(n) (n ## ui64) -#define I64_PRINTF_ARG(a) (a) -#define I64_SCANF_ARG(a) (a) -#define I64_LITERAL(n) (n ## i64) -#else /* !(defined(_MSC_VER)) */ -#define U64_PRINTF_ARG(a) ((long long unsigned int)(a)) -#define U64_SCANF_ARG(a) ((long long unsigned int*)(a)) -#define U64_LITERAL(n) (n ## llu) -#define I64_PRINTF_ARG(a) ((long long signed int)(a)) -#define I64_SCANF_ARG(a) ((long long signed int*)(a)) -#define I64_LITERAL(n) (n ## ll) -#endif /* defined(_MSC_VER) */ - -#if defined(__MINGW32__) || defined(__MINGW64__) -#define MINGW_ANY -#endif - -#if defined(_MSC_VER) || defined(MINGW_ANY) -/** The formatting string used to put a uint64_t value in a printf() or - * scanf() function. See also U64_PRINTF_ARG and U64_SCANF_ARG. */ -#define U64_FORMAT "%I64u" -#define I64_FORMAT "%I64d" -#else /* !(defined(_MSC_VER) || defined(MINGW_ANY)) */ -#define U64_FORMAT "%llu" -#define I64_FORMAT "%lld" -#endif /* defined(_MSC_VER) || defined(MINGW_ANY) */ - -#if (SIZEOF_INTPTR_T == SIZEOF_INT) -#define INTPTR_T_FORMAT "%d" -#define INTPTR_PRINTF_ARG(x) ((int)(x)) -#elif (SIZEOF_INTPTR_T == SIZEOF_LONG) -#define INTPTR_T_FORMAT "%ld" -#define INTPTR_PRINTF_ARG(x) ((long)(x)) -#elif (SIZEOF_INTPTR_T == 8) -#define INTPTR_T_FORMAT I64_FORMAT -#define INTPTR_PRINTF_ARG(x) I64_PRINTF_ARG(x) -#else -#error Unknown: SIZEOF_INTPTR_T -#endif /* (SIZEOF_INTPTR_T == SIZEOF_INT) || ... */ - /** Represents an mmaped file. Allocated via tor_mmap_file; freed with * tor_munmap_file. */ typedef struct tor_mmap_t { diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c index c99de1ac34..e3216bfc44 100644 --- a/src/common/compat_libevent.c +++ b/src/common/compat_libevent.c @@ -11,7 +11,7 @@ #define COMPAT_LIBEVENT_PRIVATE #include "common/compat_libevent.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "common/util.h" #include "common/torlog.h" diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h index 76a074d93a..4b2672b7b5 100644 --- a/src/common/compat_libevent.h +++ b/src/common/compat_libevent.h @@ -5,7 +5,7 @@ #define TOR_COMPAT_LIBEVENT_H #include "orconfig.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" void configure_libevent_logging(void); void suppress_libevent_log_msg(const char *msg); diff --git a/src/common/compat_threads.h b/src/common/compat_threads.h index 5d3883043d..19e0a4f119 100644 --- a/src/common/compat_threads.h +++ b/src/common/compat_threads.h @@ -7,8 +7,8 @@ #define TOR_COMPAT_THREADS_H #include "orconfig.h" -#include "common/torint.h" -#include "common/testsupport.h" +#include "lib/cc/torint.h" +#include "lib/testsupport/testsupport.h" #if defined(HAVE_PTHREAD_H) && !defined(_WIN32) #include <pthread.h> diff --git a/src/common/container.c b/src/common/container.c index c66ea012a9..c30e84ba24 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -15,7 +15,7 @@ #include "common/util.h" #include "common/torlog.h" #include "common/container.h" -#include "common/crypto_digest.h" +#include "lib/crypt_ops/crypto_digest.h" #include <stdlib.h> #include <string.h> diff --git a/src/common/include.am b/src/common/include.am index fa12888ac0..29bbdd7696 100644 --- a/src/common/include.am +++ b/src/common/include.am @@ -1,13 +1,11 @@ noinst_LIBRARIES += \ src/common/libor.a \ - src/common/libor-crypto.a \ src/common/libor-event.a if UNITTESTS_ENABLED noinst_LIBRARIES += \ src/common/libor-testing.a \ - src/common/libor-crypto-testing.a \ src/common/libor-event-testing.a endif @@ -19,31 +17,6 @@ else libor_extra_source= endif -src_common_libcurve25519_donna_a_CFLAGS= - -if BUILD_CURVE25519_DONNA -src_common_libcurve25519_donna_a_SOURCES=\ - src/ext/curve25519_donna/curve25519-donna.c -# See bug 13538 -- this code is known to have signed overflow issues. -src_common_libcurve25519_donna_a_CFLAGS+=\ - @F_OMIT_FRAME_POINTER@ @CFLAGS_CONSTTIME@ -noinst_LIBRARIES+=src/common/libcurve25519_donna.a -LIBDONNA=src/common/libcurve25519_donna.a -else -if BUILD_CURVE25519_DONNA_C64 -src_common_libcurve25519_donna_a_CFLAGS+=@CFLAGS_CONSTTIME@ -src_common_libcurve25519_donna_a_SOURCES=\ - src/ext/curve25519_donna/curve25519-donna-c64.c -noinst_LIBRARIES+=src/common/libcurve25519_donna.a -LIBDONNA=src/common/libcurve25519_donna.a -else -LIBDONNA= -endif -endif - -LIBDONNA += $(LIBED25519_REF10) -LIBDONNA += $(LIBED25519_DONNA) - if THREADS_PTHREADS threads_impl_source=src/common/compat_pthreads.c endif @@ -68,7 +41,6 @@ LIBOR_A_SRC = \ src/common/container.c \ src/common/log.c \ src/common/memarea.c \ - src/common/pubsub.c \ src/common/util.c \ src/common/util_bug.c \ src/common/util_format.c \ @@ -84,29 +56,6 @@ LIBOR_A_SRC = \ src/common/src_common_libor_testing_a-log.$(OBJEXT) \ src/common/log.$(OBJEXT): micro-revision.i -LIBOR_CRYPTO_A_SRC = \ - src/common/aes.c \ - src/common/buffers_tls.c \ - src/common/compress.c \ - src/common/compress_lzma.c \ - src/common/compress_none.c \ - src/common/compress_zlib.c \ - src/common/compress_zstd.c \ - src/common/crypto.c \ - src/common/crypto_dh.c \ - src/common/crypto_digest.c \ - src/common/crypto_format.c \ - src/common/crypto_hkdf.c \ - src/common/crypto_openssl_mgt.c \ - src/common/crypto_pwbox.c \ - src/common/crypto_rand.c \ - src/common/crypto_rsa.c \ - src/common/crypto_s2k.c \ - src/common/crypto_util.c \ - src/common/tortls.c \ - src/common/crypto_curve25519.c \ - src/common/crypto_ed25519.c - LIBOR_EVENT_A_SRC = \ src/common/compat_libevent.c \ src/common/procmon.c \ @@ -114,72 +63,40 @@ LIBOR_EVENT_A_SRC = \ src/ext/timeouts/timeout.c src_common_libor_a_SOURCES = $(LIBOR_A_SRC) -src_common_libor_crypto_a_SOURCES = $(LIBOR_CRYPTO_A_SRC) src_common_libor_event_a_SOURCES = $(LIBOR_EVENT_A_SRC) if UNITTESTS_ENABLED src_common_libor_testing_a_SOURCES = $(LIBOR_A_SRC) -src_common_libor_crypto_testing_a_SOURCES = $(LIBOR_CRYPTO_A_SRC) src_common_libor_event_testing_a_SOURCES = $(LIBOR_EVENT_A_SRC) else src_common_libor_testing_a_SOURCES = -src_common_libor_crypto_testing_a_SOURCES = src_common_libor_event_testing_a_SOURCES = endif src_common_libor_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS) -src_common_libor_crypto_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS) src_common_libor_event_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS) src_common_libor_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) -src_common_libor_crypto_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) src_common_libor_event_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) COMMONHEADERS = \ src/common/address.h \ src/common/address_set.h \ src/common/buffers.h \ - src/common/buffers_tls.h \ - src/common/aes.h \ - src/common/ciphers.inc \ src/common/compat.h \ - src/common/compat_compiler.h \ src/common/compat_libevent.h \ - src/common/compat_openssl.h \ src/common/compat_threads.h \ src/common/compat_time.h \ - src/common/compress.h \ - src/common/compress_lzma.h \ - src/common/compress_none.h \ - src/common/compress_zlib.h \ - src/common/compress_zstd.h \ src/common/confline.h \ src/common/container.h \ - src/common/crypto.h \ - src/common/crypto_dh.h \ - src/common/crypto_digest.h \ - src/common/crypto_curve25519.h \ - src/common/crypto_ed25519.h \ - src/common/crypto_format.h \ - src/common/crypto_hkdf.h \ - src/common/crypto_openssl_mgt.h \ - src/common/crypto_pwbox.h \ - src/common/crypto_rand.h \ - src/common/crypto_rsa.h \ - src/common/crypto_s2k.h \ - src/common/crypto_util.h \ src/common/handles.h \ src/common/memarea.h \ src/common/linux_syscalls.inc \ src/common/procmon.h \ - src/common/pubsub.h \ src/common/sandbox.h \ src/common/storagedir.h \ - src/common/testsupport.h \ src/common/timers.h \ src/common/token_bucket.h \ - src/common/torint.h \ src/common/torlog.h \ - src/common/tortls.h \ src/common/util.h \ src/common/util_bug.h \ src/common/util_format.h \ diff --git a/src/common/pubsub.c b/src/common/pubsub.c deleted file mode 100644 index 93e8b5e6ef..0000000000 --- a/src/common/pubsub.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ -/* See LICENSE for licensing information */ - -/** - * \file pubsub.c - * - * \brief DOCDOC - */ - -#include "orconfig.h" -#include "common/pubsub.h" -#include "common/container.h" - -/** Helper: insert <b>s</b> into <b>topic's</b> list of subscribers, keeping - * them sorted in priority order. */ -static void -subscriber_insert(pubsub_topic_t *topic, pubsub_subscriber_t *s) -{ - int i; - smartlist_t *sl = topic->subscribers; - for (i = 0; i < smartlist_len(sl); ++i) { - pubsub_subscriber_t *other = smartlist_get(sl, i); - if (s->priority < other->priority) { - break; - } - } - smartlist_insert(sl, i, s); -} - -/** - * Add a new subscriber to <b>topic</b>, where (when an event is triggered), - * we'll notify the function <b>fn</b> by passing it <b>subscriber_data</b>. - * Return a handle to the subscribe which can later be passed to - * pubsub_unsubscribe_(). - * - * Functions are called in priority order, from lowest to highest. - * - * See pubsub.h for <b>subscribe_flags</b>. - */ -const pubsub_subscriber_t * -pubsub_subscribe_(pubsub_topic_t *topic, - pubsub_subscriber_fn_t fn, - void *subscriber_data, - unsigned subscribe_flags, - unsigned priority) -{ - tor_assert(! topic->locked); - if (subscribe_flags & SUBSCRIBE_ATSTART) { - tor_assert(topic->n_events_fired == 0); - } - pubsub_subscriber_t *r = tor_malloc_zero(sizeof(*r)); - r->priority = priority; - r->subscriber_flags = subscribe_flags; - r->fn = fn; - r->subscriber_data = subscriber_data; - if (topic->subscribers == NULL) { - topic->subscribers = smartlist_new(); - } - subscriber_insert(topic, r); - return r; -} - -/** - * Remove the subscriber <b>s</b> from <b>topic</b>. After calling this - * function, <b>s</b> may no longer be used. - */ -int -pubsub_unsubscribe_(pubsub_topic_t *topic, - const pubsub_subscriber_t *s) -{ - tor_assert(! topic->locked); - smartlist_t *sl = topic->subscribers; - if (sl == NULL) - return -1; - int i = smartlist_pos(sl, s); - if (i == -1) - return -1; - pubsub_subscriber_t *tmp = smartlist_get(sl, i); - tor_assert(tmp == s); - smartlist_del_keeporder(sl, i); - tor_free(tmp); - return 0; -} - -/** - * For every subscriber s in <b>topic</b>, invoke notify_fn on s and - * event_data. Return 0 if there were no nonzero return values, and -1 if - * there were any. - */ -int -pubsub_notify_(pubsub_topic_t *topic, pubsub_notify_fn_t notify_fn, - void *event_data, unsigned notify_flags) -{ - tor_assert(! topic->locked); - (void) notify_flags; - smartlist_t *sl = topic->subscribers; - int n_bad = 0; - ++topic->n_events_fired; - if (sl == NULL) - return -1; - topic->locked = 1; - SMARTLIST_FOREACH_BEGIN(sl, pubsub_subscriber_t *, s) { - int r = notify_fn(s, event_data); - if (r != 0) - ++n_bad; - } SMARTLIST_FOREACH_END(s); - topic->locked = 0; - return (n_bad == 0) ? 0 : -1; -} - -/** - * Release all storage held by <b>topic</b>. - */ -void -pubsub_clear_(pubsub_topic_t *topic) -{ - tor_assert(! topic->locked); - - smartlist_t *sl = topic->subscribers; - if (sl == NULL) - return; - SMARTLIST_FOREACH_BEGIN(sl, pubsub_subscriber_t *, s) { - tor_free(s); - } SMARTLIST_FOREACH_END(s); - smartlist_free(sl); - topic->subscribers = NULL; - topic->n_events_fired = 0; -} - diff --git a/src/common/pubsub.h b/src/common/pubsub.h deleted file mode 100644 index 628732b67f..0000000000 --- a/src/common/pubsub.h +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ -/* See LICENSE for licensing information */ - -/** - * \file pubsub.h - * \brief Macros to implement publish/subscribe abstractions. - * - * To use these macros, call DECLARE_PUBSUB_TOPIC() with an identifier to use - * as your topic. Below, I'm going to assume you say DECLARE_PUBSUB_TOPIC(T). - * - * Doing this will declare the following types: - * typedef struct T_event_data_t T_event_data_t; // you define this struct - * typedef struct T_subscriber_data_t T_subscriber_data_t; // this one too. - * typedef struct T_subscriber_t T_subscriber_t; // opaque - * typedef int (*T_subscriber_fn_t)(T_event_data_t*, T_subscriber_data_t*); - * - * and it will declare the following functions: - * const T_subscriber_t *T_subscribe(T_subscriber_fn_t, - * T_subscriber_data_t *, - * unsigned flags, - * unsigned priority); - * int T_unsubscribe(const T_subscriber_t *) - * - * Elsewhere you can say DECLARE_NOTIFY_PUBSUB_TOPIC(static, T), which - * declares: - * - * static int T_notify(T_event_data_t *, unsigned notify_flags); - * static void T_clear(void); - * - * And in some C file, you would define these functions with: - * IMPLEMENT_PUBSUB_TOPIC(static, T). - * - * The implementations will be small typesafe wrappers over generic versions - * of the above functions. - * - * To use the typesafe functions, you add any number of subscribers with - * T_subscribe(). Each has an associated function pointer, data pointer, - * and priority. Later, you can invoke T_notify() to declare that the - * event has occurred. Each of the subscribers will be invoked once. - **/ - -#ifndef TOR_PUBSUB_H -#define TOR_PUBSUB_H - -#include "common/torint.h" - -/** - * Flag for T_subscribe: die with an assertion failure if the event - * have ever been published before. Used when a subscriber must absolutely - * never have missed an event. - */ -#define SUBSCRIBE_ATSTART (1u<<0) - -#define DECLARE_PUBSUB_STRUCT_TYPES(name) \ - /* You define this type. */ \ - typedef struct name ## _event_data_t name ## _event_data_t; \ - /* You define this type. */ \ - typedef struct name ## _subscriber_data_t name ## _subscriber_data_t; - -#define DECLARE_PUBSUB_TOPIC(name) \ - /* This type is opaque. */ \ - typedef struct name ## _subscriber_t name ## _subscriber_t; \ - /* You declare functions matching this type. */ \ - typedef int (*name ## _subscriber_fn_t)( \ - name ## _event_data_t *data, \ - name ## _subscriber_data_t *extra); \ - /* Call this function to subscribe to a topic. */ \ - const name ## _subscriber_t *name ## _subscribe( \ - name##_subscriber_fn_t subscriber, \ - name##_subscriber_data_t *extra_data, \ - unsigned flags, \ - unsigned priority); \ - /* Call this function to unsubscribe from a topic. */ \ - int name ## _unsubscribe(const name##_subscriber_t *s); - -#define DECLARE_NOTIFY_PUBSUB_TOPIC(linkage, name) \ - /* Call this function to notify all subscribers. Flags not yet used. */ \ - linkage int name ## _notify(name ## _event_data_t *data, unsigned flags); \ - /* Call this function to release storage held by the topic. */ \ - linkage void name ## _clear(void); - -/** - * Type used to hold a generic function for a subscriber. - * - * [Yes, it is safe to cast to this, so long as we cast back to the original - * type before calling. From C99: "A pointer to a function of one type may be - * converted to a pointer to a function of another type and back again; the - * result shall compare equal to the original pointer."] -*/ -typedef int (*pubsub_subscriber_fn_t)(void *, void *); - -/** - * Helper type to implement pubsub abstraction. Don't use this directly. - * It represents a subscriber. - */ -typedef struct pubsub_subscriber_t { - /** Function to invoke when the event triggers. */ - pubsub_subscriber_fn_t fn; - /** Data associated with this subscriber. */ - void *subscriber_data; - /** Priority for this subscriber. Low priorities happen first. */ - unsigned priority; - /** Flags set on this subscriber. Not yet used.*/ - unsigned subscriber_flags; -} pubsub_subscriber_t; - -/** - * Helper type to implement pubsub abstraction. Don't use this directly. - * It represents a topic, and keeps a record of subscribers. - */ -typedef struct pubsub_topic_t { - /** List of subscribers to this topic. May be NULL. */ - struct smartlist_t *subscribers; - /** Total number of times that pubsub_notify_() has ever been called on this - * topic. */ - uint64_t n_events_fired; - /** True iff we're running 'notify' on this topic, and shouldn't allow - * any concurrent modifications or events. */ - unsigned locked; -} pubsub_topic_t; - -const pubsub_subscriber_t *pubsub_subscribe_(pubsub_topic_t *topic, - pubsub_subscriber_fn_t fn, - void *subscriber_data, - unsigned subscribe_flags, - unsigned priority); -int pubsub_unsubscribe_(pubsub_topic_t *topic, const pubsub_subscriber_t *sub); -void pubsub_clear_(pubsub_topic_t *topic); -typedef int (*pubsub_notify_fn_t)(pubsub_subscriber_t *subscriber, - void *notify_data); -int pubsub_notify_(pubsub_topic_t *topic, pubsub_notify_fn_t notify_fn, - void *notify_data, unsigned notify_flags); - -#define IMPLEMENT_PUBSUB_TOPIC(notify_linkage, name) \ - static pubsub_topic_t name ## _topic_ = { NULL, 0, 0 }; \ - const name ## _subscriber_t * \ - name ## _subscribe(name##_subscriber_fn_t subscriber, \ - name##_subscriber_data_t *extra_data, \ - unsigned flags, \ - unsigned priority) \ - { \ - const pubsub_subscriber_t *s; \ - s = pubsub_subscribe_(&name##_topic_, \ - (pubsub_subscriber_fn_t)subscriber, \ - extra_data, \ - flags, \ - priority); \ - return (const name##_subscriber_t *)s; \ - } \ - int \ - name ## _unsubscribe(const name##_subscriber_t *subscriber) \ - { \ - return pubsub_unsubscribe_(&name##_topic_, \ - (const pubsub_subscriber_t *)subscriber); \ - } \ - static int \ - name##_call_the_notify_fn_(pubsub_subscriber_t *subscriber, \ - void *notify_data) \ - { \ - name ## _subscriber_fn_t fn; \ - fn = (name ## _subscriber_fn_t) subscriber->fn; \ - return fn(notify_data, subscriber->subscriber_data); \ - } \ - notify_linkage int \ - name ## _notify(name ## _event_data_t *event_data, unsigned flags) \ - { \ - return pubsub_notify_(&name##_topic_, \ - name##_call_the_notify_fn_, \ - event_data, \ - flags); \ - } \ - notify_linkage void \ - name ## _clear(void) \ - { \ - pubsub_clear_(&name##_topic_); \ - } - -#endif /* !defined(TOR_PUBSUB_H) */ - diff --git a/src/common/sandbox.c b/src/common/sandbox.c index 4fc1327307..a33463f74b 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -36,7 +36,7 @@ #include "common/container.h" #include "lib/err/torerr.h" #include "common/torlog.h" -#include "common/torint.h" +#include "lib/cc/torint.h" #include "common/util.h" #include "tor_queue.h" diff --git a/src/common/sandbox.h b/src/common/sandbox.h index 945d57df7e..f7c990e013 100644 --- a/src/common/sandbox.h +++ b/src/common/sandbox.h @@ -13,7 +13,7 @@ #define SANDBOX_H_ #include "orconfig.h" -#include "common/torint.h" +#include "lib/cc/torint.h" #ifndef SYS_SECCOMP diff --git a/src/common/timers.h b/src/common/timers.h index 6b6179ca7c..2348c7b7c1 100644 --- a/src/common/timers.h +++ b/src/common/timers.h @@ -5,7 +5,7 @@ #define TOR_TIMERS_H #include "orconfig.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" struct monotime_t; typedef struct timeout tor_timer_t; diff --git a/src/common/token_bucket.h b/src/common/token_bucket.h index 645c90c624..787317fa1f 100644 --- a/src/common/token_bucket.h +++ b/src/common/token_bucket.h @@ -9,8 +9,8 @@ #ifndef TOR_TOKEN_BUCKET_H #define TOR_TOKEN_BUCKET_H -#include "common/torint.h" -#include "common/testsupport.h" +#include "lib/cc/torint.h" +#include "lib/testsupport/testsupport.h" /** Largest allowable burst value for a token buffer. */ #define TOKEN_BUCKET_MAX_BURST INT32_MAX diff --git a/src/common/torlog.h b/src/common/torlog.h index 56f922d406..66141ab0ae 100644 --- a/src/common/torlog.h +++ b/src/common/torlog.h @@ -13,7 +13,7 @@ #ifndef TOR_TORLOG_H #include "common/compat.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" #ifdef HAVE_SYSLOG_H #include <syslog.h> diff --git a/src/common/util.c b/src/common/util.c index de46cc7c87..fd1bb815d4 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -16,8 +16,8 @@ #define UTIL_PRIVATE #include "common/util.h" #include "common/torlog.h" -#include "common/crypto_digest.h" -#include "common/torint.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/cc/torint.h" #include "common/container.h" #include "common/address.h" #include "common/sandbox.h" diff --git a/src/common/util.h b/src/common/util.h index b3c17db248..d1528886c8 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -12,10 +12,10 @@ #define TOR_UTIL_H #include "orconfig.h" -#include "common/torint.h" +#include "lib/cc/torint.h" #include "common/compat.h" #include "lib/ctime/di_ops.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" #include <stdio.h> #include <stdlib.h> #ifdef _WIN32 diff --git a/src/common/util_bug.h b/src/common/util_bug.h index 1d499a197d..9659f59b7e 100644 --- a/src/common/util_bug.h +++ b/src/common/util_bug.h @@ -38,7 +38,7 @@ #include "orconfig.h" #include "common/compat.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" /* Replace assert() with a variant that sends failures to the log before * calling assert() normally. diff --git a/src/common/util_format.c b/src/common/util_format.c index cab2572343..420d8a1a8f 100644 --- a/src/common/util_format.c +++ b/src/common/util_format.c @@ -15,7 +15,7 @@ #include "common/torlog.h" #include "common/util.h" #include "common/util_format.h" -#include "common/torint.h" +#include "lib/cc/torint.h" #include <stddef.h> #include <string.h> diff --git a/src/common/util_format.h b/src/common/util_format.h index 7dd5ae5bd8..3580c28637 100644 --- a/src/common/util_format.h +++ b/src/common/util_format.h @@ -7,8 +7,8 @@ #ifndef TOR_UTIL_FORMAT_H #define TOR_UTIL_FORMAT_H -#include "common/testsupport.h" -#include "common/torint.h" +#include "lib/testsupport/testsupport.h" +#include "lib/cc/torint.h" /** @{ */ /** These macros don't check for overflow. Use them only for constant inputs diff --git a/src/common/workqueue.c b/src/common/workqueue.c index 0d31a2ecca..be51e4f106 100644 --- a/src/common/workqueue.c +++ b/src/common/workqueue.c @@ -27,7 +27,7 @@ #include "common/compat.h" #include "common/compat_libevent.h" #include "common/compat_threads.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "common/util.h" #include "common/workqueue.h" #include "tor_queue.h" diff --git a/src/ext/OpenBSD_malloc_Linux.c b/src/ext/OpenBSD_malloc_Linux.c index 157462b9ac..9c30570c41 100644 --- a/src/ext/OpenBSD_malloc_Linux.c +++ b/src/ext/OpenBSD_malloc_Linux.c @@ -59,7 +59,7 @@ #include <errno.h> #include <err.h> /* For SIZE_MAX */ -#include "common/torint.h" +#include "lib/cc/torint.h" //#include "thread_private.h" diff --git a/src/ext/csiphash.c b/src/ext/csiphash.c index 36c3dee76e..f82e10b103 100644 --- a/src/ext/csiphash.c +++ b/src/ext/csiphash.c @@ -29,7 +29,7 @@ Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c) */ -#include "common/torint.h" +#include "lib/cc/torint.h" #include "siphash.h" /* for tor_assert */ #include "common/util.h" diff --git a/src/ext/curve25519_donna/curve25519-donna-c64.c b/src/ext/curve25519_donna/curve25519-donna-c64.c index d2d7fb434a..45da7bf1e6 100644 --- a/src/ext/curve25519_donna/curve25519-donna-c64.c +++ b/src/ext/curve25519_donna/curve25519-donna-c64.c @@ -25,7 +25,7 @@ #include "orconfig.h" #include <string.h> -#include "common/torint.h" +#include "lib/cc/torint.h" typedef uint8_t u8; typedef uint64_t limb; diff --git a/src/ext/curve25519_donna/curve25519-donna.c b/src/ext/curve25519_donna/curve25519-donna.c index 573e6e26a9..d64b95c113 100644 --- a/src/ext/curve25519_donna/curve25519-donna.c +++ b/src/ext/curve25519_donna/curve25519-donna.c @@ -48,7 +48,7 @@ #include "orconfig.h" #include <string.h> -#include "common/torint.h" +#include "lib/cc/torint.h" typedef uint8_t u8; typedef int32_t s32; diff --git a/src/ext/ed25519/donna/ed25519-hash-custom.h b/src/ext/ed25519/donna/ed25519-hash-custom.h index c176499911..ff8bbde3da 100644 --- a/src/ext/ed25519/donna/ed25519-hash-custom.h +++ b/src/ext/ed25519/donna/ed25519-hash-custom.h @@ -9,7 +9,7 @@ void ed25519_hash(uint8_t *hash, const uint8_t *in, size_t inlen); */ -#include "common/crypto_digest.h" +#include "lib/crypt_ops/crypto_digest.h" typedef struct ed25519_hash_context { crypto_digest_t *ctx; diff --git a/src/ext/ed25519/donna/ed25519-randombytes-custom.h b/src/ext/ed25519/donna/ed25519-randombytes-custom.h index ea7a649cdd..d92a51d1d3 100644 --- a/src/ext/ed25519/donna/ed25519-randombytes-custom.h +++ b/src/ext/ed25519/donna/ed25519-randombytes-custom.h @@ -8,7 +8,7 @@ */ /* Tor: Instead of calling OpenSSL's CSPRNG directly, call the wrapper. */ -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" static void ED25519_FN(ed25519_randombytes_unsafe) (void *p, size_t len) diff --git a/src/ext/ed25519/donna/ed25519_donna_tor.h b/src/ext/ed25519/donna/ed25519_donna_tor.h index dfaefc8658..20e9b5e99c 100644 --- a/src/ext/ed25519/donna/ed25519_donna_tor.h +++ b/src/ext/ed25519/donna/ed25519_donna_tor.h @@ -1,7 +1,7 @@ /* Added for Tor. */ #ifndef SRC_EXT_ED25519_DONNA_H_INCLUDED_ #define SRC_EXT_ED25519_DONNA_H_INCLUDED_ -#include "common/torint.h" +#include "lib/cc/torint.h" typedef unsigned char curved25519_key[32]; diff --git a/src/ext/ed25519/donna/ed25519_tor.c b/src/ext/ed25519/donna/ed25519_tor.c index c3d4e09cd5..7f5ab398d8 100644 --- a/src/ext/ed25519/donna/ed25519_tor.c +++ b/src/ext/ed25519/donna/ed25519_tor.c @@ -40,7 +40,7 @@ #include "ed25519-randombytes.h" #include "ed25519-hash.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" typedef unsigned char ed25519_signature[64]; typedef unsigned char ed25519_public_key[32]; diff --git a/src/ext/ed25519/ref10/blinding.c b/src/ext/ed25519/ref10/blinding.c index 6408491fa5..8485524e5d 100644 --- a/src/ext/ed25519/ref10/blinding.c +++ b/src/ext/ed25519/ref10/blinding.c @@ -7,7 +7,7 @@ #include "ed25519_ref10.h" #include <string.h> -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" static void ed25519_ref10_gettweak(unsigned char *out, const unsigned char *param) diff --git a/src/ext/ed25519/ref10/crypto_hash_sha512.h b/src/ext/ed25519/ref10/crypto_hash_sha512.h index 8ab0b45652..25e6a90cec 100644 --- a/src/ext/ed25519/ref10/crypto_hash_sha512.h +++ b/src/ext/ed25519/ref10/crypto_hash_sha512.h @@ -1,5 +1,5 @@ /* Added for Tor. */ -#include "common/crypto_digest.h" +#include "lib/crypt_ops/crypto_digest.h" /* Set 'out' to the 512-bit SHA512 hash of the 'len'-byte string in 'inp' */ #define crypto_hash_sha512(out, inp, len) \ diff --git a/src/ext/ed25519/ref10/crypto_int32.h b/src/ext/ed25519/ref10/crypto_int32.h index 59311a6201..26271e917b 100644 --- a/src/ext/ed25519/ref10/crypto_int32.h +++ b/src/ext/ed25519/ref10/crypto_int32.h @@ -3,7 +3,7 @@ #ifndef CRYPTO_INT32_H #define CRYPTO_INT32_H -#include "common/torint.h" +#include "lib/cc/torint.h" #define crypto_int32 int32_t #define crypto_uint32 uint32_t diff --git a/src/ext/ed25519/ref10/crypto_int64.h b/src/ext/ed25519/ref10/crypto_int64.h index 6dda30f2ed..3b066a9c0c 100644 --- a/src/ext/ed25519/ref10/crypto_int64.h +++ b/src/ext/ed25519/ref10/crypto_int64.h @@ -3,7 +3,7 @@ #ifndef CRYPTO_INT64_H #define CRYPTO_INT64_H -#include "common/torint.h" +#include "lib/cc/torint.h" #define crypto_int64 int64_t #define crypto_uint64 uint64_t diff --git a/src/ext/ed25519/ref10/crypto_uint32.h b/src/ext/ed25519/ref10/crypto_uint32.h index b12a595a10..a7a77723bd 100644 --- a/src/ext/ed25519/ref10/crypto_uint32.h +++ b/src/ext/ed25519/ref10/crypto_uint32.h @@ -1,3 +1,3 @@ /* Added for Tor. */ -#include "common/torint.h" +#include "lib/cc/torint.h" #define crypto_uint32 uint32_t diff --git a/src/ext/ed25519/ref10/crypto_uint64.h b/src/ext/ed25519/ref10/crypto_uint64.h index 73edfd1b5e..adaaa08042 100644 --- a/src/ext/ed25519/ref10/crypto_uint64.h +++ b/src/ext/ed25519/ref10/crypto_uint64.h @@ -1,3 +1,3 @@ /* Added for Tor. */ -#include "common/torint.h" +#include "lib/cc/torint.h" #define crypto_uint64 uint64_t diff --git a/src/ext/ed25519/ref10/ed25519_ref10.h b/src/ext/ed25519/ref10/ed25519_ref10.h index 15ac07e241..bb72af6c0b 100644 --- a/src/ext/ed25519/ref10/ed25519_ref10.h +++ b/src/ext/ed25519/ref10/ed25519_ref10.h @@ -1,7 +1,7 @@ /* Added for Tor */ #ifndef SRC_EXT_ED25519_REF10_H_INCLUDED_ #define SRC_EXT_ED25519_REF10_H_INCLUDED_ -#include "common/torint.h" +#include "lib/cc/torint.h" int ed25519_ref10_seckey(unsigned char *sk); int ed25519_ref10_seckey_expand(unsigned char *sk, const unsigned char *sk_seed); diff --git a/src/ext/ed25519/ref10/keypair.c b/src/ext/ed25519/ref10/keypair.c index 8ed0a4a8f5..a6e2d4c781 100644 --- a/src/ext/ed25519/ref10/keypair.c +++ b/src/ext/ed25519/ref10/keypair.c @@ -6,8 +6,8 @@ #include "crypto_hash_sha512.h" #include "ge.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" int crypto_sign_seckey(unsigned char *sk) diff --git a/src/ext/ed25519/ref10/randombytes.h b/src/ext/ed25519/ref10/randombytes.h index f5bc3b228d..c2cef10ceb 100644 --- a/src/ext/ed25519/ref10/randombytes.h +++ b/src/ext/ed25519/ref10/randombytes.h @@ -1,4 +1,4 @@ /* Added for Tor. */ -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #define randombytes(b, n) \ (crypto_strongest_rand((b), (n)), 0) diff --git a/src/ext/keccak-tiny/keccak-tiny-unrolled.c b/src/ext/keccak-tiny/keccak-tiny-unrolled.c index 233a73331c..05cf0ec3f0 100644 --- a/src/ext/keccak-tiny/keccak-tiny-unrolled.c +++ b/src/ext/keccak-tiny/keccak-tiny-unrolled.c @@ -9,7 +9,7 @@ #include "keccak-tiny.h" #include <string.h> -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "byteorder.h" /******** Endianness conversion helpers ********/ diff --git a/src/ext/keccak-tiny/keccak-tiny.h b/src/ext/keccak-tiny/keccak-tiny.h index 58e1d45342..a9c8ed6420 100644 --- a/src/ext/keccak-tiny/keccak-tiny.h +++ b/src/ext/keccak-tiny/keccak-tiny.h @@ -2,7 +2,7 @@ #define KECCAK_FIPS202_H #include <stddef.h> -#include "common/torint.h" +#include "lib/cc/torint.h" #define KECCAK_MAX_RATE 200 diff --git a/src/ext/mulodi/mulodi4.c b/src/ext/mulodi/mulodi4.c index ddd17cd1dd..accce1ce01 100644 --- a/src/ext/mulodi/mulodi4.c +++ b/src/ext/mulodi/mulodi4.c @@ -18,7 +18,7 @@ #define COMPILER_RT_ABI #define di_int int64_t #define di_uint uint64_t -#include "common/torint.h" +#include "lib/cc/torint.h" di_int __mulodi4(di_int a, di_int b, int* overflow); #endif diff --git a/src/include.am b/src/include.am index 296ac19b14..c70a681887 100644 --- a/src/include.am +++ b/src/include.am @@ -1,6 +1,13 @@ include src/ext/include.am include src/lib/err/include.am +include src/lib/cc/include.am include src/lib/ctime/include.am +include src/lib/compress/include.am +include src/lib/crypt_ops/include.am +include src/lib/include.libdonna.am +include src/lib/testsupport/include.am +include src/lib/tls/include.am +include src/lib/trace/include.am include src/common/include.am include src/trunnel/include.am include src/or/include.am @@ -10,4 +17,3 @@ include src/tools/include.am include src/win32/include.am include src/config/include.am include src/test/fuzz/include.am -include src/trace/include.am diff --git a/src/common/compat_compiler.h b/src/lib/cc/compat_compiler.h index a9a3266165..31e84bcc5b 100644 --- a/src/common/compat_compiler.h +++ b/src/lib/cc/compat_compiler.h @@ -194,4 +194,52 @@ #define OP_EQ == #define OP_NE != +#ifdef _MSC_VER +/** Casts the uint64_t value in <b>a</b> to the right type for an argument + * to printf. */ +#define U64_PRINTF_ARG(a) (a) +/** Casts the uint64_t* value in <b>a</b> to the right type for an argument + * to scanf. */ +#define U64_SCANF_ARG(a) (a) +/** Expands to a literal uint64_t-typed constant for the value <b>n</b>. */ +#define U64_LITERAL(n) (n ## ui64) +#define I64_PRINTF_ARG(a) (a) +#define I64_SCANF_ARG(a) (a) +#define I64_LITERAL(n) (n ## i64) +#else /* !(defined(_MSC_VER)) */ +#define U64_PRINTF_ARG(a) ((long long unsigned int)(a)) +#define U64_SCANF_ARG(a) ((long long unsigned int*)(a)) +#define U64_LITERAL(n) (n ## llu) +#define I64_PRINTF_ARG(a) ((long long signed int)(a)) +#define I64_SCANF_ARG(a) ((long long signed int*)(a)) +#define I64_LITERAL(n) (n ## ll) +#endif /* defined(_MSC_VER) */ + +#if defined(__MINGW32__) || defined(__MINGW64__) +#define MINGW_ANY +#endif + +#if defined(_MSC_VER) || defined(MINGW_ANY) +/** The formatting string used to put a uint64_t value in a printf() or + * scanf() function. See also U64_PRINTF_ARG and U64_SCANF_ARG. */ +#define U64_FORMAT "%I64u" +#define I64_FORMAT "%I64d" +#else /* !(defined(_MSC_VER) || defined(MINGW_ANY)) */ +#define U64_FORMAT "%llu" +#define I64_FORMAT "%lld" +#endif /* defined(_MSC_VER) || defined(MINGW_ANY) */ + +#if (SIZEOF_INTPTR_T == SIZEOF_INT) +#define INTPTR_T_FORMAT "%d" +#define INTPTR_PRINTF_ARG(x) ((int)(x)) +#elif (SIZEOF_INTPTR_T == SIZEOF_LONG) +#define INTPTR_T_FORMAT "%ld" +#define INTPTR_PRINTF_ARG(x) ((long)(x)) +#elif (SIZEOF_INTPTR_T == 8) +#define INTPTR_T_FORMAT I64_FORMAT +#define INTPTR_PRINTF_ARG(x) I64_PRINTF_ARG(x) +#else +#error Unknown: SIZEOF_INTPTR_T +#endif /* (SIZEOF_INTPTR_T == SIZEOF_INT) || ... */ + #endif /* !defined(TOR_COMPAT_H) */ diff --git a/src/lib/cc/include.am b/src/lib/cc/include.am new file mode 100644 index 0000000000..2ae90f97dd --- /dev/null +++ b/src/lib/cc/include.am @@ -0,0 +1,4 @@ + +noinst_HEADERS += \ + src/lib/cc/compat_compiler.h \ + src/lib/cc/torint.h diff --git a/src/common/torint.h b/src/lib/cc/torint.h index 55b15402f2..55b15402f2 100644 --- a/src/common/torint.h +++ b/src/lib/cc/torint.h diff --git a/src/common/compress.c b/src/lib/compress/compress.c index 44bb891af4..cb130b693b 100644 --- a/src/common/compress.c +++ b/src/lib/compress/compress.c @@ -13,7 +13,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include "common/torint.h" +#include "lib/cc/torint.h" #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> @@ -21,11 +21,11 @@ #include "common/util.h" #include "common/torlog.h" -#include "common/compress.h" -#include "common/compress_lzma.h" -#include "common/compress_none.h" -#include "common/compress_zlib.h" -#include "common/compress_zstd.h" +#include "lib/compress/compress.h" +#include "lib/compress/compress_lzma.h" +#include "lib/compress/compress_none.h" +#include "lib/compress/compress_zlib.h" +#include "lib/compress/compress_zstd.h" /** Total number of bytes allocated for compression state overhead. */ static atomic_counter_t total_compress_allocation; diff --git a/src/common/compress.h b/src/lib/compress/compress.h index 10ad6d86bc..10ad6d86bc 100644 --- a/src/common/compress.h +++ b/src/lib/compress/compress.h diff --git a/src/common/compress_lzma.c b/src/lib/compress/compress_lzma.c index 363dc1fb92..921aaa1d72 100644 --- a/src/common/compress_lzma.c +++ b/src/lib/compress/compress_lzma.c @@ -15,8 +15,8 @@ #include "common/util.h" #include "common/torlog.h" -#include "common/compress.h" -#include "common/compress_lzma.h" +#include "lib/compress/compress.h" +#include "lib/compress/compress_lzma.h" #ifdef HAVE_LZMA #include <lzma.h> diff --git a/src/common/compress_lzma.h b/src/lib/compress/compress_lzma.h index 9ef3382a25..9ef3382a25 100644 --- a/src/common/compress_lzma.h +++ b/src/lib/compress/compress_lzma.h diff --git a/src/common/compress_none.c b/src/lib/compress/compress_none.c index 7e67046d34..05a27e5cc3 100644 --- a/src/common/compress_none.c +++ b/src/lib/compress/compress_none.c @@ -18,8 +18,8 @@ #include "common/util.h" #include "common/torlog.h" -#include "common/compress.h" -#include "common/compress_none.h" +#include "lib/compress/compress.h" +#include "lib/compress/compress_none.h" /** Transfer some bytes using the identity transformation. Read up to * *<b>in_len</b> bytes from *<b>in</b>, and write up to *<b>out_len</b> bytes diff --git a/src/common/compress_none.h b/src/lib/compress/compress_none.h index 5c395bbb30..5c395bbb30 100644 --- a/src/common/compress_none.h +++ b/src/lib/compress/compress_none.h diff --git a/src/common/compress_zlib.c b/src/lib/compress/compress_zlib.c index 663e27f794..56dda8a2de 100644 --- a/src/common/compress_zlib.c +++ b/src/lib/compress/compress_zlib.c @@ -15,8 +15,8 @@ #include "common/util.h" #include "common/torlog.h" -#include "common/compress.h" -#include "common/compress_zlib.h" +#include "lib/compress/compress.h" +#include "lib/compress/compress_zlib.h" /* zlib 1.2.4 and 1.2.5 do some "clever" things with macros. Instead of saying "(defined(FOO) ? FOO : 0)" they like to say "FOO-0", on the theory diff --git a/src/common/compress_zlib.h b/src/lib/compress/compress_zlib.h index 7af68044de..7af68044de 100644 --- a/src/common/compress_zlib.h +++ b/src/lib/compress/compress_zlib.h diff --git a/src/common/compress_zstd.c b/src/lib/compress/compress_zstd.c index dc0dcdec93..37204ab5ef 100644 --- a/src/common/compress_zstd.c +++ b/src/lib/compress/compress_zstd.c @@ -15,8 +15,8 @@ #include "common/util.h" #include "common/torlog.h" -#include "common/compress.h" -#include "common/compress_zstd.h" +#include "lib/compress/compress.h" +#include "lib/compress/compress_zstd.h" #ifdef ENABLE_ZSTD_ADVANCED_APIS /* This is a lie, but we make sure it doesn't get us in trouble by wrapping diff --git a/src/common/compress_zstd.h b/src/lib/compress/compress_zstd.h index 1177537a9e..1177537a9e 100644 --- a/src/common/compress_zstd.h +++ b/src/lib/compress/compress_zstd.h diff --git a/src/lib/compress/include.am b/src/lib/compress/include.am new file mode 100644 index 0000000000..eb3a89c355 --- /dev/null +++ b/src/lib/compress/include.am @@ -0,0 +1,25 @@ + +noinst_LIBRARIES += src/lib/libtor-compress.a + +if UNITTESTS_ENABLED +noinst_LIBRARIES += src/lib/libtor-compress-testing.a +endif + +src_lib_libtor_compress_a_SOURCES = \ + src/lib/compress/compress.c \ + src/lib/compress/compress_lzma.c \ + src/lib/compress/compress_none.c \ + src/lib/compress/compress_zlib.c \ + src/lib/compress/compress_zstd.c + +src_lib_libtor_compress_testing_a_SOURCES = \ + $(src_lib_libtor_compress_a_SOURCES) +src_lib_libtor_compress_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS) +src_lib_libtor_compress_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) + +noinst_HEADERS += \ + src/lib/compress/compress.h \ + src/lib/compress/compress_lzma.h \ + src/lib/compress/compress_none.h \ + src/lib/compress/compress_zlib.h \ + src/lib/compress/compress_zstd.h diff --git a/src/common/aes.c b/src/lib/crypt_ops/aes.c index 70e48a74f3..c421453fdd 100644 --- a/src/common/aes.c +++ b/src/lib/crypt_ops/aes.c @@ -16,9 +16,9 @@ #include <ws2tcpip.h> #endif -#include "common/compat_openssl.h" +#include "lib/crypt_ops/compat_openssl.h" #include <openssl/opensslv.h> -#include "common/crypto_openssl_mgt.h" +#include "lib/crypt_ops/crypto_openssl_mgt.h" #if OPENSSL_VERSION_NUMBER < OPENSSL_V_SERIES(1,0,0) #error "We require OpenSSL >= 1.0.0" @@ -36,7 +36,7 @@ DISABLE_GCC_WARNING(redundant-decls) ENABLE_GCC_WARNING(redundant-decls) #include "common/compat.h" -#include "common/aes.h" +#include "lib/crypt_ops/aes.h" #include "common/util.h" #include "common/torlog.h" #include "lib/ctime/di_ops.h" diff --git a/src/common/aes.h b/src/lib/crypt_ops/aes.h index e1287d330e..e1287d330e 100644 --- a/src/common/aes.h +++ b/src/lib/crypt_ops/aes.h diff --git a/src/common/compat_openssl.h b/src/lib/crypt_ops/compat_openssl.h index a94b264927..317c01134a 100644 --- a/src/common/compat_openssl.h +++ b/src/lib/crypt_ops/compat_openssl.h @@ -8,7 +8,7 @@ #define TOR_COMPAT_OPENSSL_H #include <openssl/opensslv.h> -#include "common/crypto_openssl_mgt.h" +#include "lib/crypt_ops/crypto_openssl_mgt.h" /** * \file compat_openssl.h diff --git a/src/common/crypto.c b/src/lib/crypt_ops/crypto.c index 57eb9c64c9..b562578c59 100644 --- a/src/common/crypto.c +++ b/src/lib/crypt_ops/crypto.c @@ -23,16 +23,16 @@ #endif /* defined(_WIN32) */ #define CRYPTO_PRIVATE -#include "common/compat_openssl.h" -#include "common/crypto.h" -#include "common/crypto_curve25519.h" -#include "common/crypto_digest.h" -#include "common/crypto_dh.h" -#include "common/crypto_ed25519.h" -#include "common/crypto_format.h" -#include "common/crypto_rand.h" -#include "common/crypto_rsa.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/compat_openssl.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_dh.h" +#include "lib/crypt_ops/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_format.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_rsa.h" +#include "lib/crypt_ops/crypto_util.h" DISABLE_GCC_WARNING(redundant-decls) @@ -63,8 +63,8 @@ ENABLE_GCC_WARNING(redundant-decls) #endif #include "common/torlog.h" -#include "common/torint.h" -#include "common/aes.h" +#include "lib/cc/torint.h" +#include "lib/crypt_ops/aes.h" #include "common/util.h" #include "common/container.h" #include "common/compat.h" diff --git a/src/common/crypto.h b/src/lib/crypt_ops/crypto.h index e7d86eaf01..58afafed83 100644 --- a/src/common/crypto.h +++ b/src/lib/crypt_ops/crypto.h @@ -16,10 +16,10 @@ #include "orconfig.h" #include <stdio.h> -#include "common/torint.h" +#include "lib/cc/torint.h" #include "common/compat.h" #include "common/util.h" -#include "common/crypto_rsa.h" +#include "lib/crypt_ops/crypto_rsa.h" /** Length of our symmetric cipher's keys of 128-bit. */ #define CIPHER_KEY_LEN 16 diff --git a/src/common/crypto_curve25519.c b/src/lib/crypt_ops/crypto_curve25519.c index f28cebb887..8302483d87 100644 --- a/src/common/crypto_curve25519.c +++ b/src/lib/crypt_ops/crypto_curve25519.c @@ -21,11 +21,11 @@ #include <sys/stat.h> #endif #include "common/container.h" -#include "common/crypto_curve25519.h" -#include "common/crypto_digest.h" -#include "common/crypto_format.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_format.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/util.h" #include "common/torlog.h" diff --git a/src/common/crypto_curve25519.h b/src/lib/crypt_ops/crypto_curve25519.h index 96d2e0e072..2e614848e4 100644 --- a/src/common/crypto_curve25519.h +++ b/src/lib/crypt_ops/crypto_curve25519.h @@ -4,10 +4,10 @@ #ifndef TOR_CRYPTO_CURVE25519_H #define TOR_CRYPTO_CURVE25519_H -#include "common/testsupport.h" -#include "common/torint.h" -#include "common/crypto_digest.h" -#include "common/crypto_openssl_mgt.h" +#include "lib/testsupport/testsupport.h" +#include "lib/cc/torint.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_openssl_mgt.h" /** Length of a curve25519 public key when encoded. */ #define CURVE25519_PUBKEY_LEN 32 diff --git a/src/common/crypto_dh.c b/src/lib/crypt_ops/crypto_dh.c index a9bd348ff4..2442dae55e 100644 --- a/src/common/crypto_dh.c +++ b/src/lib/crypt_ops/crypto_dh.c @@ -9,11 +9,11 @@ * \brief Block of functions related with DH utilities and operations. **/ -#include "common/compat_openssl.h" -#include "common/crypto_dh.h" -#include "common/crypto_digest.h" -#include "common/crypto_hkdf.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/compat_openssl.h" +#include "lib/crypt_ops/crypto_dh.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_hkdf.h" +#include "lib/crypt_ops/crypto_util.h" DISABLE_GCC_WARNING(redundant-decls) diff --git a/src/common/crypto_dh.h b/src/lib/crypt_ops/crypto_dh.h index 1e77acc011..1e77acc011 100644 --- a/src/common/crypto_dh.h +++ b/src/lib/crypt_ops/crypto_dh.h diff --git a/src/common/crypto_digest.c b/src/lib/crypt_ops/crypto_digest.c index 708fbf9be6..44494337c4 100644 --- a/src/common/crypto_digest.c +++ b/src/lib/crypt_ops/crypto_digest.c @@ -11,9 +11,9 @@ **/ #include "common/container.h" -#include "common/crypto_digest.h" -#include "common/crypto_openssl_mgt.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_openssl_mgt.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/torlog.h" #include "keccak-tiny/keccak-tiny.h" diff --git a/src/common/crypto_digest.h b/src/lib/crypt_ops/crypto_digest.h index 25ca5ceda7..96ac038507 100644 --- a/src/common/crypto_digest.h +++ b/src/lib/crypt_ops/crypto_digest.h @@ -16,7 +16,7 @@ #include <stdio.h> #include "common/container.h" -#include "common/torint.h" +#include "lib/cc/torint.h" /** Length of the output of our message digest. */ #define DIGEST_LEN 20 diff --git a/src/common/crypto_ed25519.c b/src/lib/crypt_ops/crypto_ed25519.c index b0b954796c..ca1030b0ae 100644 --- a/src/common/crypto_ed25519.c +++ b/src/lib/crypt_ops/crypto_ed25519.c @@ -21,12 +21,12 @@ #include <sys/stat.h> #endif -#include "common/crypto_curve25519.h" -#include "common/crypto_digest.h" -#include "common/crypto_ed25519.h" -#include "common/crypto_format.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_format.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/torlog.h" #include "common/util.h" #include "common/util_format.h" diff --git a/src/common/crypto_ed25519.h b/src/lib/crypt_ops/crypto_ed25519.h index 20c04226e3..de992aaa8c 100644 --- a/src/common/crypto_ed25519.h +++ b/src/lib/crypt_ops/crypto_ed25519.h @@ -4,9 +4,9 @@ #ifndef TOR_CRYPTO_ED25519_H #define TOR_CRYPTO_ED25519_H -#include "common/testsupport.h" -#include "common/torint.h" -#include "common/crypto_curve25519.h" +#include "lib/testsupport/testsupport.h" +#include "lib/cc/torint.h" +#include "lib/crypt_ops/crypto_curve25519.h" #include "common/util.h" #define ED25519_PUBKEY_LEN 32 diff --git a/src/common/crypto_format.c b/src/lib/crypt_ops/crypto_format.c index 6245b70ccb..07008eff2e 100644 --- a/src/common/crypto_format.c +++ b/src/lib/crypt_ops/crypto_format.c @@ -15,11 +15,11 @@ #include <sys/stat.h> #endif #include "common/container.h" -#include "common/crypto_curve25519.h" -#include "common/crypto_digest.h" -#include "common/crypto_ed25519.h" -#include "common/crypto_format.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_format.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/util.h" #include "common/util_format.h" #include "common/torlog.h" diff --git a/src/common/crypto_format.h b/src/lib/crypt_ops/crypto_format.h index 325b1ef44d..77983f2161 100644 --- a/src/common/crypto_format.h +++ b/src/lib/crypt_ops/crypto_format.h @@ -7,9 +7,9 @@ #ifndef TOR_CRYPTO_FORMAT_H #define TOR_CRYPTO_FORMAT_H -#include "common/testsupport.h" -#include "common/torint.h" -#include "common/crypto_ed25519.h" +#include "lib/testsupport/testsupport.h" +#include "lib/cc/torint.h" +#include "lib/crypt_ops/crypto_ed25519.h" int crypto_write_tagged_contents_to_file(const char *fname, const char *typestring, diff --git a/src/common/crypto_hkdf.c b/src/lib/crypt_ops/crypto_hkdf.c index 8dc15b6ffb..86ec4367a9 100644 --- a/src/common/crypto_hkdf.c +++ b/src/lib/crypt_ops/crypto_hkdf.c @@ -9,11 +9,11 @@ * \brief Block of functions related with HKDF utilities and operations. **/ -#include "common/crypto_hkdf.h" -#include "common/crypto_util.h" -#include "common/crypto_digest.h" +#include "lib/crypt_ops/crypto_hkdf.h" +#include "lib/crypt_ops/crypto_util.h" +#include "lib/crypt_ops/crypto_digest.h" -#include "common/crypto_openssl_mgt.h" +#include "lib/crypt_ops/crypto_openssl_mgt.h" #include <openssl/opensslv.h> #if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) diff --git a/src/common/crypto_hkdf.h b/src/lib/crypt_ops/crypto_hkdf.h index 784f4bbbe4..784f4bbbe4 100644 --- a/src/common/crypto_hkdf.h +++ b/src/lib/crypt_ops/crypto_hkdf.h diff --git a/src/common/crypto_openssl_mgt.c b/src/lib/crypt_ops/crypto_openssl_mgt.c index 8acb9cdf1c..b18717a112 100644 --- a/src/common/crypto_openssl_mgt.c +++ b/src/lib/crypt_ops/crypto_openssl_mgt.c @@ -10,8 +10,8 @@ * \brief Block of functions related to operations from OpenSSL. **/ -#include "common/compat_openssl.h" -#include "common/crypto_openssl_mgt.h" +#include "lib/crypt_ops/compat_openssl.h" +#include "lib/crypt_ops/crypto_openssl_mgt.h" DISABLE_GCC_WARNING(redundant-decls) diff --git a/src/common/crypto_openssl_mgt.h b/src/lib/crypt_ops/crypto_openssl_mgt.h index e3f5531b7d..e3f5531b7d 100644 --- a/src/common/crypto_openssl_mgt.h +++ b/src/lib/crypt_ops/crypto_openssl_mgt.h diff --git a/src/common/crypto_pwbox.c b/src/lib/crypt_ops/crypto_pwbox.c index 799a8799e6..9a315d42da 100644 --- a/src/common/crypto_pwbox.c +++ b/src/lib/crypt_ops/crypto_pwbox.c @@ -8,12 +8,12 @@ * them to disk. */ -#include "common/crypto.h" -#include "common/crypto_digest.h" -#include "common/crypto_pwbox.h" -#include "common/crypto_rand.h" -#include "common/crypto_s2k.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_pwbox.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_s2k.h" +#include "lib/crypt_ops/crypto_util.h" #include "lib/ctime/di_ops.h" #include "common/util.h" #include "trunnel/pwbox.h" diff --git a/src/common/crypto_pwbox.h b/src/lib/crypt_ops/crypto_pwbox.h index 2c73c700eb..9ed35a150e 100644 --- a/src/common/crypto_pwbox.h +++ b/src/lib/crypt_ops/crypto_pwbox.h @@ -4,7 +4,7 @@ #ifndef CRYPTO_PWBOX_H_INCLUDED_ #define CRYPTO_PWBOX_H_INCLUDED_ -#include "common/torint.h" +#include "lib/cc/torint.h" #define UNPWBOX_OKAY 0 #define UNPWBOX_BAD_SECRET -1 diff --git a/src/common/crypto_rand.c b/src/lib/crypt_ops/crypto_rand.c index 6c88e28d88..0bd7b078c5 100644 --- a/src/common/crypto_rand.c +++ b/src/lib/crypt_ops/crypto_rand.c @@ -14,7 +14,7 @@ #ifndef CRYPTO_RAND_PRIVATE #define CRYPTO_RAND_PRIVATE -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #ifdef _WIN32 #include <windows.h> @@ -23,10 +23,10 @@ #include "common/container.h" #include "common/compat.h" -#include "common/compat_openssl.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/compat_openssl.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/sandbox.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" #include "common/torlog.h" #include "common/util.h" #include "common/util_format.h" diff --git a/src/common/crypto_rand.h b/src/lib/crypt_ops/crypto_rand.h index 2e05adc93d..8309bb21ca 100644 --- a/src/common/crypto_rand.h +++ b/src/lib/crypt_ops/crypto_rand.h @@ -13,7 +13,7 @@ #ifndef TOR_CRYPTO_RAND_H #define TOR_CRYPTO_RAND_H -#include "common/torint.h" +#include "lib/cc/torint.h" #include "common/util.h" /* random numbers */ diff --git a/src/common/crypto_rsa.c b/src/lib/crypt_ops/crypto_rsa.c index 3128983435..a20d47132c 100644 --- a/src/common/crypto_rsa.c +++ b/src/lib/crypt_ops/crypto_rsa.c @@ -9,14 +9,14 @@ * \brief Block of functions related with RSA utilities and operations. **/ -#include "common/crypto.h" -#include "common/crypto_curve25519.h" -#include "common/crypto_digest.h" -#include "common/crypto_format.h" -#include "common/compat_openssl.h" -#include "common/crypto_rand.h" -#include "common/crypto_rsa.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_format.h" +#include "lib/crypt_ops/compat_openssl.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_rsa.h" +#include "lib/crypt_ops/crypto_util.h" DISABLE_GCC_WARNING(redundant-decls) diff --git a/src/common/crypto_rsa.h b/src/lib/crypt_ops/crypto_rsa.h index c56eab319a..3faec12378 100644 --- a/src/common/crypto_rsa.h +++ b/src/lib/crypt_ops/crypto_rsa.h @@ -15,10 +15,10 @@ #include "orconfig.h" -#include "common/crypto_digest.h" +#include "lib/crypt_ops/crypto_digest.h" #include <stdio.h> -#include "common/torint.h" -#include "common/testsupport.h" +#include "lib/cc/torint.h" +#include "lib/testsupport/testsupport.h" #include "common/compat.h" #include "common/util.h" #include "common/torlog.h" diff --git a/src/common/crypto_s2k.c b/src/lib/crypt_ops/crypto_s2k.c index db57691f60..722407bf48 100644 --- a/src/common/crypto_s2k.c +++ b/src/lib/crypt_ops/crypto_s2k.c @@ -13,12 +13,12 @@ #define CRYPTO_S2K_PRIVATE #include "common/compat.h" -#include "common/crypto.h" -#include "common/crypto_digest.h" -#include "common/crypto_hkdf.h" -#include "common/crypto_rand.h" -#include "common/crypto_s2k.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_hkdf.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_s2k.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/util.h" #include <openssl/evp.h> diff --git a/src/common/crypto_s2k.h b/src/lib/crypt_ops/crypto_s2k.h index bc7224e8ea..b270897b68 100644 --- a/src/common/crypto_s2k.h +++ b/src/lib/crypt_ops/crypto_s2k.h @@ -8,7 +8,7 @@ #define TOR_CRYPTO_S2K_H_INCLUDED #include <stdio.h> -#include "common/torint.h" +#include "lib/cc/torint.h" /** Length of RFC2440-style S2K specifier: the first 8 bytes are a salt, the * 9th describes how much iteration to do. */ diff --git a/src/common/crypto_util.c b/src/lib/crypt_ops/crypto_util.c index 71707d4bfb..8ef0690c15 100644 --- a/src/common/crypto_util.c +++ b/src/lib/crypt_ops/crypto_util.c @@ -13,7 +13,7 @@ #ifndef CRYPTO_UTIL_PRIVATE #define CRYPTO_UTIL_PRIVATE -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include <string.h> diff --git a/src/common/crypto_util.h b/src/lib/crypt_ops/crypto_util.h index 53d9027fbc..3ce34e6f23 100644 --- a/src/common/crypto_util.h +++ b/src/lib/crypt_ops/crypto_util.h @@ -13,7 +13,7 @@ #ifndef TOR_CRYPTO_UTIL_H #define TOR_CRYPTO_UTIL_H -#include "common/torint.h" +#include "lib/cc/torint.h" /** OpenSSL-based utility functions. */ void memwipe(void *mem, uint8_t byte, size_t sz); diff --git a/src/lib/crypt_ops/include.am b/src/lib/crypt_ops/include.am new file mode 100644 index 0000000000..b881c689d8 --- /dev/null +++ b/src/lib/crypt_ops/include.am @@ -0,0 +1,44 @@ + +noinst_LIBRARIES += src/lib/libtor-crypt-ops.a + +if UNITTESTS_ENABLED +noinst_LIBRARIES += src/lib/libtor-crypt-ops-testing.a +endif + +src_lib_libtor_crypt_ops_a_SOURCES = \ + src/lib/crypt_ops/aes.c \ + src/lib/crypt_ops/crypto.c \ + src/lib/crypt_ops/crypto_curve25519.c \ + src/lib/crypt_ops/crypto_dh.c \ + src/lib/crypt_ops/crypto_digest.c \ + src/lib/crypt_ops/crypto_ed25519.c \ + src/lib/crypt_ops/crypto_format.c \ + src/lib/crypt_ops/crypto_hkdf.c \ + src/lib/crypt_ops/crypto_openssl_mgt.c \ + src/lib/crypt_ops/crypto_pwbox.c \ + src/lib/crypt_ops/crypto_rand.c \ + src/lib/crypt_ops/crypto_rsa.c \ + src/lib/crypt_ops/crypto_s2k.c \ + src/lib/crypt_ops/crypto_util.c + +src_lib_libtor_crypt_ops_testing_a_SOURCES = \ + $(src_lib_libtor_crypt_ops_a_SOURCES) +src_lib_libtor_crypt_ops_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS) +src_lib_libtor_crypt_ops_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) + +noinst_HEADERS += \ + src/lib/crypt_ops/aes.h \ + src/lib/crypt_ops/compat_openssl.h \ + src/lib/crypt_ops/crypto_curve25519.h \ + src/lib/crypt_ops/crypto_dh.h \ + src/lib/crypt_ops/crypto_digest.h \ + src/lib/crypt_ops/crypto_ed25519.h \ + src/lib/crypt_ops/crypto_format.h \ + src/lib/crypt_ops/crypto.h \ + src/lib/crypt_ops/crypto_hkdf.h \ + src/lib/crypt_ops/crypto_openssl_mgt.h \ + src/lib/crypt_ops/crypto_pwbox.h \ + src/lib/crypt_ops/crypto_rand.h \ + src/lib/crypt_ops/crypto_rsa.h \ + src/lib/crypt_ops/crypto_s2k.h \ + src/lib/crypt_ops/crypto_util.h diff --git a/src/lib/ctime/di_ops.c b/src/lib/ctime/di_ops.c index cc76be5488..407131c448 100644 --- a/src/lib/ctime/di_ops.c +++ b/src/lib/ctime/di_ops.c @@ -8,7 +8,6 @@ #include "orconfig.h" #include "lib/ctime/di_ops.h" -#include "common/torlog.h" #include "common/util.h" /** @@ -271,4 +270,3 @@ select_array_member_cumulative_timei(const uint64_t *entries, int n_entries, return i_chosen; } - diff --git a/src/lib/ctime/di_ops.h b/src/lib/ctime/di_ops.h index 8298bfa73a..92af7ae278 100644 --- a/src/lib/ctime/di_ops.h +++ b/src/lib/ctime/di_ops.h @@ -12,7 +12,7 @@ #define TOR_DI_OPS_H #include "orconfig.h" -#include "common/torint.h" +#include "lib/cc/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); diff --git a/src/lib/err/backtrace.h b/src/lib/err/backtrace.h index 0a145fc92d..7f77428436 100644 --- a/src/lib/err/backtrace.h +++ b/src/lib/err/backtrace.h @@ -5,7 +5,7 @@ #define TOR_BACKTRACE_H #include "orconfig.h" -#include "common/compat_compiler.h" +#include "lib/cc/compat_compiler.h" typedef void (*tor_log_fn)(int, unsigned, const char *fmt, ...) CHECK_PRINTF(3,4); diff --git a/src/lib/err/include.am b/src/lib/err/include.am index 257ba3004b..f2a409c51e 100644 --- a/src/lib/err/include.am +++ b/src/lib/err/include.am @@ -11,6 +11,8 @@ src_lib_libtor_err_a_SOURCES = \ src_lib_libtor_err_testing_a_SOURCES = \ $(src_lib_libtor_err_a_SOURCES) +src_lib_libtor_err_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS) +src_lib_libtor_err_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) noinst_HEADERS += \ src/lib/err/backtrace.h \ diff --git a/src/lib/err/torerr.h b/src/lib/err/torerr.h index 10d9f481c0..d4bba6916f 100644 --- a/src/lib/err/torerr.h +++ b/src/lib/err/torerr.h @@ -13,7 +13,7 @@ #ifndef TOR_TORERR_H #define TOR_TORERR_H -#include "common/compat_compiler.h" +#include "lib/cc/compat_compiler.h" /* The raw_assert...() variants are for use within code that can't call * tor_assertion_failed_() because of call circularity issues. */ diff --git a/src/lib/include.libdonna.am b/src/lib/include.libdonna.am new file mode 100644 index 0000000000..5b92dc58a0 --- /dev/null +++ b/src/lib/include.libdonna.am @@ -0,0 +1,24 @@ +src_lib_libcurve25519_donna_a_CFLAGS= + +if BUILD_CURVE25519_DONNA +src_lib_libcurve25519_donna_a_SOURCES=\ + src/ext/curve25519_donna/curve25519-donna.c +# See bug 13538 -- this code is known to have signed overflow issues. +src_lib_libcurve25519_donna_a_CFLAGS+=\ + @F_OMIT_FRAME_POINTER@ @CFLAGS_CONSTTIME@ +noinst_LIBRARIES+=src/lib/libcurve25519_donna.a +LIBDONNA=src/lib/libcurve25519_donna.a +else +if BUILD_CURVE25519_DONNA_C64 +src_lib_libcurve25519_donna_a_CFLAGS+=@CFLAGS_CONSTTIME@ +src_lib_libcurve25519_donna_a_SOURCES=\ + src/ext/curve25519_donna/curve25519-donna-c64.c +noinst_LIBRARIES+=src/lib/libcurve25519_donna.a +LIBDONNA=src/lib/libcurve25519_donna.a +else +LIBDONNA= +endif +endif + +LIBDONNA += $(LIBED25519_REF10) +LIBDONNA += $(LIBED25519_DONNA) diff --git a/src/lib/testsupport/include.am b/src/lib/testsupport/include.am new file mode 100644 index 0000000000..b2aa620985 --- /dev/null +++ b/src/lib/testsupport/include.am @@ -0,0 +1,3 @@ + +noinst_HEADERS += \ + src/lib/testsupport/testsupport.h diff --git a/src/common/testsupport.h b/src/lib/testsupport/testsupport.h index 9a55d306fc..9a55d306fc 100644 --- a/src/common/testsupport.h +++ b/src/lib/testsupport/testsupport.h diff --git a/src/common/buffers_tls.c b/src/lib/tls/buffers_tls.c index dfc8e44b98..5accb2d91a 100644 --- a/src/common/buffers_tls.c +++ b/src/lib/tls/buffers_tls.c @@ -8,13 +8,13 @@ #include "orconfig.h" #include <stddef.h> #include "common/buffers.h" -#include "common/buffers_tls.h" +#include "lib/tls/buffers_tls.h" #include "common/compat.h" -#include "common/compress.h" +#include "lib/compress/compress.h" #include "common/util.h" -#include "common/torint.h" +#include "lib/cc/torint.h" #include "common/torlog.h" -#include "common/tortls.h" +#include "lib/tls/tortls.h" #ifdef HAVE_UNISTD_H #include <unistd.h> #endif diff --git a/src/common/buffers_tls.h b/src/lib/tls/buffers_tls.h index d9d26c82bd..d9d26c82bd 100644 --- a/src/common/buffers_tls.h +++ b/src/lib/tls/buffers_tls.h diff --git a/src/common/ciphers.inc b/src/lib/tls/ciphers.inc index 0084b3e325..0084b3e325 100644 --- a/src/common/ciphers.inc +++ b/src/lib/tls/ciphers.inc diff --git a/src/lib/tls/include.am b/src/lib/tls/include.am new file mode 100644 index 0000000000..b3b013f4dd --- /dev/null +++ b/src/lib/tls/include.am @@ -0,0 +1,20 @@ + +noinst_LIBRARIES += src/lib/libtor-tls.a + +if UNITTESTS_ENABLED +noinst_LIBRARIES += src/lib/libtor-tls-testing.a +endif + +src_lib_libtor_tls_a_SOURCES = \ + src/lib/tls/buffers_tls.c \ + src/lib/tls/tortls.c + +src_lib_libtor_tls_testing_a_SOURCES = \ + $(src_lib_libtor_tls_a_SOURCES) +src_lib_libtor_tls_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS) +src_lib_libtor_tls_testing_a_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) + +noinst_HEADERS += \ + src/lib/tls/ciphers.inc \ + src/lib/tls/buffers_tls.h \ + src/lib/tls/tortls.h diff --git a/src/common/tortls.c b/src/lib/tls/tortls.c index 419d9c9316..ac45175c7d 100644 --- a/src/common/tortls.c +++ b/src/lib/tls/tortls.c @@ -24,10 +24,10 @@ #include <ws2tcpip.h> #endif -#include "common/crypto.h" -#include "common/crypto_rand.h" -#include "common/crypto_dh.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_dh.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/compat.h" /* Some versions of OpenSSL declare SSL_get_selected_srtp_profile twice in @@ -52,7 +52,7 @@ DISABLE_GCC_WARNING(redundant-decls) ENABLE_GCC_WARNING(redundant-decls) #define TORTLS_PRIVATE -#include "common/tortls.h" +#include "lib/tls/tortls.h" #include "common/util.h" #include "common/torlog.h" #include "common/container.h" @@ -2660,4 +2660,3 @@ evaluate_ecgroup_for_tls(const char *ecgroup) return ret; } - diff --git a/src/common/tortls.h b/src/lib/tls/tortls.h index c7b319761d..c46b46d2fa 100644 --- a/src/common/tortls.h +++ b/src/lib/tls/tortls.h @@ -11,10 +11,10 @@ * \brief Headers for tortls.c **/ -#include "common/crypto_rsa.h" -#include "common/compat_openssl.h" +#include "lib/crypt_ops/crypto_rsa.h" +#include "lib/crypt_ops/compat_openssl.h" #include "common/compat.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" /* Opaque structure to hold a TLS connection. */ typedef struct tor_tls_t tor_tls_t; diff --git a/src/trace/debug.h b/src/lib/trace/debug.h index 0241f2ccf8..0241f2ccf8 100644 --- a/src/trace/debug.h +++ b/src/lib/trace/debug.h diff --git a/src/trace/events.h b/src/lib/trace/events.h index 761a0f4eb8..6d4269aaed 100644 --- a/src/trace/events.h +++ b/src/lib/trace/events.h @@ -31,7 +31,7 @@ /* Enable event tracing for the debug framework where all trace events are * mapped to a log_debug(). */ #ifdef USE_EVENT_TRACING_DEBUG -#include "trace/debug.h" +#include "lib/trace/debug.h" #endif #else /* TOR_EVENT_TRACING_ENABLED */ diff --git a/src/lib/trace/include.am b/src/lib/trace/include.am new file mode 100644 index 0000000000..6f10c98744 --- /dev/null +++ b/src/lib/trace/include.am @@ -0,0 +1,18 @@ + +noinst_LIBRARIES += \ + src/lib/libtor-trace.a + +TRACEHEADERS = \ + src/lib/trace/trace.h \ + src/lib/trace/events.h + +if USE_EVENT_TRACING_DEBUG +TRACEHEADERS += \ + src/lib/trace/debug.h +endif + +# Library source files. +src_lib_libtor_trace_a_SOURCES = \ + src/lib/trace/trace.c + +noinst_HEADERS+= $(TRACEHEADERS) diff --git a/src/trace/trace.c b/src/lib/trace/trace.c index b39a2bbc5c..c0bbbb0cc6 100644 --- a/src/trace/trace.c +++ b/src/lib/trace/trace.c @@ -1,7 +1,7 @@ /* Copyright (c) 2017-2018, The Tor Project, Inc. */ /* See LICENSE for licensing information */ -#include "trace/trace.h" +#include "lib/trace/trace.h" /** Initialize the tracing library. */ void diff --git a/src/trace/trace.h b/src/lib/trace/trace.h index 2dd51aace1..2dd51aace1 100644 --- a/src/trace/trace.h +++ b/src/lib/trace/trace.h diff --git a/src/or/addressmap.c b/src/or/addressmap.c index 9ca2326273..a0df5c9865 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -21,7 +21,7 @@ #include "or/config.h" #include "or/connection_edge.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/dns.h" #include "or/nodelist.h" #include "or/routerset.h" diff --git a/src/or/addressmap.h b/src/or/addressmap.h index 0d53e77772..b0db5c8b4e 100644 --- a/src/or/addressmap.h +++ b/src/or/addressmap.h @@ -7,7 +7,7 @@ #ifndef TOR_ADDRESSMAP_H #define TOR_ADDRESSMAP_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" void addressmap_init(void); void addressmap_clear_excluded_trackexithosts(const or_options_t *options); diff --git a/src/or/channelpadding.c b/src/or/channelpadding.c index 190f54f298..2afa483f52 100644 --- a/src/or/channelpadding.c +++ b/src/or/channelpadding.c @@ -16,7 +16,7 @@ #include "or/networkstatus.h" #include "or/connection.h" #include "or/connection_or.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/main.h" #include "or/rephist.h" #include "or/router.h" diff --git a/src/or/circpathbias.c b/src/or/circpathbias.c index ace29c4a06..908b76b486 100644 --- a/src/or/circpathbias.c +++ b/src/or/circpathbias.c @@ -30,7 +30,7 @@ #include "or/circuitstats.h" #include "or/connection_edge.h" #include "or/config.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/entrynodes.h" #include "or/networkstatus.h" #include "or/relay.h" diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index f527082773..28295147cc 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -43,7 +43,7 @@ #include "or/connection_edge.h" #include "or/connection_or.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/directory.h" #include "or/entrynodes.h" #include "or/hs_ntor.h" diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index c3d017bf8d..a696533ae4 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -51,7 +51,7 @@ * logic, which was originally circuit-focused. **/ #define CIRCUITLIST_PRIVATE -#include "common/torint.h" /* TOR_PRIuSZ */ +#include "lib/cc/torint.h" /* TOR_PRIuSZ */ #include "or/or.h" #include "or/channel.h" @@ -65,8 +65,8 @@ #include "or/connection_edge.h" #include "or/connection_or.h" #include "or/control.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/entrynodes.h" #include "or/main.h" @@ -86,9 +86,9 @@ #include "or/routerlist.h" #include "or/routerset.h" #include "or/channelpadding.h" -#include "common/compress_lzma.h" -#include "common/compress_zlib.h" -#include "common/compress_zstd.h" +#include "lib/compress/compress_lzma.h" +#include "lib/compress/compress_zlib.h" +#include "lib/compress/compress_zstd.h" #include "ht.h" diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h index 9f80c3efde..8b41424eeb 100644 --- a/src/or/circuitlist.h +++ b/src/or/circuitlist.h @@ -12,7 +12,7 @@ #ifndef TOR_CIRCUITLIST_H #define TOR_CIRCUITLIST_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" #include "or/hs_ident.h" /** Convert a circuit_t* to a pointer to the enclosing or_circuit_t. Assert diff --git a/src/or/circuitmux.h b/src/or/circuitmux.h index 68bcbf6e75..e94cc354c7 100644 --- a/src/or/circuitmux.h +++ b/src/or/circuitmux.h @@ -10,7 +10,7 @@ #define TOR_CIRCUITMUX_H #include "or/or.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" typedef struct circuitmux_policy_s circuitmux_policy_t; typedef struct circuitmux_policy_data_s circuitmux_policy_data_t; diff --git a/src/or/circuitmux_ewma.c b/src/or/circuitmux_ewma.c index 3b144e7d98..1ee5f1f621 100644 --- a/src/or/circuitmux_ewma.c +++ b/src/or/circuitmux_ewma.c @@ -37,7 +37,7 @@ #include "or/or.h" #include "or/circuitmux.h" #include "or/circuitmux_ewma.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/networkstatus.h" /*** EWMA parameter #defines ***/ diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c index ebd082306d..34605457d5 100644 --- a/src/or/circuitstats.c +++ b/src/or/circuitstats.c @@ -31,7 +31,7 @@ #include "or/config.h" #include "or/confparse.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/main.h" #include "or/networkstatus.h" #include "or/rendclient.h" diff --git a/src/or/command.c b/src/or/command.c index dd8e7d6f3e..387fd49bd2 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -46,7 +46,7 @@ #include "or/config.h" #include "or/control.h" #include "or/cpuworker.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/dos.h" #include "or/hibernate.h" #include "or/nodelist.h" diff --git a/src/or/config.c b/src/or/config.c index 8c6e2382fb..6bdb4ab7dc 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -70,7 +70,7 @@ #include "or/circuitmux.h" #include "or/circuitmux_ewma.h" #include "or/circuitstats.h" -#include "common/compress.h" +#include "lib/compress/compress.h" #include "or/config.h" #include "or/connection.h" #include "or/connection_edge.h" @@ -79,8 +79,8 @@ #include "or/control.h" #include "or/confparse.h" #include "or/cpuworker.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/dirserv.h" #include "or/dns.h" #include "or/dos.h" diff --git a/src/or/config.h b/src/or/config.h index a94cd77538..dc3322e6b4 100644 --- a/src/or/config.h +++ b/src/or/config.h @@ -12,7 +12,7 @@ #ifndef TOR_CONFIG_H #define TOR_CONFIG_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(DARWIN) #define KERNEL_MAY_SUPPORT_IPFW diff --git a/src/or/connection.c b/src/or/connection.c index 450903d6d1..e06e9c650a 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -58,7 +58,7 @@ #include "or/or.h" #include "or/bridges.h" #include "common/buffers.h" -#include "common/buffers_tls.h" +#include "lib/tls/buffers_tls.h" /* * Define this so we get channel internal functions, since we're implementing * part of a subclass (channel_tls_t). @@ -76,7 +76,7 @@ #include "or/connection_edge.h" #include "or/connection_or.h" #include "or/control.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/dirserv.h" #include "or/dns.h" diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 6d6279c831..5bb85255bb 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -70,7 +70,7 @@ #include "or/connection_edge.h" #include "or/connection_or.h" #include "or/control.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/dns.h" #include "or/dnsserv.h" #include "or/directory.h" diff --git a/src/or/connection_edge.h b/src/or/connection_edge.h index 9d480aec2e..d6774668d8 100644 --- a/src/or/connection_edge.h +++ b/src/or/connection_edge.h @@ -12,7 +12,7 @@ #ifndef TOR_CONNECTION_EDGE_H #define TOR_CONNECTION_EDGE_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" edge_connection_t *TO_EDGE_CONN(connection_t *); entry_connection_t *TO_ENTRY_CONN(connection_t *); diff --git a/src/or/connection_or.c b/src/or/connection_or.c index aff5f105a1..7badcd3700 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -39,8 +39,8 @@ #include "or/connection.h" #include "or/connection_or.h" #include "or/control.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/dirserv.h" #include "or/entrynodes.h" #include "or/geoip.h" diff --git a/src/or/conscache.c b/src/or/conscache.c index 5bfd78a786..63ff0db787 100644 --- a/src/or/conscache.c +++ b/src/or/conscache.c @@ -5,7 +5,7 @@ #include "or/config.h" #include "or/conscache.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/storagedir.h" #define CCE_MAGIC 0x17162253 diff --git a/src/or/control.c b/src/or/control.c index 0460463d78..13814804a4 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -53,8 +53,8 @@ #include "or/connection_edge.h" #include "or/connection_or.h" #include "or/control.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/dirserv.h" #include "or/dnsserv.h" @@ -104,7 +104,7 @@ #include <sys/resource.h> #endif -#include "common/crypto_s2k.h" +#include "lib/crypt_ops/crypto_s2k.h" #include "common/procmon.h" /** Yield true iff <b>s</b> is the state of a control_connection_t that has diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 18b8adab86..24a75b16df 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -24,8 +24,8 @@ #include "or/connection_or.h" #include "or/config.h" #include "or/cpuworker.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/main.h" #include "or/onion.h" #include "or/rephist.h" diff --git a/src/or/dir_server_st.h b/src/or/dir_server_st.h index 8fdb04a7de..fe1f5c3d5f 100644 --- a/src/or/dir_server_st.h +++ b/src/or/dir_server_st.h @@ -7,7 +7,7 @@ #ifndef DIR_SERVER_ST_H #define DIR_SERVER_ST_H -#include "common/torint.h" +#include "lib/cc/torint.h" #include "or/or.h" #include "or/routerstatus_st.h" diff --git a/src/or/dirauth/dircollate.h b/src/or/dirauth/dircollate.h index 1d403b20f2..aae7829786 100644 --- a/src/or/dirauth/dircollate.h +++ b/src/or/dirauth/dircollate.h @@ -12,7 +12,7 @@ #ifndef TOR_DIRCOLLATE_H #define TOR_DIRCOLLATE_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" #include "or/or.h" typedef struct dircollator_s dircollator_t; diff --git a/src/or/dirauth/shared_random.c b/src/or/dirauth/shared_random.c index 0860efacad..8b53c1e743 100644 --- a/src/or/dirauth/shared_random.c +++ b/src/or/dirauth/shared_random.c @@ -91,8 +91,8 @@ #include "or/dirauth/shared_random.h" #include "or/config.h" #include "or/confparse.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/networkstatus.h" #include "or/router.h" #include "or/routerkeys.h" diff --git a/src/or/dirauth/shared_random_state.c b/src/or/dirauth/shared_random_state.c index 9bea02e820..f77a64dfc9 100644 --- a/src/or/dirauth/shared_random_state.c +++ b/src/or/dirauth/shared_random_state.c @@ -13,7 +13,7 @@ #include "or/or.h" #include "or/config.h" #include "or/confparse.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/dirauth/dirvote.h" #include "or/networkstatus.h" #include "or/router.h" diff --git a/src/or/directory.c b/src/or/directory.c index 9918433f5e..2d3f7fe9a0 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -18,8 +18,8 @@ #include "or/consdiffmgr.h" #include "or/control.h" #include "common/compat.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/dirserv.h" #include "or/entrynodes.h" diff --git a/src/or/dirserv.h b/src/or/dirserv.h index a8d5ac616b..757eba7ba2 100644 --- a/src/or/dirserv.h +++ b/src/or/dirserv.h @@ -12,7 +12,7 @@ #ifndef TOR_DIRSERV_H #define TOR_DIRSERV_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" /** What fraction (1 over this number) of the relay ID space do we * (as a directory authority) launch connections to at each reachability diff --git a/src/or/dns.c b/src/or/dns.c index 3f5d39b41d..8d809d8c3c 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -56,7 +56,7 @@ #include "or/connection.h" #include "or/connection_edge.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/dns.h" #include "or/main.h" #include "or/policies.h" diff --git a/src/or/dos.c b/src/or/dos.c index 5f4142b0e9..02bdbcf35d 100644 --- a/src/or/dos.c +++ b/src/or/dos.c @@ -12,7 +12,7 @@ #include "or/channel.h" #include "or/config.h" #include "or/connection_or.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/geoip.h" #include "or/main.h" #include "or/networkstatus.h" diff --git a/src/or/entry_port_cfg_st.h b/src/or/entry_port_cfg_st.h index 45dd844c46..9b07ccb067 100644 --- a/src/or/entry_port_cfg_st.h +++ b/src/or/entry_port_cfg_st.h @@ -7,7 +7,7 @@ #ifndef ENTRY_PORT_CFG_ST_H #define ENTRY_PORT_CFG_ST_H -#include "common/torint.h" +#include "lib/cc/torint.h" #include "or/or.h" struct entry_port_cfg_t { diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 6d13efda90..1fb6215906 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -124,7 +124,7 @@ #include "or/confparse.h" #include "or/connection.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/directory.h" #include "or/entrynodes.h" #include "or/main.h" diff --git a/src/or/ext_orport.c b/src/or/ext_orport.c index d84f263aa6..701dc45288 100644 --- a/src/or/ext_orport.c +++ b/src/or/ext_orport.c @@ -22,8 +22,8 @@ #include "or/connection_or.h" #include "or/control.h" #include "or/config.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/ext_orport.h" #include "or/main.h" #include "or/proto_ext_or.h" diff --git a/src/or/geoip.h b/src/or/geoip.h index 8a5dd701e0..3a991038af 100644 --- a/src/or/geoip.h +++ b/src/or/geoip.h @@ -12,7 +12,7 @@ #ifndef TOR_GEOIP_H #define TOR_GEOIP_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" #include "or/dos.h" #ifdef GEOIP_PRIVATE diff --git a/src/or/hibernate.c b/src/or/hibernate.c index 595b839574..12264f758f 100644 --- a/src/or/hibernate.c +++ b/src/or/hibernate.c @@ -36,7 +36,7 @@ hibernating, phase 2: #include "or/connection_edge.h" #include "or/connection_or.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/hibernate.h" #include "or/main.h" #include "or/router.h" diff --git a/src/or/hibernate.h b/src/or/hibernate.h index cdef33543a..bfd8571cd6 100644 --- a/src/or/hibernate.h +++ b/src/or/hibernate.h @@ -12,7 +12,7 @@ #ifndef TOR_HIBERNATE_H #define TOR_HIBERNATE_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" int accounting_parse_options(const or_options_t *options, int validate_only); MOCK_DECL(int, accounting_is_enabled, (const or_options_t *options)); diff --git a/src/or/hs_cache.c b/src/or/hs_cache.c index c16a42a482..a42fe6b1a3 100644 --- a/src/or/hs_cache.c +++ b/src/or/hs_cache.c @@ -11,7 +11,7 @@ #include "or/or.h" #include "or/config.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/hs_ident.h" #include "or/hs_common.h" #include "or/hs_client.h" diff --git a/src/or/hs_cache.h b/src/or/hs_cache.h index 5ca158781b..78ed81b6e0 100644 --- a/src/or/hs_cache.h +++ b/src/or/hs_cache.h @@ -11,7 +11,7 @@ #include <stdint.h> -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "or/hs_common.h" #include "or/hs_descriptor.h" #include "or/rendcommon.h" diff --git a/src/or/hs_cell.c b/src/or/hs_cell.c index 40ec4ba9e7..b50c87dfa3 100644 --- a/src/or/hs_cell.c +++ b/src/or/hs_cell.c @@ -8,7 +8,7 @@ #include "or/or.h" #include "or/config.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/rendservice.h" #include "or/replaycache.h" #include "common/util.h" diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c index 36a9820446..9fcb30ecc6 100644 --- a/src/or/hs_circuit.c +++ b/src/or/hs_circuit.c @@ -13,8 +13,8 @@ #include "or/circuitlist.h" #include "or/circuituse.h" #include "or/config.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/nodelist.h" #include "or/policies.h" #include "or/relay.h" diff --git a/src/or/hs_circuit.h b/src/or/hs_circuit.h index fbf11d1cc8..425070f4ca 100644 --- a/src/or/hs_circuit.h +++ b/src/or/hs_circuit.h @@ -10,7 +10,7 @@ #define TOR_HS_CIRCUIT_H #include "or/or.h" -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "or/hs_service.h" diff --git a/src/or/hs_client.c b/src/or/hs_client.c index 331793c1fa..90a3fb3dcb 100644 --- a/src/or/hs_client.c +++ b/src/or/hs_client.c @@ -17,8 +17,8 @@ #include "or/connection.h" #include "or/connection_edge.h" #include "common/container.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/hs_cache.h" #include "or/hs_cell.h" diff --git a/src/or/hs_client.h b/src/or/hs_client.h index f7fca0b00e..8083910747 100644 --- a/src/or/hs_client.h +++ b/src/or/hs_client.h @@ -9,7 +9,7 @@ #ifndef TOR_HS_CLIENT_H #define TOR_HS_CLIENT_H -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "or/hs_descriptor.h" #include "or/hs_ident.h" diff --git a/src/or/hs_common.c b/src/or/hs_common.c index 51d74bf5af..e88a04620e 100644 --- a/src/or/hs_common.c +++ b/src/or/hs_common.c @@ -15,8 +15,8 @@ #include "or/config.h" #include "or/circuitbuild.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/networkstatus.h" #include "or/nodelist.h" #include "or/hs_cache.h" diff --git a/src/or/hs_control.c b/src/or/hs_control.c index fc828d0721..76c40918bb 100644 --- a/src/or/hs_control.c +++ b/src/or/hs_control.c @@ -8,7 +8,7 @@ #include "or/or.h" #include "or/control.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/hs_common.h" #include "or/hs_control.h" #include "or/hs_descriptor.h" diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c index feec0e66d4..db88cdc4a4 100644 --- a/src/or/hs_descriptor.c +++ b/src/or/hs_descriptor.c @@ -59,8 +59,8 @@ #include "trunnel/ed25519_cert.h" /* Trunnel interface. */ #include "or/hs_descriptor.h" #include "or/circuitbuild.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/parsecommon.h" #include "or/rendcache.h" #include "or/hs_cache.h" diff --git a/src/or/hs_descriptor.h b/src/or/hs_descriptor.h index 8a2df95277..5478edc89b 100644 --- a/src/or/hs_descriptor.h +++ b/src/or/hs_descriptor.h @@ -14,8 +14,8 @@ #include "or/or.h" #include "common/address.h" #include "common/container.h" -#include "common/crypto.h" -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "trunnel/ed25519_cert.h" /* needed for trunnel */ #include "or/torcert.h" diff --git a/src/or/hs_ident.c b/src/or/hs_ident.c index d3d11393f0..20539ca878 100644 --- a/src/or/hs_ident.c +++ b/src/or/hs_ident.c @@ -7,7 +7,7 @@ * subsytem. **/ -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/hs_ident.h" /* Return a newly allocated circuit identifier. The given public key is copied diff --git a/src/or/hs_ident.h b/src/or/hs_ident.h index 476cdc19ee..8c53b9dbeb 100644 --- a/src/or/hs_ident.h +++ b/src/or/hs_ident.h @@ -21,7 +21,7 @@ #ifndef TOR_HS_IDENT_H #define TOR_HS_IDENT_H -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "or/hs_common.h" diff --git a/src/or/hs_intropoint.h b/src/or/hs_intropoint.h index 77e41647be..5f82920991 100644 --- a/src/or/hs_intropoint.h +++ b/src/or/hs_intropoint.h @@ -9,7 +9,7 @@ #ifndef TOR_HS_INTRO_H #define TOR_HS_INTRO_H -#include "common/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_curve25519.h" #include "or/torcert.h" /* Authentication key type in an ESTABLISH_INTRO cell. */ diff --git a/src/or/hs_ntor.c b/src/or/hs_ntor.c index 61e1474aad..a8a76ed54d 100644 --- a/src/or/hs_ntor.c +++ b/src/or/hs_ntor.c @@ -25,7 +25,7 @@ */ #include "or/or.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/hs_ntor.h" /* String constants used by the ntor HS protocol */ diff --git a/src/or/hs_service.c b/src/or/hs_service.c index 722cc7fc5a..b5649e2636 100644 --- a/src/or/hs_service.c +++ b/src/or/hs_service.c @@ -15,8 +15,8 @@ #include "or/circuituse.h" #include "or/config.h" #include "or/connection.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/main.h" #include "or/networkstatus.h" diff --git a/src/or/hs_service.h b/src/or/hs_service.h index 32db63bd2e..4676042b54 100644 --- a/src/or/hs_service.h +++ b/src/or/hs_service.h @@ -9,8 +9,8 @@ #ifndef TOR_HS_SERVICE_H #define TOR_HS_SERVICE_H -#include "common/crypto_curve25519.h" -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "or/replaycache.h" #include "or/hs_common.h" diff --git a/src/or/keypin.c b/src/or/keypin.c index 921a401a4f..1bdb471b33 100644 --- a/src/or/keypin.c +++ b/src/or/keypin.c @@ -12,13 +12,13 @@ #include "orconfig.h" #include "common/compat.h" -#include "common/crypto_digest.h" -#include "common/crypto_format.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_format.h" #include "lib/ctime/di_ops.h" #include "ht.h" #include "or/keypin.h" #include "siphash.h" -#include "common/torint.h" +#include "lib/cc/torint.h" #include "common/torlog.h" #include "common/util.h" #include "common/util_format.h" diff --git a/src/or/keypin.h b/src/or/keypin.h index b8b9ff5972..73a76be563 100644 --- a/src/or/keypin.h +++ b/src/or/keypin.h @@ -4,7 +4,7 @@ #ifndef TOR_KEYPIN_H #define TOR_KEYPIN_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" int keypin_check_and_add(const uint8_t *rsa_id_digest, const uint8_t *ed25519_id_key, diff --git a/src/or/main.c b/src/or/main.c index 4ca180af2c..c690fdd906 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -52,7 +52,7 @@ #include "lib/err/backtrace.h" #include "or/bridges.h" #include "common/buffers.h" -#include "common/buffers_tls.h" +#include "lib/tls/buffers_tls.h" #include "or/channel.h" #include "or/channeltls.h" #include "or/channelpadding.h" @@ -61,7 +61,7 @@ #include "or/circuituse.h" #include "or/circuitmux_ewma.h" #include "or/command.h" -#include "common/compress.h" +#include "lib/compress/compress.h" #include "or/config.h" #include "or/confparse.h" #include "or/connection.h" @@ -70,8 +70,8 @@ #include "or/consdiffmgr.h" #include "or/control.h" #include "or/cpuworker.h" -#include "common/crypto_s2k.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_s2k.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/directory.h" #include "or/dirserv.h" #include "or/dns.h" diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 649d146d45..e6eaffffad 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -48,8 +48,8 @@ #include "or/connection_or.h" #include "or/consdiffmgr.h" #include "or/control.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/dirserv.h" #include "or/dos.h" diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h index 97b90dab61..cc6badf0b2 100644 --- a/src/or/networkstatus.h +++ b/src/or/networkstatus.h @@ -12,7 +12,7 @@ #ifndef TOR_NETWORKSTATUS_H #define TOR_NETWORKSTATUS_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" void networkstatus_reset_warnings(void); void networkstatus_reset_download_failures(void); diff --git a/src/or/onion.c b/src/or/onion.c index 27e05c7cc7..776aacbf78 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -67,7 +67,7 @@ #include "or/circuitlist.h" #include "or/config.h" #include "or/cpuworker.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/networkstatus.h" #include "or/onion.h" #include "or/onion_fast.h" diff --git a/src/or/onion_fast.c b/src/or/onion_fast.c index 7d92de038c..7d555c26e7 100644 --- a/src/or/onion_fast.c +++ b/src/or/onion_fast.c @@ -29,8 +29,8 @@ #include "or/or.h" #include "or/onion_fast.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" /** Release all state held in <b>victim</b>. */ void diff --git a/src/or/onion_ntor.c b/src/or/onion_ntor.c index d44933a2bd..a6685eb999 100644 --- a/src/or/onion_ntor.c +++ b/src/or/onion_ntor.c @@ -21,10 +21,10 @@ #include "orconfig.h" #define ONION_NTOR_PRIVATE -#include "common/crypto.h" -#include "common/crypto_hkdf.h" -#include "common/crypto_digest.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_hkdf.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/onion_ntor.h" #include "common/torlog.h" #include "common/util.h" diff --git a/src/or/onion_ntor.h b/src/or/onion_ntor.h index 13a3298ac0..b4da3a8d79 100644 --- a/src/or/onion_ntor.h +++ b/src/or/onion_ntor.h @@ -4,8 +4,8 @@ #ifndef TOR_ONION_NTOR_H #define TOR_ONION_NTOR_H -#include "common/torint.h" -#include "common/crypto_curve25519.h" +#include "lib/cc/torint.h" +#include "lib/crypt_ops/crypto_curve25519.h" #include "lib/ctime/di_ops.h" /** State to be maintained by a client between sending an ntor onionskin diff --git a/src/or/onion_tap.c b/src/or/onion_tap.c index 0f9fe31be4..cf5963b19e 100644 --- a/src/or/onion_tap.c +++ b/src/or/onion_tap.c @@ -29,8 +29,8 @@ #include "or/or.h" #include "or/config.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/onion_tap.h" #include "or/rephist.h" diff --git a/src/or/or.h b/src/or/or.h index 55364beee9..cb7e84e68b 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -26,7 +26,7 @@ #ifdef HAVE_SYS_PARAM_H #include <sys/param.h> /* FreeBSD needs this to know what version it is */ #endif -#include "common/torint.h" +#include "lib/cc/torint.h" #ifdef HAVE_SYS_FCNTL_H #include <sys/fcntl.h> #endif @@ -63,21 +63,21 @@ #include <windows.h> #endif /* defined(_WIN32) */ -#include "common/crypto.h" -#include "common/crypto_format.h" -#include "common/crypto_dh.h" -#include "common/crypto_hkdf.h" -#include "common/tortls.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_format.h" +#include "lib/crypt_ops/crypto_dh.h" +#include "lib/crypt_ops/crypto_hkdf.h" +#include "lib/tls/tortls.h" #include "common/torlog.h" #include "common/container.h" -#include "common/compress.h" +#include "lib/compress/compress.h" #include "common/address.h" #include "common/compat_libevent.h" #include "ht.h" #include "common/confline.h" #include "or/replaycache.h" -#include "common/crypto_curve25519.h" -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "tor_queue.h" #include "common/token_bucket.h" #include "common/util_format.h" diff --git a/src/or/parsecommon.h b/src/or/parsecommon.h index bfd5c58b8e..93e62a559d 100644 --- a/src/or/parsecommon.h +++ b/src/or/parsecommon.h @@ -10,7 +10,7 @@ #define TOR_PARSECOMMON_H #include "common/container.h" -#include "common/crypto.h" +#include "lib/crypt_ops/crypto.h" #include "common/memarea.h" /** Enumeration of possible token types. The ones starting with K_ correspond diff --git a/src/or/proto_socks.c b/src/or/proto_socks.c index d113bc9cab..46439d66b1 100644 --- a/src/or/proto_socks.c +++ b/src/or/proto_socks.c @@ -9,7 +9,7 @@ #include "common/buffers.h" #include "or/control.h" #include "or/config.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/ext_orport.h" #include "or/proto_socks.h" #include "or/reasons.h" diff --git a/src/or/relay.c b/src/or/relay.c index f74c4b4a94..85b5cf7aa6 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -55,14 +55,14 @@ #include "or/circuitbuild.h" #include "or/circuitlist.h" #include "or/circuituse.h" -#include "common/compress.h" +#include "lib/compress/compress.h" #include "or/config.h" #include "or/connection.h" #include "or/connection_edge.h" #include "or/connection_or.h" #include "or/control.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/geoip.h" #include "or/hs_cache.h" diff --git a/src/or/relay_crypto.c b/src/or/relay_crypto.c index 5179984e7d..6682cd86f4 100644 --- a/src/or/relay_crypto.c +++ b/src/or/relay_crypto.c @@ -7,7 +7,7 @@ #include "or/or.h" #include "or/circuitlist.h" #include "or/config.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/hs_ntor.h" // for HS_NTOR_KEY_EXPANSION_KDF_OUT_LEN #include "or/relay.h" #include "or/relay_crypto.h" diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 6fde0ba266..1da695706c 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -16,8 +16,8 @@ #include "or/connection.h" #include "or/connection_edge.h" #include "or/control.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/hs_circuit.h" #include "or/hs_client.h" diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index 2c1caa6ce5..1eadbd602c 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -16,8 +16,8 @@ #include "or/circuituse.h" #include "or/config.h" #include "or/control.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/hs_client.h" #include "or/hs_common.h" #include "or/hs_intropoint.h" diff --git a/src/or/rendmid.c b/src/or/rendmid.c index 77a5347125..56b65079ab 100644 --- a/src/or/rendmid.c +++ b/src/or/rendmid.c @@ -12,7 +12,7 @@ #include "or/circuitlist.h" #include "or/circuituse.h" #include "or/config.h" -#include "common/crypto.h" +#include "lib/crypt_ops/crypto.h" #include "or/dos.h" #include "or/relay.h" #include "or/rendmid.h" diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 21a5a4e03b..b2023c72cb 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -16,8 +16,8 @@ #include "or/circuituse.h" #include "or/config.h" #include "or/control.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/directory.h" #include "or/hs_common.h" #include "or/hs_config.h" diff --git a/src/or/rephist.c b/src/or/rephist.c index c7a0a25563..a1cfc49327 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -78,7 +78,7 @@ #include "or/circuitlist.h" #include "or/circuituse.h" #include "or/config.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/networkstatus.h" #include "or/nodelist.h" #include "or/rephist.h" diff --git a/src/or/router.c b/src/or/router.c index 4f162ceac1..f13788d66f 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -13,9 +13,9 @@ #include "or/config.h" #include "or/connection.h" #include "or/control.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" -#include "common/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" +#include "lib/crypt_ops/crypto_curve25519.h" #include "or/directory.h" #include "or/dirserv.h" #include "or/dns.h" diff --git a/src/or/router.h b/src/or/router.h index 4a383ac420..54f61c45a6 100644 --- a/src/or/router.h +++ b/src/or/router.h @@ -12,7 +12,7 @@ #ifndef TOR_ROUTER_H #define TOR_ROUTER_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" #define TOR_ROUTERINFO_ERROR_NO_EXT_ADDR (-1) #define TOR_ROUTERINFO_ERROR_CANNOT_PARSE (-2) diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c index 6bf066fbb4..9f4def0e6a 100644 --- a/src/or/routerkeys.c +++ b/src/or/routerkeys.c @@ -16,9 +16,9 @@ #include "or/or.h" #include "or/config.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/router.h" -#include "common/crypto_pwbox.h" +#include "lib/crypt_ops/crypto_pwbox.h" #include "or/routerkeys.h" #include "or/torcert.h" diff --git a/src/or/routerkeys.h b/src/or/routerkeys.h index 2339495d40..a6f06f6e20 100644 --- a/src/or/routerkeys.h +++ b/src/or/routerkeys.h @@ -4,7 +4,7 @@ #ifndef TOR_ROUTERKEYS_H #define TOR_ROUTERKEYS_H -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #define INIT_ED_KEY_CREATE (1u<<0) #define INIT_ED_KEY_REPLACE (1u<<1) diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 9a6cf8c25e..97b3270f5b 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -94,12 +94,12 @@ #include "or/or.h" #include "lib/err/backtrace.h" #include "or/bridges.h" -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "or/circuitstats.h" #include "or/config.h" #include "or/connection.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/directory.h" #include "or/dirserv.h" #include "or/entrynodes.h" diff --git a/src/or/routerlist.h b/src/or/routerlist.h index a90c26b444..6d1e2a0b8a 100644 --- a/src/or/routerlist.h +++ b/src/or/routerlist.h @@ -11,7 +11,7 @@ #ifndef TOR_ROUTERLIST_H #define TOR_ROUTERLIST_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" int get_n_authorities(dirinfo_type_t type); int trusted_dirs_reload_certs(void); diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 48b1828172..a0426b96c6 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -58,7 +58,7 @@ #include "or/or.h" #include "or/circuitstats.h" #include "or/config.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/dirauth/shared_random.h" #include "or/dirserv.h" #include "or/entrynodes.h" diff --git a/src/or/scheduler.h b/src/or/scheduler.h index 37c192fea9..856923f9a7 100644 --- a/src/or/scheduler.h +++ b/src/or/scheduler.h @@ -11,7 +11,7 @@ #include "or/or.h" #include "or/channel.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" /** Scheduler type, we build an ordered list with those values from the * parsed strings in Schedulers. The reason to do such a thing is so we can diff --git a/src/or/status.h b/src/or/status.h index 840ec11986..7258ed5939 100644 --- a/src/or/status.h +++ b/src/or/status.h @@ -4,7 +4,7 @@ #ifndef TOR_STATUS_H #define TOR_STATUS_H -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" int log_heartbeat(time_t now); diff --git a/src/or/torcert.c b/src/or/torcert.c index a6bbe4231d..23dfd3d437 100644 --- a/src/or/torcert.c +++ b/src/or/torcert.c @@ -27,7 +27,7 @@ #include "or/or.h" #include "or/config.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "or/torcert.h" #include "trunnel/ed25519_cert.h" #include "common/torlog.h" diff --git a/src/or/torcert.h b/src/or/torcert.h index cba3d3622b..ba5787934b 100644 --- a/src/or/torcert.h +++ b/src/or/torcert.h @@ -4,7 +4,7 @@ #ifndef TORCERT_H_INCLUDED #define TORCERT_H_INCLUDED -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #define SIGNED_KEY_TYPE_ED25519 0x01 diff --git a/src/rust/build.rs b/src/rust/build.rs index f9b40689fc..8b0ea8ed65 100644 --- a/src/rust/build.rs +++ b/src/rust/build.rs @@ -149,7 +149,7 @@ pub fn main() { // will have dependencies on all the other rust packages that // tor uses. We must be careful with factoring and dependencies // moving forward! - cfg.component("or-crypto-testing"); + cfg.component("tor-crypt-ops-testing"); cfg.component("or-testing"); cfg.component("tor-err-testing"); cfg.component("or-event-testing"); diff --git a/src/test/bench.c b/src/test/bench.c index f54d8f5c60..49ac7269ef 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -20,10 +20,10 @@ #include <openssl/obj_mac.h> #include "or/config.h" -#include "common/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_curve25519.h" #include "or/onion_ntor.h" -#include "common/crypto_ed25519.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/consdiff.h" #include "or/cell_st.h" diff --git a/src/test/fuzz/fuzz_hsdescv3.c b/src/test/fuzz/fuzz_hsdescv3.c index d1ef34b6b3..ada9fa6c2d 100644 --- a/src/test/fuzz/fuzz_hsdescv3.c +++ b/src/test/fuzz/fuzz_hsdescv3.c @@ -6,7 +6,7 @@ #include "or/or.h" #include "trunnel/ed25519_cert.h" /* Trunnel interface. */ -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "or/hs_descriptor.h" #include "or/routerparse.h" #include "common/util.h" diff --git a/src/test/fuzz/fuzzing_common.c b/src/test/fuzz/fuzzing_common.c index 12ebd97bd6..9e736ea69d 100644 --- a/src/test/fuzz/fuzzing_common.c +++ b/src/test/fuzz/fuzzing_common.c @@ -6,8 +6,8 @@ #include "lib/err/backtrace.h" #include "or/config.h" #include "test/fuzz/fuzzing.h" -#include "common/crypto.h" -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_ed25519.h" static or_options_t *mock_options = NULL; static const or_options_t * diff --git a/src/test/hs_test_helpers.c b/src/test/hs_test_helpers.c index ea12970b92..d238bf8e59 100644 --- a/src/test/hs_test_helpers.c +++ b/src/test/hs_test_helpers.c @@ -2,7 +2,7 @@ /* See LICENSE for licensing information */ #include "or/or.h" -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "test/test.h" #include "or/torcert.h" diff --git a/src/test/include.am b/src/test/include.am index 0f0dc6a7f5..7e5ad46117 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -157,7 +157,6 @@ src_test_test_SOURCES += \ src/test/test_proto_misc.c \ src/test/test_protover.c \ src/test/test_pt.c \ - src/test/test_pubsub.c \ src/test/test_relay.c \ src/test/test_relaycell.c \ src/test/test_relaycrypt.c \ diff --git a/src/test/rend_test_helpers.c b/src/test/rend_test_helpers.c index 6f0c1c121b..31af58c278 100644 --- a/src/test/rend_test_helpers.c +++ b/src/test/rend_test_helpers.c @@ -2,7 +2,7 @@ /* See LICENSE for licensing information */ #include "or/or.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "test/test.h" #include "or/rendcommon.h" #include "test/rend_test_helpers.h" diff --git a/src/test/test-memwipe.c b/src/test/test-memwipe.c index a8326aa671..16bb017c89 100644 --- a/src/test/test-memwipe.c +++ b/src/test/test-memwipe.c @@ -7,7 +7,7 @@ #include <sys/types.h> #include <stdlib.h> -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/compat.h" #include "common/util.h" diff --git a/src/test/test-timers.c b/src/test/test-timers.c index 1953ea5e31..70f07fba47 100644 --- a/src/test/test-timers.c +++ b/src/test/test-timers.c @@ -9,7 +9,7 @@ #include "common/compat.h" #include "common/compat_libevent.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "common/timers.h" #include "common/util.h" diff --git a/src/test/test.c b/src/test/test.c index 8bdeb60bd9..1a3f4f8eb2 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -9,7 +9,7 @@ **/ #include "orconfig.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include <stdio.h> #ifdef HAVE_FCNTL_H @@ -44,7 +44,7 @@ double fabs(double x); #include "common/buffers.h" #include "or/circuitlist.h" #include "or/circuitstats.h" -#include "common/compress.h" +#include "lib/compress/compress.h" #include "or/config.h" #include "or/connection_edge.h" #include "or/rendcommon.h" @@ -60,7 +60,7 @@ double fabs(double x); #include "or/rephist.h" #include "or/routerparse.h" #include "or/statefile.h" -#include "common/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_curve25519.h" #include "or/extend_info_st.h" #include "or/or_circuit_st.h" @@ -917,10 +917,8 @@ struct testgroup_t testgroups[] = { { "util/format/", util_format_tests }, { "util/logging/", logging_tests }, { "util/process/", util_process_tests }, - { "util/pubsub/", pubsub_tests }, { "util/thread/", thread_tests }, { "util/handle/", handle_tests }, { "dns/", dns_tests }, END_OF_GROUPS }; - diff --git a/src/test/test.h b/src/test/test.h index 29e6544697..9abd46008d 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -248,7 +248,6 @@ extern struct testcase_t procmon_tests[]; extern struct testcase_t proto_http_tests[]; extern struct testcase_t proto_misc_tests[]; extern struct testcase_t protover_tests[]; -extern struct testcase_t pubsub_tests[]; extern struct testcase_t pt_tests[]; extern struct testcase_t relay_tests[]; extern struct testcase_t relaycell_tests[]; @@ -292,4 +291,3 @@ extern const char AUTHORITY_SIGNKEY_C_DIGEST[]; extern const char AUTHORITY_SIGNKEY_C_DIGEST256[]; #endif /* !defined(TOR_TEST_H) */ - diff --git a/src/test/test_addr.c b/src/test/test_addr.c index 6778fde974..0a3212adbc 100644 --- a/src/test/test_addr.c +++ b/src/test/test_addr.c @@ -6,7 +6,7 @@ #define ADDRESSMAP_PRIVATE #include "orconfig.h" #include "or/or.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "test/test.h" #include "or/addressmap.h" #include "test/log_test_helpers.h" diff --git a/src/test/test_address_set.c b/src/test/test_address_set.c index 1df7b34422..3699685848 100644 --- a/src/test/test_address_set.c +++ b/src/test/test_address_set.c @@ -2,7 +2,7 @@ /* See LICENSE for licensing information */ #include "or/or.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "common/address_set.h" #include "or/microdesc.h" #include "or/networkstatus.h" diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c index cd4c9d0aef..080325538f 100644 --- a/src/test/test_buffers.c +++ b/src/test/test_buffers.c @@ -7,8 +7,8 @@ #define PROTO_HTTP_PRIVATE #include "or/or.h" #include "common/buffers.h" -#include "common/buffers_tls.h" -#include "common/crypto_rand.h" +#include "lib/tls/buffers_tls.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/proto_http.h" #include "or/proto_socks.h" #include "test/test.h" diff --git a/src/test/test_cell_formats.c b/src/test/test_cell_formats.c index 685b6efc36..844fa4a16c 100644 --- a/src/test/test_cell_formats.c +++ b/src/test/test_cell_formats.c @@ -12,7 +12,7 @@ #include "or/connection_edge.h" #include "or/connection_or.h" #include "or/config.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/onion.h" #include "or/onion_tap.h" #include "or/onion_fast.h" diff --git a/src/test/test_channel.c b/src/test/test_channel.c index 5b30c71123..d236580fbd 100644 --- a/src/test/test_channel.c +++ b/src/test/test_channel.c @@ -12,7 +12,7 @@ #include "or/circuitmux_ewma.h" /* For var_cell_free */ #include "or/connection_or.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" /* For packed_cell stuff */ #define RELAY_PRIVATE #include "or/relay.h" diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c index b48bf0f162..7edfdc114a 100644 --- a/src/test/test_channelpadding.c +++ b/src/test/test_channelpadding.c @@ -7,7 +7,7 @@ #define TOR_TIMERS_PRIVATE #include "or/or.h" #include "test/test.h" -#include "common/testsupport.h" +#include "lib/testsupport/testsupport.h" #include "or/connection.h" #include "or/connection_or.h" #include "or/channel.h" diff --git a/src/test/test_channeltls.c b/src/test/test_channeltls.c index 08fec2de24..58bfaff688 100644 --- a/src/test/test_channeltls.c +++ b/src/test/test_channeltls.c @@ -15,7 +15,7 @@ #include "or/config.h" /* For init/free stuff */ #include "or/scheduler.h" -#include "common/tortls.h" +#include "lib/tls/tortls.h" #include "or/or_connection_st.h" diff --git a/src/test/test_consdiffmgr.c b/src/test/test_consdiffmgr.c index c4b89ddf03..c09586afcc 100644 --- a/src/test/test_consdiffmgr.c +++ b/src/test/test_consdiffmgr.c @@ -9,7 +9,7 @@ #include "or/consdiff.h" #include "or/consdiffmgr.h" #include "or/cpuworker.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/networkstatus.h" #include "or/routerparse.h" #include "common/workqueue.h" diff --git a/src/test/test_containers.c b/src/test/test_containers.c index 1d5ee4fc97..efc6a181fd 100644 --- a/src/test/test_containers.c +++ b/src/test/test_containers.c @@ -5,7 +5,7 @@ #include "orconfig.h" #include "or/or.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/fp_pair.h" #include "test/test.h" diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index c580a1945c..e8a2efe597 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -8,12 +8,12 @@ #define CRYPTO_RAND_PRIVATE #include "or/or.h" #include "test/test.h" -#include "common/aes.h" +#include "lib/crypt_ops/aes.h" #include "common/util.h" #include "siphash.h" -#include "common/crypto_curve25519.h" -#include "common/crypto_ed25519.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_rand.h" #include "ed25519_vectors.inc" /** Run unit tests for Diffie-Hellman functionality. */ diff --git a/src/test/test_crypto_openssl.c b/src/test/test_crypto_openssl.c index f33ed58d40..cc817ad702 100644 --- a/src/test/test_crypto_openssl.c +++ b/src/test/test_crypto_openssl.c @@ -7,7 +7,7 @@ #define CRYPTO_RAND_PRIVATE -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "common/util.h" #include "common/util_format.h" #include "common/compat.h" @@ -15,7 +15,7 @@ #include <openssl/evp.h> #include <openssl/rand.h> -#include "common/compat_openssl.h" +#include "lib/crypt_ops/compat_openssl.h" /* Test for rectifying openssl RAND engine. */ static void diff --git a/src/test/test_crypto_slow.c b/src/test/test_crypto_slow.c index c15d8deb9e..9878a0d026 100644 --- a/src/test/test_crypto_slow.c +++ b/src/test/test_crypto_slow.c @@ -7,9 +7,9 @@ #define CRYPTO_S2K_PRIVATE #include "or/or.h" #include "test/test.h" -#include "common/crypto_s2k.h" -#include "common/crypto_pwbox.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_s2k.h" +#include "lib/crypt_ops/crypto_pwbox.h" +#include "lib/crypt_ops/crypto_rand.h" #if defined(HAVE_LIBSCRYPT_H) && defined(HAVE_LIBSCRYPT_SCRYPT) #define HAVE_LIBSCRYPT diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 56293b5787..9578ba1d33 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -22,8 +22,8 @@ #include "or/confparse.h" #include "or/config.h" #include "or/control.h" -#include "common/crypto_ed25519.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/directory.h" #include "or/dirserv.h" #include "or/dirauth/dirvote.h" diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c index fbc14e3d30..90ca7d357c 100644 --- a/src/test/test_dir_handle_get.c +++ b/src/test/test_dir_handle_get.c @@ -15,7 +15,7 @@ #include "or/consdiffmgr.h" #include "or/directory.h" #include "test/test.h" -#include "common/compress.h" +#include "lib/compress/compress.h" #include "or/rendcommon.h" #include "or/rendcache.h" #include "or/router.h" diff --git a/src/test/test_dos.c b/src/test/test_dos.c index 7a2a87d32d..4ba24292ca 100644 --- a/src/test/test_dos.c +++ b/src/test/test_dos.c @@ -8,7 +8,7 @@ #include "or/or.h" #include "or/dos.h" #include "or/circuitlist.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/geoip.h" #include "or/channel.h" #include "or/microdesc.h" diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c index 2af9c4a378..2391e10cd6 100644 --- a/src/test/test_entrynodes.c +++ b/src/test/test_entrynodes.c @@ -18,7 +18,7 @@ #include "or/circuitbuild.h" #include "or/config.h" #include "or/confparse.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/directory.h" #include "or/entrynodes.h" #include "or/nodelist.h" diff --git a/src/test/test_extorport.c b/src/test/test_extorport.c index 64ecd422f5..3e99961ce5 100644 --- a/src/test/test_extorport.c +++ b/src/test/test_extorport.c @@ -10,7 +10,7 @@ #include "or/connection_or.h" #include "or/config.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/ext_orport.h" #include "or/main.h" diff --git a/src/test/test_helpers.c b/src/test/test_helpers.c index f346c15caa..2b1c33aa62 100644 --- a/src/test/test_helpers.c +++ b/src/test/test_helpers.c @@ -18,7 +18,7 @@ #include "or/config.h" #include "or/confparse.h" #include "or/connection.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/main.h" #include "or/nodelist.h" #include "or/relay.h" diff --git a/src/test/test_hs_cell.c b/src/test/test_hs_cell.c index f9d25ca099..4bb3c3f77d 100644 --- a/src/test/test_hs_cell.c +++ b/src/test/test_hs_cell.c @@ -13,8 +13,8 @@ #include "test/test_helpers.h" #include "test/log_test_helpers.h" -#include "common/crypto_ed25519.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/hs_cell.h" #include "or/hs_intropoint.h" #include "or/hs_service.h" diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c index ebe75d5aa0..58002d6292 100644 --- a/src/test/test_hs_client.c +++ b/src/test/test_hs_client.c @@ -21,7 +21,7 @@ #include "test/hs_test_helpers.h" #include "or/config.h" -#include "common/crypto.h" +#include "lib/crypt_ops/crypto.h" #include "or/channeltls.h" #include "or/main.h" #include "or/nodelist.h" diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c index 1822d6c21c..6296a709dc 100644 --- a/src/test/test_hs_common.c +++ b/src/test/test_hs_common.c @@ -17,7 +17,7 @@ #include "test/hs_test_helpers.h" #include "or/connection_edge.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/hs_common.h" #include "or/hs_client.h" #include "or/hs_service.h" diff --git a/src/test/test_hs_descriptor.c b/src/test/test_hs_descriptor.c index 00b25f142f..5cc0e99c60 100644 --- a/src/test/test_hs_descriptor.c +++ b/src/test/test_hs_descriptor.c @@ -8,9 +8,9 @@ #define HS_DESCRIPTOR_PRIVATE -#include "common/crypto_ed25519.h" -#include "common/crypto_digest.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_rand.h" #include "trunnel/ed25519_cert.h" #include "or/or.h" #include "or/hs_descriptor.h" diff --git a/src/test/test_hs_intropoint.c b/src/test/test_hs_intropoint.c index 34e51cba61..843f39423b 100644 --- a/src/test/test_hs_intropoint.c +++ b/src/test/test_hs_intropoint.c @@ -13,7 +13,7 @@ #include "test/test.h" #include "test/log_test_helpers.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/or.h" #include "or/circuitlist.h" diff --git a/src/test/test_hs_ntor_cl.c b/src/test/test_hs_ntor_cl.c index 8c19877729..9b59f0ddb6 100644 --- a/src/test/test_hs_ntor_cl.c +++ b/src/test/test_hs_ntor_cl.c @@ -16,8 +16,8 @@ #include "or/or.h" #include "common/util.h" #include "common/compat.h" -#include "common/crypto.h" -#include "common/crypto_curve25519.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_curve25519.h" #include "or/hs_ntor.h" #include "or/onion_ntor.h" diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c index bcf72b4546..684ac98f42 100644 --- a/src/test/test_hs_service.c +++ b/src/test/test_hs_service.c @@ -33,7 +33,7 @@ #include "or/circuitbuild.h" #include "or/circuitlist.h" #include "or/circuituse.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/dirauth/dirvote.h" #include "or/networkstatus.h" #include "or/nodelist.h" diff --git a/src/test/test_introduce.c b/src/test/test_introduce.c index 6ffb22fcac..f62c7f8808 100644 --- a/src/test/test_introduce.c +++ b/src/test/test_introduce.c @@ -2,7 +2,7 @@ /* See LICENSE for licensing information */ #include "orconfig.h" -#include "common/crypto.h" +#include "lib/crypt_ops/crypto.h" #include "or/or.h" #include "test/test.h" diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c index 0e5ad7bba7..1dc8bc2d24 100644 --- a/src/test/test_nodelist.c +++ b/src/test/test_nodelist.c @@ -7,7 +7,7 @@ **/ #include "or/or.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/networkstatus.h" #include "or/nodelist.h" #include "or/torcert.h" diff --git a/src/test/test_ntor_cl.c b/src/test/test_ntor_cl.c index dbc607db3d..a10cd7e9b5 100644 --- a/src/test/test_ntor_cl.c +++ b/src/test/test_ntor_cl.c @@ -9,8 +9,8 @@ #include "or/or.h" #include "common/util.h" #include "common/compat.h" -#include "common/crypto.h" -#include "common/crypto_curve25519.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_curve25519.h" #include "or/onion_ntor.h" #define N_ARGS(n) STMT_BEGIN { \ diff --git a/src/test/test_oom.c b/src/test/test_oom.c index 0edc22c502..c78ec4099f 100644 --- a/src/test/test_oom.c +++ b/src/test/test_oom.c @@ -13,7 +13,7 @@ #include "common/compat_libevent.h" #include "or/connection.h" #include "or/config.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/relay.h" #include "test/test.h" #include "test/test_helpers.h" diff --git a/src/test/test_pubsub.c b/src/test/test_pubsub.c deleted file mode 100644 index 4f6cdc1996..0000000000 --- a/src/test/test_pubsub.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (c) 2016-2018, The Tor Project, Inc. */ -/* See LICENSE for licensing information */ - -/** - * \file test_pubsub.c - * \brief Unit tests for publish-subscribe abstraction. - **/ - -#include "or/or.h" -#include "test/test.h" -#include "common/pubsub.h" - -DECLARE_PUBSUB_STRUCT_TYPES(foobar) -DECLARE_PUBSUB_TOPIC(foobar) -DECLARE_NOTIFY_PUBSUB_TOPIC(static, foobar) -IMPLEMENT_PUBSUB_TOPIC(static, foobar) - -struct foobar_event_data_t { - unsigned u; - const char *s; -}; - -struct foobar_subscriber_data_t { - const char *name; - long l; -}; - -static int -foobar_sub1(foobar_event_data_t *ev, foobar_subscriber_data_t *mine) -{ - ev->u += 10; - mine->l += 100; - return 0; -} - -static int -foobar_sub2(foobar_event_data_t *ev, foobar_subscriber_data_t *mine) -{ - ev->u += 5; - mine->l += 50; - return 0; -} - -static void -test_pubsub_basic(void *arg) -{ - (void)arg; - foobar_subscriber_data_t subdata1 = { "hi", 0 }; - foobar_subscriber_data_t subdata2 = { "wow", 0 }; - const foobar_subscriber_t *sub1; - const foobar_subscriber_t *sub2; - foobar_event_data_t ed = { 0, "x" }; - foobar_event_data_t ed2 = { 0, "y" }; - sub1 = foobar_subscribe(foobar_sub1, &subdata1, SUBSCRIBE_ATSTART, 100); - tt_assert(sub1); - - foobar_notify(&ed, 0); - tt_int_op(subdata1.l, OP_EQ, 100); - tt_int_op(subdata2.l, OP_EQ, 0); - tt_int_op(ed.u, OP_EQ, 10); - - sub2 = foobar_subscribe(foobar_sub2, &subdata2, 0, 5); - tt_assert(sub2); - - foobar_notify(&ed2, 0); - tt_int_op(subdata1.l, OP_EQ, 200); - tt_int_op(subdata2.l, OP_EQ, 50); - tt_int_op(ed2.u, OP_EQ, 15); - - foobar_unsubscribe(sub1); - - foobar_notify(&ed, 0); - tt_int_op(subdata1.l, OP_EQ, 200); - tt_int_op(subdata2.l, OP_EQ, 100); - tt_int_op(ed.u, OP_EQ, 15); - - done: - foobar_clear(); -} - -struct testcase_t pubsub_tests[] = { - { "pubsub_basic", test_pubsub_basic, TT_FORK, NULL, NULL }, - END_OF_TESTCASES -}; - diff --git a/src/test/test_relaycell.c b/src/test/test_relaycell.c index 64b0664292..9f314b7704 100644 --- a/src/test/test_relaycell.c +++ b/src/test/test_relaycell.c @@ -9,7 +9,7 @@ #include "or/main.h" #include "or/config.h" #include "or/connection.h" -#include "common/crypto.h" +#include "lib/crypt_ops/crypto.h" #include "or/circuitbuild.h" #include "or/circuitlist.h" #include "or/connection_edge.h" diff --git a/src/test/test_relaycrypt.c b/src/test/test_relaycrypt.c index 0b8541974f..7f0ca06983 100644 --- a/src/test/test_relaycrypt.c +++ b/src/test/test_relaycrypt.c @@ -7,7 +7,7 @@ #include "or/circuitbuild.h" #define CIRCUITLIST_PRIVATE #include "or/circuitlist.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/relay.h" #include "or/relay_crypto.h" diff --git a/src/test/test_router.c b/src/test/test_router.c index f2f325785f..6e9424a3ad 100644 --- a/src/test/test_router.c +++ b/src/test/test_router.c @@ -9,8 +9,8 @@ #include "or/or.h" #include "or/config.h" -#include "common/crypto_curve25519.h" -#include "common/crypto_ed25519.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_ed25519.h" #include "or/router.h" #include "or/routerlist.h" diff --git a/src/test/test_routerkeys.c b/src/test/test_routerkeys.c index 8cfc9f808f..948cf0d60c 100644 --- a/src/test/test_routerkeys.c +++ b/src/test/test_routerkeys.c @@ -10,7 +10,7 @@ #include "or/router.h" #include "or/routerkeys.h" #include "common/util.h" -#include "common/crypto.h" +#include "lib/crypt_ops/crypto.h" #include "or/torcert.h" #include "test/test.h" diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c index b6032ed87c..e8f8478330 100644 --- a/src/test/test_routerlist.c +++ b/src/test/test_routerlist.c @@ -18,7 +18,7 @@ #include "or/connection.h" #include "common/container.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/directory.h" #include "or/dirauth/dirvote.h" #include "or/entrynodes.h" diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c index 149129d0c7..55910a351e 100644 --- a/src/test/test_shared_random.c +++ b/src/test/test_shared_random.c @@ -9,7 +9,7 @@ #include "or/or.h" #include "test/test.h" #include "or/config.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/dirauth/dirvote.h" #include "or/dirauth/shared_random.h" #include "or/dirauth/shared_random_state.h" diff --git a/src/test/test_storagedir.c b/src/test/test_storagedir.c index 4deb881335..4dd7673521 100644 --- a/src/test/test_storagedir.c +++ b/src/test/test_storagedir.c @@ -2,7 +2,7 @@ /* See LICENSE for licensing information */ #include "or/or.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "common/storagedir.h" #include "test/test.h" diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c index 6c63149425..80f95b6c08 100644 --- a/src/test/test_tortls.c +++ b/src/test/test_tortls.c @@ -33,7 +33,7 @@ ENABLE_GCC_WARNING(redundant-decls) #include "or/or.h" #include "common/torlog.h" #include "or/config.h" -#include "common/tortls.h" +#include "lib/tls/tortls.h" #include "test/test.h" #include "test/log_test_helpers.h" diff --git a/src/test/test_util.c b/src/test/test_util.c index 4d06e3e7c4..a766f8457f 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -12,12 +12,12 @@ #include "common/buffers.h" #include "or/config.h" #include "or/control.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "test/test.h" #include "common/memarea.h" #include "common/util_process.h" #include "test/log_test_helpers.h" -#include "common/compress_zstd.h" +#include "lib/compress/compress_zstd.h" #ifdef HAVE_PWD_H #include <pwd.h> diff --git a/src/test/test_util_format.c b/src/test/test_util_format.c index d56915822f..931a184e7a 100644 --- a/src/test/test_util_format.c +++ b/src/test/test_util_format.c @@ -6,7 +6,7 @@ #include "test/test.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #define UTIL_FORMAT_PRIVATE #include "common/util_format.h" diff --git a/src/test/test_util_slow.c b/src/test/test_util_slow.c index 3d725d5025..9e4d7b0a10 100644 --- a/src/test/test_util_slow.c +++ b/src/test/test_util_slow.c @@ -7,7 +7,7 @@ #define UTIL_PRIVATE #include "common/util.h" #include "common/util_process.h" -#include "common/crypto.h" +#include "lib/crypt_ops/crypto.h" #include "common/torlog.h" #include "test/test.h" diff --git a/src/test/test_workqueue.c b/src/test/test_workqueue.c index 6935d286c8..fe23c5319d 100644 --- a/src/test/test_workqueue.c +++ b/src/test/test_workqueue.c @@ -7,8 +7,8 @@ #include "common/compat_threads.h" #include "or/onion.h" #include "common/workqueue.h" -#include "common/crypto_curve25519.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_curve25519.h" +#include "lib/crypt_ops/crypto_rand.h" #include "common/compat_libevent.h" #include <stdio.h> diff --git a/src/test/testing_common.c b/src/test/testing_common.c index f9e60001da..3baeb98031 100644 --- a/src/test/testing_common.c +++ b/src/test/testing_common.c @@ -13,7 +13,7 @@ #include "or/or.h" #include "or/control.h" #include "or/config.h" -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "or/rephist.h" #include "lib/err/backtrace.h" #include "test/test.h" diff --git a/src/test/testing_rsakeys.c b/src/test/testing_rsakeys.c index f45fcb11a4..087a14e649 100644 --- a/src/test/testing_rsakeys.c +++ b/src/test/testing_rsakeys.c @@ -3,7 +3,7 @@ * Copyright (c) 2007-2018, The Tor Project, Inc. */ /* See LICENSE for licensing information */ -#include "common/crypto_rand.h" +#include "lib/crypt_ops/crypto_rand.h" #include "orconfig.h" #include "or/or.h" #include "test/test.h" diff --git a/src/tools/tor-gencert.c b/src/tools/tor-gencert.c index 07db3624ba..c2a2e01513 100644 --- a/src/tools/tor-gencert.c +++ b/src/tools/tor-gencert.c @@ -37,10 +37,10 @@ ENABLE_GCC_WARNING(redundant-decls) #include "common/util.h" #include "common/torlog.h" -#include "common/crypto.h" -#include "common/crypto_digest.h" -#include "common/crypto_rand.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto.h" +#include "lib/crypt_ops/crypto_digest.h" +#include "lib/crypt_ops/crypto_rand.h" +#include "lib/crypt_ops/crypto_util.h" #include "common/address.h" #include "common/util_format.h" diff --git a/src/trace/include.am b/src/trace/include.am deleted file mode 100644 index 5e5eaaf9b5..0000000000 --- a/src/trace/include.am +++ /dev/null @@ -1,19 +0,0 @@ - -noinst_LIBRARIES += \ - src/trace/libor-trace.a -LIBOR_TRACE_A_SOURCES = \ - src/trace/trace.c - -TRACEHEADERS = \ - src/trace/trace.h \ - src/trace/events.h - -if USE_EVENT_TRACING_DEBUG -TRACEHEADERS += \ - src/trace/debug.h -endif - -# Library source files. -src_trace_libor_trace_a_SOURCES = $(LIBOR_TRACE_A_SOURCES) - -noinst_HEADERS+= $(TRACEHEADERS) diff --git a/src/trunnel/trunnel-local.h b/src/trunnel/trunnel-local.h index f25659bf6f..df852acb19 100644 --- a/src/trunnel/trunnel-local.h +++ b/src/trunnel/trunnel-local.h @@ -4,7 +4,7 @@ #include "common/util.h" #include "common/compat.h" -#include "common/crypto_util.h" +#include "lib/crypt_ops/crypto_util.h" #define trunnel_malloc tor_malloc #define trunnel_calloc tor_calloc |