Skip to content

Commit

Permalink
Build ChaCha20Poly1305 library
Browse files Browse the repository at this point in the history
- Integrate Jona Schnelli's ChaCha20Poly1305 library into our code.
- Miscellaneous build system cleanup.
  • Loading branch information
droark committed Feb 8, 2018
1 parent c2953fa commit f314fe8
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 41 deletions.
36 changes: 22 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ AS_IF([test "$CXXFLAGS" = "-g -O2"] ,[AC_SUBST(CXXFLAGS, [ ])])

#build tests arg
AC_ARG_ENABLE([tests],
AC_HELP_STRING([--enable-tests],
[build with test suites @<:@default=no@:>@]),
[want_tests="$enableval"], [want_tests=no])
AC_HELP_STRING([--enable-tests],
[build with test suites @<:@default=no@:>@]),
[want_tests="$enableval"], [want_tests=no])

#build benchmarks
AC_ARG_ENABLE([benchmarks],
AC_HELP_STRING([--enable-benchmarks],
[build with benchmark suites @<:@default=no@:>@]),
[want_benchmarks=$enableval], [want_benchmarks=no])

#build debug arg
AC_ARG_ENABLE([debug],
Expand Down Expand Up @@ -166,21 +172,23 @@ AC_CONFIG_FILES(Makefile
cppForSwig/Makefile
cppForSwig/lmdb/Makefile)

AM_CONDITIONAL([BUILD_BENCH], [test x$want_benchmarks = xyes])
AM_CONDITIONAL([BUILD_TESTS], [test "x$want_tests" = "xyes"])
if test "x$want_tests" = "xyes"; then
AC_CONFIG_FILES(cppForSwig/gtest/Makefile)
fi

AC_OUTPUT

echo " CC = $CC"
echo " CFLAGS = $CFLAGS"
echo " CPP = $CPP"
echo " CPPFLAGS = $CPPFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $CXXFLAGS"
echo " LDFLAGS = $LDFLAGS"
echo " LD = $LD"
echo " with tests = $want_tests"
echo " debug symbols = $want_debug"
echo " with GUI = $with_gui"
echo " CC = $CC"
echo " CFLAGS = $CFLAGS"
echo " CPP = $CPP"
echo " CPPFLAGS = $CPPFLAGS"
echo " CXX = $CXX"
echo " CXXFLAGS = $CXXFLAGS"
echo " LDFLAGS = $LDFLAGS"
echo " LD = $LD"
echo " with tests = $want_tests"
echo " with benchmarks = $want_benchmarks"
echo " debug symbols = $want_debug"
echo " with GUI = $with_gui"
69 changes: 42 additions & 27 deletions cppForSwig/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
bin_PROGRAMS =
noinst_PROGRAMS =
TESTS =
BENCHMARKS =
lib_LTLIBRARIES =
MAYBE_BUILD =

if BUILD_TESTS
MAYBE_BUILD += gtest
noinst_PROGRAMS += chacha20poly1305/chacha20poly1305test
TESTS += chacha20poly1305/chacha20poly1305test
endif

if BUILD_BENCH
noinst_PROGRAMS += chacha20poly1305/chacha20poly1305bench
BENCHMARKS += chacha20poly1305/chacha20poly1305bench
endif

DIST_SUBDIRS = lmdb fcgi cryptopp
Expand All @@ -20,22 +33,7 @@ if HAVE_CLANG
SWIG_FLAGS += -D__CLANG__
endif

INCLUDE_FILES = UniversalTimer.h BinaryData.h lmdb_wrapper.h \
BtcUtils.h DBUtils.h BlockObj.h BlockUtils.h EncryptionUtils.h \
BtcWallet.h LedgerEntry.h ScrAddrObj.h Blockchain.h \
BDM_mainthread.h BDM_supportClasses.h \
BlockDataViewer.h HistoryPager.h Progress.h \
txio.h TxClasses.h StoredBlockObj.h \
DatabaseBuilder.h BlockchainScanner.h BlockDataMap.h \
DataObject.h BitcoinP2p.h BDM_Server.h BDM_seder.h SocketObject.h \
FcgiMessage.h BlockDataManagerConfig.h \
Transactions.h Script.h Signer.h nodeRPC.h JSON_codec.h \
ReentrantLock.h StringSockets.h log.h OS_TranslatePath.h \
TransactionBatch.h BlockchainScanner_Super.h SigHashEnum.h TxEvalState.h \
Accounts.h Addresses.h AssetEncryption.h Assets.h \
DecryptedDataContainer.h DerviationScheme.h \
bech32/ref/c++/bech32.h bech32/ref/c++/segwit_addr.h \
SshParser.h
INCLUDE_FILES = -I. -Ibech32/ref/c++ -Ichacha20poly1305

DB_SOURCE_FILES = UniversalTimer.cpp BinaryData.cpp lmdb_wrapper.cpp \
BtcUtils.cpp DBUtils.cpp BlockObj.cpp BlockUtils.cpp EncryptionUtils.cpp \
Expand Down Expand Up @@ -64,16 +62,18 @@ CPPBLOCKUTILS_SOURCE_FILES = UniversalTimer.cpp BinaryData.cpp \
DecryptedDataContainer.cpp DerivationScheme.cpp \
bech32/ref/c++/bech32.cpp bech32/ref/c++/segwit_addr.cpp

#ArmoryDB
noinst_PROGRAMS = ArmoryDB
CHACHA20POLY1305_SOURCE_FILES = chacha20poly1305/poly1305.c \
chacha20poly1305/chacha.c chacha20poly1305/chachapoly_aead.c

ArmoryDB_SOURCES = $(INCLUDE_FILES) \
$(DB_SOURCE_FILES)
#ArmoryDB
bin_PROGRAMS += ArmoryDB
ArmoryDB_SOURCES = $(DB_SOURCE_FILES)

ArmoryDB_CXXFLAGS = $(AM_CXXFLAGS) -Ilmdb \
-Icryptopp \
-Ifcgi -Ifcgi/include \
-D__STDC_LIMIT_MACROS
ArmoryDB_CPPFLAGS = $(AM_CPPFLAGS) $(INCLUDE_FILES)

ArmoryDB_LDADD = -Llmdb -llmdb \
-Lcryptopp -lcryptopp \
Expand All @@ -84,23 +84,38 @@ ArmoryDB_LDFLAGS = -static $(LDFLAGS)

#libCppBlockUtils
if HAVE_GUI
lib_LTLIBRARIES = libCppBlockUtils.la

libCppBlockUtils_la_SOURCES = $(INCLUDE_FILES) \
$(CPPBLOCKUTILS_SOURCE_FILES) \
CppBlockUtils_wrap.cxx
lib_LTLIBRARIES += libCppBlockUtils.la
libCppBlockUtils_la_SOURCES = $(CPPBLOCKUTILS_SOURCE_FILES) \
CppBlockUtils_wrap.cxx
libCppBlockUtils_la_CPPFLAGS = $(AM_CPPFLAGS) $(INCLUDE_FILES)
libCppBlockUtils_la_CXXFLAGS = $(AM_CXXFLAGS) -Ilmdb \
-Icryptopp \
$(AX_SWIG_PYTHON_CPPFLAGS) \
$(EXTRA_PYTHON_INCLUDES) \
-D__STDC_LIMIT_MACROS

libCppBlockUtils_la_LIBADD = -Llmdb -llmdb \
./cryptopp/libcryptopp.la \
-lpthread

libCppBlockUtils_la_LDFLAGS = $(LDFLAGS)

# ChaCha20Poly1305 library
lib_LTLIBRARIES += libChaCha20Poly1305.la
libChaCha20Poly1305_la_SOURCES = $(CHACHA20POLY1305_SOURCE_FILES)
libChaCha20Poly1305_la_CPPFLAGS = $(AM_CPPFLAGS) $(INCLUDE_FILES)
libChaCha20Poly1305_la_CFLAGS = $(AM_CFLAGS)

if BUILD_TESTS
chacha20poly1305test_SOURCE_FILES = $(CHACHA20POLY1305_SOURCE_FILES) chacha20poly1305/test.c
chacha20poly1305test_CPPFLAGS = $(AM_CPPFLAGS) $(INCLUDE_FILES)
chacha20poly1305test_CFLAGS = $(AM_CFLAGS)
endif

if BUILD_BENCH
chacha20poly1305bench_SOURCE_FILES = $(CHACHA20POLY1305_SOURCE_FILES) chacha20poly1305/bench.c
chacha20poly1305bench_CPPFLAGS = $(AM_CPPFLAGS) $(INCLUDE_FILES)
chacha20poly1305bench_CFLAGS = $(AM_CFLAGS)
endif

if BUILD_DARWIN
libCppBlockUtils_la_LDFLAGS += -Wl,-rpath,@executable_path/ -Wl,-rpath,@loader_path/
endif
Expand Down

0 comments on commit f314fe8

Please sign in to comment.