This is an automated email from the git hooks/post-receive script.
dgoulet pushed a commit to branch main in repository tor.
commit 246ced3a8ce7bbfb60f14dec7e138670afdab647 Author: Micah Elizabeth Scott beth@torproject.org AuthorDate: Thu Mar 9 19:33:41 2023 -0800
ext: build equix and hashx using automake
This replaces the sketchy cmake invocation we had inside configure
The libs are always built and always used in unit tests, but only included in libtor and tor when --enable-gpl is set.
Signed-off-by: Micah Elizabeth Scott beth@torproject.org --- .gitignore | 1 - Makefile.am | 17 ++++++------ configure.ac | 13 +++++++-- src/ext/equix/.gitmodules | 3 --- src/ext/equix/build.sh | 7 ----- src/ext/equix/hashx/.gitignore | 9 ------- src/ext/include.am | 60 +++++++++++++++++++++++++++++++++++++----- 7 files changed, 73 insertions(+), 37 deletions(-)
diff --git a/.gitignore b/.gitignore index 737ab72bf5..94988ed982 100644 --- a/.gitignore +++ b/.gitignore @@ -152,7 +152,6 @@ core.* # /src/ext/ /src/ext/ed25519/ref10/libed25519_ref10.lib /src/ext/ed25519/donna/libed25519_donna.lib -/src/ext/equix/build /src/ext/keccak-tiny/libkeccak-tiny.lib
# /src/app diff --git a/Makefile.am b/Makefile.am index 28a1c8e57d..21f71e2e05 100644 --- a/Makefile.am +++ b/Makefile.am @@ -114,6 +114,10 @@ TOR_CRYPTO_LIBS = \ $(LIBKECCAK_TINY) \ $(LIBDONNA)
+if BUILD_MODULE_POW +TOR_CRYPTO_LIBS += $(EQUIX_LIBS) +endif + # Variants of the above for linking the testing variant of tor (for coverage # and tests) if UNITTESTS_ENABLED @@ -121,13 +125,10 @@ TOR_CRYPTO_TESTING_LIBS = \ src/lib/libtor-tls-testing.a \ src/lib/libtor-crypt-ops-testing.a \ $(LIBKECCAK_TINY) \ - $(LIBDONNA) + $(LIBDONNA) \ + $(EQUIX_LIBS) endif
-EQUIX_LIBS = \ - src/ext/equix/build/libequix.a \ - src/ext/equix/build/hashx/libhashx.a - # All static libraries used to link tor. TOR_INTERNAL_LIBS = \ src/core/libtor-app.a \ @@ -136,8 +137,7 @@ TOR_INTERNAL_LIBS = \ $(TOR_CRYPTO_LIBS) \ $(TOR_UTIL_LIBS) \ src/trunnel/libor-trunnel.a \ - src/lib/libtor-trace.a \ - $(EQUIX_LIBS) + src/lib/libtor-trace.a
libtor.a: $(TOR_INTERNAL_LIBS) $(AM_V_AR) export AR="$(AR)"; \ @@ -157,8 +157,7 @@ TOR_INTERNAL_TESTING_LIBS = \ $(TOR_CRYPTO_TESTING_LIBS) \ $(TOR_UTIL_TESTING_LIBS) \ src/trunnel/libor-trunnel-testing.a \ - src/lib/libtor-trace.a \ - $(EQUIX_LIBS) + src/lib/libtor-trace.a
src/test/libtor-testing.a: $(TOR_INTERNAL_TESTING_LIBS) $(AM_V_AR) export AR="$(AR)"; \ diff --git a/configure.ac b/configure.ac index 2b20965d68..7f01e5b076 100644 --- a/configure.ac +++ b/configure.ac @@ -31,8 +31,6 @@ tor_incr_n_warnings() { tor_ac_n_warnings=`expr $tor_ac_n_warnings + 1` }
-AC_CONFIG_COMMANDS([equix], [./src/ext/equix/build.sh]) - m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_HEADERS([orconfig.h])
@@ -2602,6 +2600,17 @@ if test "$enable_coverage" = "yes" && test "$have_clang" = "no"; then esac fi
+# These HashX parameter definitions are needed in CPPFLAGS when compiling +# the equix and hashx ext modules, but elsewhere in tor we can use orconfig.h + +m4_define([equix_hashx_size], [8]) +[HASHX_SIZE=]equix_hashx_size +AC_SUBST([HASHX_SIZE]) +AC_DEFINE([HASHX_SIZE], equix_hashx_size, + [Output size in bytes for the internal customization of HashX]) +AC_DEFINE([HASHX_STATIC], [1], [We statically link with HashX]) +AC_DEFINE([EQUIX_STATIC], [1], [We statically link with EquiX]) + CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_zlib"
AC_CONFIG_FILES([ diff --git a/src/ext/equix/.gitmodules b/src/ext/equix/.gitmodules deleted file mode 100644 index 6f1277ee9f..0000000000 --- a/src/ext/equix/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "hashx"] - path = hashx - url = https://github.com/tevador/hashx diff --git a/src/ext/equix/build.sh b/src/ext/equix/build.sh deleted file mode 100755 index 753e3a138e..0000000000 --- a/src/ext/equix/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -cd ./src/ext/equix -mkdir build -cd build -cmake .. -make diff --git a/src/ext/equix/hashx/.gitignore b/src/ext/equix/hashx/.gitignore deleted file mode 100644 index ec94c2c699..0000000000 --- a/src/ext/equix/hashx/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -bin/ -obj/ -*.user -*.suo -.vs -x64/ -Release/ -Debug/ -build/ diff --git a/src/ext/include.am b/src/ext/include.am index dea8e4419b..dad6a592b7 100644 --- a/src/ext/include.am +++ b/src/ext/include.am @@ -1,14 +1,8 @@
AM_CPPFLAGS += \ -I$(srcdir)/src/ext/ \ - -I$(srcdir)/src/ext/equix/include/ \ -I$(srcdir)/src/ext/equix/hashx/include/
-# TODO: put this with other equix/hashx ext defs when those happen, -# and also add it to the autoconf config header. For now this is here -# just for test_crypto's benefit. -AM_CPPFLAGS += -DHASHX_SIZE=8 - EXTRA_DIST += src/ext/ext.md
EXTHEADERS = \ @@ -152,6 +146,60 @@ noinst_HEADERS += $(ED25519_DONNA_HDRS) LIBED25519_DONNA=src/ext/ed25519/donna/libed25519_donna.a noinst_LIBRARIES += $(LIBED25519_DONNA)
+src_ext_equix_libhashx_a_CPPFLAGS = \ + -I$(srcdir)/src/ext/equix/hashx/include/ \ + -I$(srcdir)/src/ext/equix/hashx/src/ \ + -DHASHX_SIZE=@HASHX_SIZE@ \ + -DEQUIX_STATIC=1 -DHASHX_STATIC=1 + +src_ext_equix_libhashx_a_SOURCES = \ + src/ext/equix/hashx/src/blake2.c \ + src/ext/equix/hashx/src/compiler.c \ + src/ext/equix/hashx/src/compiler_a64.c \ + src/ext/equix/hashx/src/compiler_x86.c \ + src/ext/equix/hashx/src/context.c \ + src/ext/equix/hashx/src/hashx.c \ + src/ext/equix/hashx/src/program.c \ + src/ext/equix/hashx/src/program_exec.c \ + src/ext/equix/hashx/src/siphash.c \ + src/ext/equix/hashx/src/siphash_rng.c \ + src/ext/equix/hashx/src/virtual_memory.c + +src_ext_equix_libequix_a_CPPFLAGS = \ + -I$(srcdir)/src/ext/equix/include/ \ + -I$(srcdir)/src/ext/equix/src/ \ + $(src_ext_equix_libhashx_a_CPPFLAGS) + +src_ext_equix_libequix_a_SOURCES = \ + src/ext/equix/src/context.c \ + src/ext/equix/src/equix.c \ + src/ext/equix/src/solver.c + +EQUIX_HDRS = \ + src/ext/equix/hashx/include/hashx.h \ + src/ext/equix/hashx/src/blake2.h \ + src/ext/equix/hashx/src/compiler.h \ + src/ext/equix/hashx/src/context.h \ + src/ext/equix/hashx/src/force_inline.h \ + src/ext/equix/hashx/src/hashx_endian.h \ + src/ext/equix/hashx/src/instruction.h \ + src/ext/equix/hashx/src/program.h \ + src/ext/equix/hashx/src/siphash_rng.h \ + src/ext/equix/hashx/src/siphash.h \ + src/ext/equix/hashx/src/unreachable.h \ + src/ext/equix/hashx/src/virtual_memory.h \ + src/ext/equix/include/equix.h \ + src/ext/equix/src/context.h \ + src/ext/equix/src/solver_heap.h \ + src/ext/equix/src/solver.h + +EQUIX_LIBS = \ + src/ext/equix/libhashx.a \ + src/ext/equix/libequix.a + +noinst_HEADERS += $(EQUIX_HDRS) +noinst_LIBRARIES += $(EQUIX_LIBS) + if BUILD_KECCAK_TINY src_ext_keccak_tiny_libkeccak_tiny_a_CFLAGS=\ @CFLAGS_CONSTTIME@