Merge branch 'extract_easy_common_libs'

This commit is contained in:
Nick Mathewson
2018-06-21 13:57:13 -04:00
250 changed files with 595 additions and 947 deletions
+8 -5
View File
@@ -141,14 +141,9 @@ uptime-*.json
/src/common/libor-ctime.a
/src/common/libor-ctime-testing.a
/src/common/libor-ctime.lib
/src/common/libor-crypto.a
/src/common/libor-crypto-testing.a
/src/common/libor-crypto.lib
/src/common/libor-event.a
/src/common/libor-event-testing.a
/src/common/libor-event.lib
/src/common/libcurve25519_donna.a
/src/common/libcurve25519_donna.lib
# /src/config/
/src/config/Makefile
@@ -167,10 +162,18 @@ uptime-*.json
/src/ext/keccak-tiny/libkeccak-tiny.lib
# /src/lib
/src/lib/libcurve25519_donna.a
/src/lib/libtor-compress.a
/src/lib/libtor-compress-testing.a
/src/lib/libtor-crypt-ops.a
/src/lib/libtor-crypt-ops-testing.a
/src/lib/libtor-ctime.a
/src/lib/libtor-ctime-testing.a
/src/lib/libtor-err.a
/src/lib/libtor-err-testing.a
/src/lib/libtor-tls.a
/src/lib/libtor-tls-testing.a
/src/lib/libtor-trace.a
# /src/or/
/src/or/Makefile
+8 -6
View File
@@ -52,37 +52,39 @@ TOR_UTIL_TESTING_LIBS = \
# Internal crypto libraries used in Tor
TOR_CRYPTO_LIBS = \
src/common/libor-crypto.a \
src/lib/libtor-tls.a \
src/lib/libtor-crypt-ops.a \
$(LIBKECCAK_TINY) \
$(LIBDONNA)
# Variants of the above for linking the testing variant of tor (for coverage
# and tests)
TOR_CRYPTO_TESTING_LIBS = \
src/common/libor-crypto-testing.a \
src/lib/libtor-tls-testing.a \
src/lib/libtor-crypt-ops-testing.a \
$(LIBKECCAK_TINY) \
$(LIBDONNA)
# All static libraries used to link tor.
TOR_INTERNAL_LIBS = \
src/or/libtor-app.a \
src/lib/libtor-compress.a \
$(TOR_CRYPTO_LIBS) \
$(TOR_UTIL_LIBS) \
src/common/libor-event.a \
src/trunnel/libor-trunnel.a \
src/trace/libor-trace.a
src/lib/libtor-trace.a
# Variants of the above for linking the testing variant of tor (for coverage
# and tests)
TOR_INTERNAL_TESTING_LIBS = \
src/or/libtor-app-testing.a \
src/lib/libtor-compress-testing.a \
$(TOR_CRYPTO_TESTING_LIBS) \
$(TOR_UTIL_TESTING_LIBS) \
$(LIBKECCAK_TINY) \
$(LIBDONNA) \
src/common/libor-event-testing.a \
src/trunnel/libor-trunnel-testing.a \
src/trace/libor-trace.a
src/lib/libtor-trace.a
# All libraries used to link tor-cov
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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>
+2 -2
View File
@@ -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;
+3 -51
View File
@@ -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 {
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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>
+1 -1
View File
@@ -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>
-83
View File
@@ -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 \
-129
View File
@@ -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;
}
-179
View File
@@ -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) */
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -13,7 +13,7 @@
#define SANDBOX_H_
#include "orconfig.h"
#include "common/torint.h"
#include "lib/cc/torint.h"
#ifndef SYS_SECCOMP
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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>
+2 -2
View File
@@ -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"
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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>
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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"
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
@@ -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)
+1 -1
View File
@@ -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];
+1 -1
View File
@@ -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];
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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) \
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -1,3 +1,3 @@
/* Added for Tor. */
#include "common/torint.h"
#include "lib/cc/torint.h"
#define crypto_uint32 uint32_t
+1 -1
View File
@@ -1,3 +1,3 @@
/* Added for Tor. */
#include "common/torint.h"
#include "lib/cc/torint.h"
#define crypto_uint64 uint64_t
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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 ********/
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+7 -1
View File
@@ -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
@@ -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) */
+4
View File
@@ -0,0 +1,4 @@
noinst_HEADERS += \
src/lib/cc/compat_compiler.h \
src/lib/cc/torint.h
@@ -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;
@@ -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>
@@ -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
@@ -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
@@ -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
+25
View File
@@ -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
+3 -3
View File
@@ -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"
@@ -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
@@ -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"
@@ -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
@@ -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"
@@ -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
@@ -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)
@@ -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"
@@ -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
@@ -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"
@@ -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
@@ -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"
@@ -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,
@@ -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)
@@ -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)
@@ -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"
@@ -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
@@ -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"
@@ -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 */
@@ -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)
@@ -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"
@@ -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>
@@ -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. */
@@ -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>
@@ -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);
+44
View File
@@ -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
-2
View File
@@ -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;
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);
+2
View File
@@ -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 \
+1 -1
View File
@@ -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. */
+24
View File
@@ -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)
+3
View File
@@ -0,0 +1,3 @@
noinst_HEADERS += \
src/lib/testsupport/testsupport.h
@@ -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

Some files were not shown because too many files have changed in this diff Show More