diff --git a/.github/scripts/setup.sh b/.github/scripts/setup.sh index bc8cec9d2..1e074763b 100755 --- a/.github/scripts/setup.sh +++ b/.github/scripts/setup.sh @@ -30,6 +30,7 @@ sudo apt-get -qq install --no-install-recommends --allow-unauthenticated -yy \ libicu-dev \ libpq-dev \ libprotobuf-c-dev \ + libsodium-dev \ libsqlite3-dev \ libssl-dev \ libtool \ diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 630bed94f..773cd3258 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -40,6 +40,7 @@ jobs: bash \ gettext \ sqlite3 \ + libsodium \ lowdown \ pkgconf \ jq \ @@ -60,7 +61,7 @@ jobs: git clone https://github.com/lightning/bolts.git ../bolts # fatal: unsafe repository ('/Users/runner/work/lightning/lightning' is owned by someone else) git config --global --add safe.directory `pwd` - for d in libsodium libwally-core gheap jsmn libbacktrace; do git config --global --add safe.directory `pwd`/external/$d; done + for d in libwally-core gheap jsmn libbacktrace; do git config --global --add safe.directory `pwd`/external/$d; done git submodule update --init --recursive ./configure CC="$CC" --disable-valgrind diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 560e5674a..71ca8e9d2 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -37,7 +37,7 @@ jobs: run: | export PATH="/usr/local/opt:/Users/runner/.local/bin:/opt/homebrew/bin/python3.10/bin:$PATH" - brew install gnu-sed autoconf automake libtool protobuf openssl lowdown + brew install gnu-sed autoconf automake libtool protobuf openssl lowdown libsodium # https://github.com/grpc/grpc/issues/31737#issuecomment-1323796842 export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 diff --git a/.gitmodules b/.gitmodules index a23dfd76b..734acd9ef 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "daemon/jsmn"] path = external/jsmn url = https://github.com/zserge/jsmn -[submodule "libsodium"] - path = external/libsodium - url = https://github.com/jedisct1/libsodium.git [submodule "external/libbacktrace"] path = external/libbacktrace url = https://github.com/ianlancetaylor/libbacktrace.git diff --git a/configure b/configure index 0195172da..f69dc1573 100755 --- a/configure +++ b/configure @@ -629,6 +629,11 @@ while IFS='=' read VAR VAL; do eval $VAR=\"$VAL\" done < $CONFIG_VAR_FILE.$$ +if [ "$HAVE_GOOD_LIBSODIUM" != 1 ]; then + echo "*** We need a libsodium >= 1.0.4 (released 2015-06-11)." >&2 + exit 1 +fi + if [ "$HAVE_SQLITE3" = 0 -a "$HAVE_POSTGRES" = 0 ]; then # I have no database yet I must schema!) echo "*** We need a database, but neither sqlite3 nor postgres found" >&2 diff --git a/doc/contribute-to-core-lightning/contribute-to-core-lightning.md b/doc/contribute-to-core-lightning/contribute-to-core-lightning.md index 5e83adc34..0c5d2320f 100644 --- a/doc/contribute-to-core-lightning/contribute-to-core-lightning.md +++ b/doc/contribute-to-core-lightning/contribute-to-core-lightning.md @@ -24,7 +24,6 @@ Here's a list of parts, with notes: - external/ - external libraries from other sources - libbacktrace - library to provide backtraces when things go wrong. - - libsodium - encryption library (should be replaced soon with built-in) - libwally-core - bitcoin helper library - secp256k1 - bitcoin curve encryption library within libwally-core - jsmn - tiny JSON parsing helper diff --git a/doc/getting-started/getting-started/installation.md b/doc/getting-started/getting-started/installation.md index 45974315a..dfc064f08 100644 --- a/doc/getting-started/getting-started/installation.md +++ b/doc/getting-started/getting-started/installation.md @@ -237,7 +237,7 @@ lightningd --network=testnet OS version: FreeBSD 11.1-RELEASE or above ```shell -pkg install git python py39-pip gmake libtool gmp sqlite3 postgresql13-client gettext autotools lowdown +pkg install git python py39-pip gmake libtool gmp sqlite3 postgresql13-client gettext autotools lowdown libsodium https://github.com/ElementsProject/lightning.git pip install --upgrade pip pip3 install mako diff --git a/external/Makefile b/external/Makefile index 311c94bc8..839cbac2c 100644 --- a/external/Makefile +++ b/external/Makefile @@ -1,5 +1,4 @@ SUBMODULES = \ - external/libsodium \ external/libwally-core \ external/gheap \ external/jsmn \ @@ -13,7 +12,6 @@ else TARGET_DIR := external/build-$(shell ${CC} -dumpmachine) endif -LIBSODIUM_HEADERS := external/libsodium/src/libsodium/include/sodium.h LIBWALLY_HEADERS := external/libwally-core/include/wally_bip32.h \ external/libwally-core/include/wally_core.h \ external/libwally-core/include/wally_psbt.h \ @@ -25,7 +23,7 @@ JSMN_HEADERS := external/jsmn/jsmn.h GHEAP_HEADERS := external/gheap/gheap.h LIBBACKTRACE_HEADERS := external/libbacktrace/backtrace.h -EXTERNAL_HEADERS := $(LIBSODIUM_HEADERS) $(LIBWALLY_HEADERS) $(LIBSECP_HEADERS) $(JSMN_HEADERS) $(GHEAP_HEADERS) $(LIBBACKTRACE_HEADERS) +EXTERNAL_HEADERS := $(LIBWALLY_HEADERS) $(LIBSECP_HEADERS) $(JSMN_HEADERS) $(GHEAP_HEADERS) $(LIBBACKTRACE_HEADERS) EXTERNAL_LIBS := ${TARGET_DIR}/libwallycore.a ${TARGET_DIR}/libsecp256k1.a ${TARGET_DIR}/libjsmn.a ${TARGET_DIR}/libbacktrace.a EXTERNAL_INCLUDE_FLAGS := \ @@ -36,14 +34,7 @@ EXTERNAL_INCLUDE_FLAGS := \ -I external/gheap/ \ -I ${TARGET_DIR}/libbacktrace-build -ifneq ($(HAVE_GOOD_LIBSODIUM),1) -EXTERNAL_INCLUDE_FLAGS += -I external/libsodium/src/libsodium/include \ - -I external/libsodium/src/libsodium/include/sodium \ - -I $(TARGET_DIR)/libsodium-build/src/libsodium/include -EXTERNAL_LIBS += ${TARGET_DIR}/libsodium.a -else LDLIBS += $(SODIUM_LDLIBS) -endif ifeq ($(HAVE_ZLIB),1) LDLIBS += -lz @@ -59,15 +50,6 @@ endif $(EXTERNAL_HEADERS): submodcheck -# We build libsodium, since Ubuntu xenial has one too old. -$(TARGET_DIR)/libsodium.a: $(TARGET_DIR)/libsodium-build/src/libsodium/libsodium.la - $(MAKE) -C $(TARGET_DIR)/libsodium-build DESTDIR=$$(pwd)/$(TARGET_DIR) install-exec - -$(TARGET_DIR)/libsodium-build/src/libsodium/libsodium.la: external/libsodium/src/libsodium/include/sodium.h - cd external/libsodium && ./autogen.sh - mkdir -p ${TARGET_DIR}/libsodium-build - cd $(TARGET_DIR)/libsodium-build && $(TOP)/libsodium/configure CC="$(CC)" CFLAGS="$(FUZZFLAGS)" LDFLAGS="$(FUZZFLAGS)" --enable-static=yes $(CROSSCOMPILE_OPTS) --enable-shared=no --prefix=/ --libdir=/ && $(MAKE) - # libsecp included in libwally. # Wildcards here are magic. See http://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file $(TARGET_DIR)/libsecp256k1.% $(TARGET_DIR)/libwallycore.%: $(TARGET_DIR)/libwally-core-build/src/secp256k1/libsecp256k1.la $(TARGET_DIR)/libwally-core-build/src/libwallycore.la @@ -117,6 +99,5 @@ external-clean: $(RM) -rf $(TARGET_DIR) external-distclean: - make -C external/libsodium distclean || true $(RM) -rf ${TARGET_DIR}/libbacktrace-build ${TARGET_DIR}/libsodium-build ${TARGET_DIR}/libwally-core-build ${TARGET_DIR}/jsmn-build $(RM) -r `git status --ignored --porcelain external/libwally-core | grep '^!! ' | cut -c3-`