Skip to content

Commit 00a32dd

Browse files
committed
[Cleanup] Remove deprecated OpenSSL Bignum support
We've been using GMP for Bignum support by default already, and now that zerocoin has been replaced, there is little reason to keep the OpenSSL fallback Bignum support anymore.
1 parent e980786 commit 00a32dd

File tree

10 files changed

+357
-1056
lines changed

10 files changed

+357
-1056
lines changed

CMakeLists.txt

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,7 @@ endif()
8585

8686
find_package(LibEvent REQUIRED)
8787

88-
find_package(GMP)
89-
if(GMP_FOUND)
90-
else()
91-
message(WARNING "GMP not found, falling back to OpenSSL for bignum!")
92-
set(BIGNUM_CONFIGURE_FLAGS "--with-zerocoin-bignum=openssl")
93-
endif()
88+
find_package(GMP REQUIRED)
9489

9590
find_package(ZMQ)
9691
find_package(Miniupnp)
@@ -363,11 +358,6 @@ set(ZEROCOIN_SOURCES
363358
./src/libzerocoin/ParamGeneration.cpp
364359
./src/libzerocoin/Params.cpp
365360
)
366-
if(GMP_FOUND)
367-
list(APPEND ZEROCOIN_SOURCES ./src/libzerocoin/bignum_gmp.cpp)
368-
else()
369-
list(APPEND ZEROCOIN_SOURCES ./src/libzerocoin/bignum_openssl.cpp)
370-
endif()
371361
add_library(ZEROCOIN_A STATIC ${ZEROCOIN_SOURCES})
372362
target_include_directories(ZEROCOIN_A PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
373363
${OPENSSL_INCLUDE_DIR}
@@ -529,14 +519,11 @@ target_link_libraries(pivx-tx
529519
secp256k1
530520
SAPLING_A
531521
rustzcash
532-
${Boost_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY} ${LIBEVENT_LIB} ${sodium_LIBRARY_RELEASE} -ldl pthread
522+
${Boost_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY} ${LIBEVENT_LIB} ${sodium_LIBRARY_RELEASE} ${GMP_LIBRARY} -ldl pthread
533523
)
534524
if($ENV{target} MATCHES "Windows")
535525
target_link_libraries(pivx-tx ${WINDOWS_LDADD})
536526
endif()
537-
if(GMP_FOUND)
538-
target_link_libraries(pivx-tx ${GMP_LIBRARY})
539-
endif()
540527
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
541528
target_link_libraries(pivx-tx "-framework Cocoa")
542529
endif()
@@ -551,7 +538,8 @@ target_include_directories(pivxd PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src
551538
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb
552539
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb/include
553540
${CMAKE_CURRENT_SOURCE_DIR}/src/leveldb/helpers/memenv
554-
${LIBEVENT_INCLUDE_DIR})
541+
${LIBEVENT_INCLUDE_DIR}
542+
${GMP_INCLUDE_DIR})
555543
target_link_libraries(pivxd
556544
pthread
557545
SERVER_A
@@ -566,16 +554,12 @@ target_link_libraries(pivxd
566554
crc32c
567555
secp256k1
568556
rustzcash
569-
${BerkeleyDB_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY} ${Boost_LIBRARIES} ${LIBEVENT_LIB} pthread
557+
${BerkeleyDB_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY} ${Boost_LIBRARIES} ${LIBEVENT_LIB} ${GMP_LIBRARY} pthread
570558
)
571559
if($ENV{target} MATCHES "Windows")
572560
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wstack-protector -fstack-protector-all -fPIE -pipe -O2 -pthread -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -pie --static")
573561
target_link_libraries(pivxd ${WINDOWS_LDADD})
574562
endif()
575-
if(GMP_FOUND)
576-
target_link_libraries(pivxd ${GMP_LIBRARY})
577-
target_include_directories(pivxd PUBLIC ${GMP_INCLUDE_DIR})
578-
endif()
579563
if(ZMQ_FOUND)
580564
target_link_libraries(pivxd ZMQ_A ${ZMQ_LIB})
581565
target_include_directories(pivxd PUBLIC ${ZMQ_INCLUDE_DIR})

build-aux/m4/gmp.m4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ if test x"$has_gmp" != x"yes"; then
99
AC_CHECK_LIB(gmp, __gmpz_init,[
1010
has_gmp=yes;
1111
LIBS="$LIBS -lgmp";
12-
AC_DEFINE(HAVE_LIBGMP, 1, [Define this symbol if libgmp is installed])
1312
])
1413
])
1514
fi

configure.ac

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,6 @@ AC_ARG_ENABLE([zmq],
237237
[use_zmq=$enableval],
238238
[use_zmq=yes])
239239

240-
AC_ARG_WITH([zerocoin-bignum],
241-
[AS_HELP_STRING([--with-zerocoin-bignum=gmp|openssl|auto],
242-
[Specify Bignum Implementation. Default is auto])],
243-
[req_bignum=$withval],
244-
[req_bignum=auto])
245-
246240
AC_ARG_ENABLE(man,
247241
[AS_HELP_STRING([--disable-man],
248242
[do not install man pages (default is to install)])],,
@@ -1159,6 +1153,12 @@ else
11591153
fi
11601154
fi
11611155

1156+
dnl gmp check
1157+
GMP_CHECK
1158+
if test x"$has_gmp" != x"yes"; then
1159+
AC_MSG_ERROR([libgmp not found])
1160+
fi
1161+
11621162
dnl univalue check
11631163

11641164
need_bundled_univalue=yes
@@ -1265,32 +1265,6 @@ if test "x$use_ccache" = "xyes"; then
12651265
AX_CHECK_PREPROC_FLAG([-Qunused-arguments],[CPPFLAGS="-Qunused-arguments $CPPFLAGS"])
12661266
fi
12671267

1268-
dnl bignum value
1269-
set_bignum=$req_bignum
1270-
case $req_bignum in
1271-
auto)
1272-
GMP_CHECK
1273-
if test x"$has_gmp" != x"yes"; then
1274-
AC_MSG_ERROR([gmp bignum automatically selected but libgmp is not available. Use depends,
1275-
install libgmp or select an other bignum implementation (ONLY gmp is fully SUPPORTED)])
1276-
else
1277-
set_bignum=gmp
1278-
fi
1279-
;;
1280-
gmp)
1281-
GMP_CHECK
1282-
if test x"$has_gmp" != x"yes"; then
1283-
AC_MSG_ERROR([gmp bignum explicitly requested but libgmp is not available])
1284-
fi
1285-
;;
1286-
openssl)
1287-
AC_MSG_WARN([openssl bignum explicitly requested. This is DEPRECATED.])
1288-
;;
1289-
*)
1290-
AC_MSG_ERROR([invalid bignum implementation selection])
1291-
;;
1292-
esac
1293-
12941268
dnl enable wallet
12951269
AC_MSG_CHECKING([if wallet should be enabled])
12961270
if test x$enable_wallet != xno; then
@@ -1381,22 +1355,6 @@ fi
13811355

13821356
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
13831357

1384-
# select bignum implementation
1385-
case $set_bignum in
1386-
gmp)
1387-
AC_DEFINE(USE_NUM_GMP, 1, [Define this symbol to use the gmp implementation])
1388-
;;
1389-
openssl)
1390-
AC_DEFINE(USE_NUM_OPENSSL, 1, [Define this symbol to use openssl implementation])
1391-
;;
1392-
*)
1393-
AC_MSG_ERROR([invalid bignum implementation])
1394-
;;
1395-
esac
1396-
1397-
AM_CONDITIONAL([USE_NUM_GMP], [test "x$set_bignum" = "xgmp"])
1398-
AM_CONDITIONAL([USE_NUM_OPENSSL], [test "x$set_bignum" = "xopenssl"])
1399-
14001358
AC_MSG_CHECKING([whether to build test_pivx])
14011359
if test x$use_tests = xyes; then
14021360
AC_MSG_RESULT([yes])
@@ -1494,8 +1452,6 @@ AC_SUBST(SODIUM_LIBS)
14941452
AC_SUBST(ZMQ_LIBS)
14951453
AC_SUBST(LIBZCASH_LIBS)
14961454
AC_SUBST(QR_LIBS)
1497-
AC_SUBST(USE_NUM_GMP)
1498-
AC_SUBST(USE_NUM_OPENSSL)
14991455
AC_SUBST(HAVE_FDATASYNC)
15001456
AC_SUBST(HAVE_FULLFSYNC)
15011457
AC_SUBST(HAVE_O_CLOEXEC)
@@ -1571,7 +1527,6 @@ if test x$bitcoin_enable_qt != xno; then
15711527
echo " with qtcharts = $use_qtcharts"
15721528
fi
15731529
echo " with zmq = $use_zmq"
1574-
echo " with bignum = $set_bignum"
15751530
echo " with test = $use_tests"
15761531
echo " with bench = $use_bench"
15771532
echo " with upnp = $use_upnp"

src/Makefile.am

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,6 @@ libzerocoin_libbitcoin_zerocoin_a_SOURCES = \
480480
libzerocoin/ParamGeneration.cpp \
481481
libzerocoin/Params.cpp \
482482
zpiv/zpivmodule.cpp
483-
if USE_NUM_GMP
484-
libzerocoin_libbitcoin_zerocoin_a_SOURCES += libzerocoin/bignum_gmp.cpp
485-
endif
486-
if USE_NUM_OPENSSL
487-
libzerocoin_libbitcoin_zerocoin_a_SOURCES += libzerocoin/bignum_openssl.cpp
488-
endif
489483

490484
# common: shared between pivxd, and pivx-qt and non-server tools
491485
libbitcoin_common_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)

0 commit comments

Comments
 (0)