Skip to content

Commit 1d84107

Browse files
committed
Squashed 'src/secp256k1/' changes from 22f60a6..2bfb82b
2bfb82b Merge pull request dogecoin#351 06aeea5 Turn secp256k1_ec_pubkey_serialize outlen to in/out 970164d Merge pull request dogecoin#348 6466625 Improvements for coordinate decompression e2100ad Merge pull request dogecoin#347 8e48787 Change secp256k1_ec_pubkey_combine's count argument to size_t. c69dea0 Clear output in more cases for pubkey_combine, adds tests. 269d422 Comment copyediting. b4d17da Merge pull request dogecoin#344 4709265 Merge pull request dogecoin#345 26abce7 Adds 32 static test vectors for scalar mul, sqr, inv. 5b71a3f Better error case handling for pubkey_create & pubkey_serialize, more tests. 3b7bc69 Merge pull request dogecoin#343 eed87af Change contrib/laxder from headers-only to files compilable as standalone C d7eb1ae Merge pull request dogecoin#342 7914a6e Make lax_der_privatekey_parsing.h not depend on internal code 73f64ff Merge pull request dogecoin#339 9234391 Overhaul flags handling 1a36898 Make flags more explicit, add runtime checks. 1a3e03a Merge pull request dogecoin#340 96be204 Add additional tests for eckey and arg-checks. bb5aa4d Make the tweak function zeroize-output-on-fail behavior consistent. 4a243da Move secp256k1_ec_privkey_import/export to contrib. 1b3efc1 Move secp256k1_ecdsa_sig_recover into the recovery module. e3cd679 Eliminate all side-effects from VERIFY_CHECK() usage. b30fc85 Avoid nonce_function_rfc6979 algo16 argument emulation. 70d4640 Make secp256k1_ec_pubkey_create skip processing invalid secret keys. 6c476a8 Minor comment improvements. 131afe5 Merge pull request dogecoin#334 0c6ab2f Introduce explicit lower-S normalization fea19e7 Add contrib/lax_der_parsing.h 3bb9c44 Rewrite ECDSA signature parsing code fa57f1b Use secp256k1_rand_int and secp256k1_rand_bits more 49b3749 Add new tests for the extra testrand functions f684d7d Faster secp256k1_rand_int implementation 251b1a6 Improve testrand: add extra random functions 31994c8 Merge pull request dogecoin#338 f79aa88 Bugfix: swap arguments to noncefp c98df26 Merge pull request dogecoin#319 67f7da4 Extensive interface and operations tests for secp256k1_ec_pubkey_parse. ee2cb40 Add ARG_CHECKs to secp256k1_ec_pubkey_parse/secp256k1_ec_pubkey_serialize 7450ef1 Merge pull request dogecoin#328 68a3c76 Merge pull request dogecoin#329 98135ee Merge pull request dogecoin#332 37100d7 improve ECDH header-doc b13d749 Fix couple of typos in API comments 7c823e3 travis: fixup module configs cc3141a Merge pull request dogecoin#325 ee58fae Merge pull request dogecoin#326 213aa67 Do not force benchmarks to be statically linked. 338fc8b Add API exports to secp256k1_nonce_function_default and secp256k1_nonce_function_rfc6979. 52fd03f Merge pull request dogecoin#320 9f6993f Remove some dead code. 357f8cd Merge pull request dogecoin#314 118cd82 Use explicit symbol visibility. 4e64608 Include public module headers when compiling modules. 1f41437 Merge pull request dogecoin#316 fe0d463 Merge pull request dogecoin#317 cfe0ed9 Fix miscellaneous style nits that irritate overactive static analysis. 2b199de Use the explicit NULL macro for pointer comparisons. 9e90516 Merge pull request dogecoin#294 dd891e0 Get rid of _t as it is POSIX reserved 201819b Merge pull request dogecoin#313 912f203 Eliminate a few unbraced statements that crept into the code. eeab823 Merge pull request dogecoin#299 486b9bb Use a flags bitfield for compressed option to secp256k1_ec_pubkey_serialize and secp256k1_ec_privkey_export 05732c5 Callback data: Accept pointers to either const or non-const data 1973c73 Bugfix: Reinitialise buffer lengths that have been used as outputs 788038d Use size_t for lengths (at least in external API) c9d7c2a secp256k1_context_set_{error,illegal}_callback: Restore default handler by passing NULL as function argument 9aac008 secp256k1_context_destroy: Allow NULL argument as a no-op 64b730b secp256k1_context_create: Use unsigned type for flags bitfield cb04ab5 Merge pull request dogecoin#309 a551669 Merge pull request dogecoin#295 81e45ff Update group_impl.h 85e3a2c Merge pull request dogecoin#112 b2eb63b Merge pull request dogecoin#293 dc0ce9f [API BREAK] Change argument order to out/outin/in 6d947ca Merge pull request dogecoin#298 c822693 Merge pull request dogecoin#301 6d04350 Merge pull request dogecoin#303 7ab311c Merge pull request dogecoin#304 5fb3229 Fixes a bug where bench_sign would fail due to passing in too small a buffer. 263dcbc remove unused assignment b183b41 bugfix: "ARG_CHECK(ctx != NULL)" makes no sense 6da1446 build: fix parallel build 5eb4356 Merge pull request dogecoin#291 c996d53 Print success 9f443be Move pubkey recovery code to separate module d49abbd Separate ECDSA recovery tests 439d34a Separate recoverable and normal signatures a7b046e Merge pull request dogecoin#289 f66907f Improve/reformat API documentation secp256k1.h 2f77487 Add context building benchmarks cc623d5 Merge pull request dogecoin#287 de7e398 small typo fix 9d96e36 Merge pull request dogecoin#280 432e1ce Merge pull request dogecoin#283 14727fd Use correct name in gitignore 356b0e9 Actually test static precomputation in Travis ff3a5df Merge pull request dogecoin#284 2587208 Merge pull request dogecoin#212 a5a66c7 Add support for custom EC-Schnorr-SHA256 signatures d84a378 Merge pull request dogecoin#252 72ae443 Improve perf. of cmov-based table lookup 92e53fc Implement endomorphism optimization for secp256k1_ecmult_const ed35d43 Make `secp256k1_scalar_add_bit` conditional; make `secp256k1_scalar_split_lambda_var` constant time 91c0ce9 Add benchmarks for ECDH and const-time multiplication 0739bbb Add ECDH module which works by hashing the output of ecmult_const 4401500 Add constant-time multiply `secp256k1_ecmult_const` for ECDH e4ce393 build: fix hard-coded usage of "gen_context" b8e39ac build: don't use BUILT_SOURCES for the static context header baa75da tests: add a couple tests ae4f0c6 Merge pull request dogecoin#278 995c548 Introduce callback functions for dealing with errors. c333074 Merge pull request dogecoin#282 18c329c Remove the internal secp256k1_ecdsa_sig_t type 74a2acd Add a secp256k1_ecdsa_signature_t type 23cfa91 Introduce secp256k1_pubkey_t type 4c63780 Merge pull request dogecoin#269 3e6f1e2 Change rfc6979 implementation to be a generic PRNG ed5334a Update configure.ac to make it build on OpenBSD 1b68366 Merge pull request dogecoin#274 a83bb48 Make ecmult static precomputation default 166b32f Merge pull request dogecoin#276 c37812f Add gen_context src/ecmult_static_context.h to CLEANFILES to fix distclean. 125c15d Merge pull request dogecoin#275 76f6769 Fix build with static ecmult altroot and make dist. 5133f78 Merge pull request dogecoin#254 b0a60e6 Merge pull request dogecoin#258 733c1e6 Add travis build to test the static context. fbecc38 Add ability to use a statically generated ecmult context. 4fb174d Merge pull request dogecoin#263 4ab8990 Merge pull request dogecoin#270 bdf0e0c Merge pull request dogecoin#271 31d0c1f Merge pull request dogecoin#273 eb2c8ff Add missing casts to SECP256K1_FE_CONST_INNER 55399c2 Further performance improvements to _ecmult_wnaf 99fd963 Add secp256k1_ec_pubkey_compress(), with test similar to the related decompress() function. 145cc6e Improve performance of _ecmult_wnaf 36b305a Verify the result of GMP modular inverse using non-GMP code 0cbc860 Merge pull request dogecoin#266 06ff7fe Merge pull request dogecoin#267 5a43124 Save 1 _fe_negate since s1 == -s2 a5d796e Update code comments 3f3964e Add specific VERIFY tests for _fe_cmov 7d054cd Refactor to save a _fe_negate b28d02a Refactor to remove a local var 55e7fc3 Perf. improvement in _gej_add_ge a0601cd Fix VERIFY calculations in _fe_cmov methods 17f7148 Merge pull request dogecoin#261 7657420 Add tests for adding P+Q with P.x!=Q.x and P.y=-Q.y 8c5d5f7 tests: Add failing unit test for dogecoin#257 (bad addition formula) 5de4c5d gej_add_ge: fix degenerate case when computing P + (-lambda)P bcf2fcf gej_add_ge: rearrange algebra e2a07c7 Fix compilation with C++ 873a453 Merge pull request dogecoin#250 91eb0da Merge pull request dogecoin#247 210ffed Use separate in and out pointers in `secp256k1_ec_pubkey_decompress` a1d5ae1 Tiny optimization 729badf Merge pull request dogecoin#210 2d5a186 Apply effective-affine trick to precomp 4f9791a Effective affine addition in EC multiplication 2b4cf41 Use pkg-config always when possible, with failover to manual checks for libcrypto git-subtree-dir: src/secp256k1 git-subtree-split: 2bfb82b10edf0f0b0e366a12f94c8b21a914159d
1 parent a591d98 commit 1d84107

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+7728
-1916
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
bench_inv
2+
bench_ecdh
23
bench_sign
34
bench_verify
5+
bench_schnorr_verify
46
bench_recover
57
bench_internal
68
tests
9+
gen_context
710
*.exe
811
*.so
912
*.a
@@ -28,6 +31,7 @@ build-aux/
2831
*~
2932
src/libsecp256k1-config.h
3033
src/libsecp256k1-config.h.in
34+
src/ecmult_static_context.h
3135
m4/libtool.m4
3236
m4/ltoptions.m4
3337
m4/ltsugar.m4

.travis.yml

+11-7
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,24 @@ compiler:
88
- gcc
99
env:
1010
global:
11-
- FIELD=auto BIGNUM=auto SCALAR=auto ENDOMORPHISM=no ASM=no BUILD=check EXTRAFLAGS= HOST=
11+
- FIELD=auto BIGNUM=auto SCALAR=auto ENDOMORPHISM=no STATICPRECOMPUTATION=yes ASM=no BUILD=check EXTRAFLAGS= HOST= ECDH=no schnorr=no RECOVERY=no
1212
matrix:
13-
- SCALAR=32bit
13+
- SCALAR=32bit RECOVERY=yes
14+
- SCALAR=32bit FIELD=32bit ECDH=yes
1415
- SCALAR=64bit
15-
- FIELD=64bit
16+
- FIELD=64bit RECOVERY=yes
1617
- FIELD=64bit ENDOMORPHISM=yes
18+
- FIELD=64bit ENDOMORPHISM=yes ECDH=yes
1719
- FIELD=64bit ASM=x86_64
1820
- FIELD=64bit ENDOMORPHISM=yes ASM=x86_64
19-
- FIELD=32bit
21+
- FIELD=32bit SCHNORR=yes
2022
- FIELD=32bit ENDOMORPHISM=yes
2123
- BIGNUM=no
22-
- BIGNUM=no ENDOMORPHISM=yes
24+
- BIGNUM=no ENDOMORPHISM=yes SCHNORR=yes RECOVERY=yes
25+
- BIGNUM=no STATICPRECOMPUTATION=no
2326
- BUILD=distcheck
24-
- EXTRAFLAGS=CFLAGS=-DDETERMINISTIC
27+
- EXTRAFLAGS=CPPFLAGS=-DDETERMINISTIC
28+
- EXTRAFLAGS=CFLAGS=-O0
2529
matrix:
2630
fast_finish: true
2731
include:
@@ -55,5 +59,5 @@ before_script: ./autogen.sh
5559
script:
5660
- if [ -n "$HOST" ]; then export USE_HOST="--host=$HOST"; fi
5761
- if [ "x$HOST" = "xi686-linux-gnu" ]; then export CC="$CC -m32"; fi
58-
- ./configure --enable-endomorphism=$ENDOMORPHISM --with-field=$FIELD --with-bignum=$BIGNUM --with-scalar=$SCALAR $EXTRAFLAGS $USE_HOST && make -j2 $BUILD
62+
- ./configure --enable-endomorphism=$ENDOMORPHISM --with-field=$FIELD --with-bignum=$BIGNUM --with-scalar=$SCALAR --enable-ecmult-static-precomputation=$STATICPRECOMPUTATION --enable-module-ecdh=$ECDH --enable-module-schnorr=$SCHNORR --enable-module-recovery=$RECOVERY $EXTRAFLAGS $USE_HOST && make -j2 $BUILD
5963
os: linux

Makefile.am

+44-10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ noinst_HEADERS += src/eckey.h
1919
noinst_HEADERS += src/eckey_impl.h
2020
noinst_HEADERS += src/ecmult.h
2121
noinst_HEADERS += src/ecmult_impl.h
22+
noinst_HEADERS += src/ecmult_const.h
23+
noinst_HEADERS += src/ecmult_const_impl.h
2224
noinst_HEADERS += src/ecmult_gen.h
2325
noinst_HEADERS += src/ecmult_gen_impl.h
2426
noinst_HEADERS += src/num.h
@@ -38,40 +40,72 @@ noinst_HEADERS += src/hash_impl.h
3840
noinst_HEADERS += src/field.h
3941
noinst_HEADERS += src/field_impl.h
4042
noinst_HEADERS += src/bench.h
43+
noinst_HEADERS += contrib/lax_der_parsing.h
44+
noinst_HEADERS += contrib/lax_der_parsing.c
45+
noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
46+
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
4147

4248
pkgconfigdir = $(libdir)/pkgconfig
4349
pkgconfig_DATA = libsecp256k1.pc
4450

4551
libsecp256k1_la_SOURCES = src/secp256k1.c
46-
libsecp256k1_la_CPPFLAGS = -I$(top_srcdir)/include $(SECP_INCLUDES)
52+
libsecp256k1_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
4753
libsecp256k1_la_LIBADD = $(SECP_LIBS)
4854

4955

5056
noinst_PROGRAMS =
5157
if USE_BENCHMARK
52-
noinst_PROGRAMS += bench_verify bench_recover bench_sign bench_internal
58+
noinst_PROGRAMS += bench_verify bench_sign bench_internal
5359
bench_verify_SOURCES = src/bench_verify.c
5460
bench_verify_LDADD = libsecp256k1.la $(SECP_LIBS)
55-
bench_verify_LDFLAGS = -static
56-
bench_recover_SOURCES = src/bench_recover.c
57-
bench_recover_LDADD = libsecp256k1.la $(SECP_LIBS)
58-
bench_recover_LDFLAGS = -static
5961
bench_sign_SOURCES = src/bench_sign.c
6062
bench_sign_LDADD = libsecp256k1.la $(SECP_LIBS)
61-
bench_sign_LDFLAGS = -static
6263
bench_internal_SOURCES = src/bench_internal.c
6364
bench_internal_LDADD = $(SECP_LIBS)
64-
bench_internal_LDFLAGS = -static
6565
bench_internal_CPPFLAGS = $(SECP_INCLUDES)
6666
endif
6767

6868
if USE_TESTS
6969
noinst_PROGRAMS += tests
7070
tests_SOURCES = src/tests.c
71-
tests_CPPFLAGS = -DVERIFY $(SECP_INCLUDES) $(SECP_TEST_INCLUDES)
71+
tests_CPPFLAGS = -DVERIFY -I$(top_srcdir)/src -I$(top_srcdir)/include $(SECP_INCLUDES) $(SECP_TEST_INCLUDES)
7272
tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS)
7373
tests_LDFLAGS = -static
7474
TESTS = tests
7575
endif
7676

77-
EXTRA_DIST = autogen.sh
77+
if USE_ECMULT_STATIC_PRECOMPUTATION
78+
CPPFLAGS_FOR_BUILD +=-I$(top_srcdir)/
79+
CFLAGS_FOR_BUILD += -Wall -Wextra -Wno-unused-function
80+
81+
gen_context_OBJECTS = gen_context.o
82+
gen_context_BIN = gen_context$(BUILD_EXEEXT)
83+
gen_%.o: src/gen_%.c
84+
$(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@
85+
86+
$(gen_context_BIN): $(gen_context_OBJECTS)
87+
$(CC_FOR_BUILD) $^ -o $@
88+
89+
$(libsecp256k1_la_OBJECTS): src/ecmult_static_context.h
90+
$(tests_OBJECTS): src/ecmult_static_context.h
91+
$(bench_internal_OBJECTS): src/ecmult_static_context.h
92+
93+
src/ecmult_static_context.h: $(gen_context_BIN)
94+
./$(gen_context_BIN)
95+
96+
CLEANFILES = $(gen_context_BIN) src/ecmult_static_context.h
97+
endif
98+
99+
EXTRA_DIST = autogen.sh src/gen_context.c src/basic-config.h
100+
101+
if ENABLE_MODULE_ECDH
102+
include src/modules/ecdh/Makefile.am.include
103+
endif
104+
105+
if ENABLE_MODULE_SCHNORR
106+
include src/modules/schnorr/Makefile.am.include
107+
endif
108+
109+
if ENABLE_MODULE_RECOVERY
110+
include src/modules/recovery/Makefile.am.include
111+
endif

build-aux/m4/ax_prog_cc_for_build.m4

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# ===========================================================================
2+
# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
3+
# ===========================================================================
4+
#
5+
# SYNOPSIS
6+
#
7+
# AX_PROG_CC_FOR_BUILD
8+
#
9+
# DESCRIPTION
10+
#
11+
# This macro searches for a C compiler that generates native executables,
12+
# that is a C compiler that surely is not a cross-compiler. This can be
13+
# useful if you have to generate source code at compile-time like for
14+
# example GCC does.
15+
#
16+
# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
17+
# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
18+
# The value of these variables can be overridden by the user by specifying
19+
# a compiler with an environment variable (like you do for standard CC).
20+
#
21+
# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
22+
# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
23+
# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
24+
# substituted in the Makefile.
25+
#
26+
# LICENSE
27+
#
28+
# Copyright (c) 2008 Paolo Bonzini <[email protected]>
29+
#
30+
# Copying and distribution of this file, with or without modification, are
31+
# permitted in any medium without royalty provided the copyright notice
32+
# and this notice are preserved. This file is offered as-is, without any
33+
# warranty.
34+
35+
#serial 8
36+
37+
AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
38+
AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
39+
AC_REQUIRE([AC_PROG_CC])dnl
40+
AC_REQUIRE([AC_PROG_CPP])dnl
41+
AC_REQUIRE([AC_EXEEXT])dnl
42+
AC_REQUIRE([AC_CANONICAL_HOST])dnl
43+
44+
dnl Use the standard macros, but make them use other variable names
45+
dnl
46+
pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
47+
pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
48+
pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
49+
pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
50+
pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
51+
pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
52+
pushdef([ac_cv_objext], ac_cv_build_objext)dnl
53+
pushdef([ac_exeext], ac_build_exeext)dnl
54+
pushdef([ac_objext], ac_build_objext)dnl
55+
pushdef([CC], CC_FOR_BUILD)dnl
56+
pushdef([CPP], CPP_FOR_BUILD)dnl
57+
pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
58+
pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
59+
pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
60+
pushdef([host], build)dnl
61+
pushdef([host_alias], build_alias)dnl
62+
pushdef([host_cpu], build_cpu)dnl
63+
pushdef([host_vendor], build_vendor)dnl
64+
pushdef([host_os], build_os)dnl
65+
pushdef([ac_cv_host], ac_cv_build)dnl
66+
pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
67+
pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
68+
pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
69+
pushdef([ac_cv_host_os], ac_cv_build_os)dnl
70+
pushdef([ac_cpp], ac_build_cpp)dnl
71+
pushdef([ac_compile], ac_build_compile)dnl
72+
pushdef([ac_link], ac_build_link)dnl
73+
74+
save_cross_compiling=$cross_compiling
75+
save_ac_tool_prefix=$ac_tool_prefix
76+
cross_compiling=no
77+
ac_tool_prefix=
78+
79+
AC_PROG_CC
80+
AC_PROG_CPP
81+
AC_EXEEXT
82+
83+
ac_tool_prefix=$save_ac_tool_prefix
84+
cross_compiling=$save_cross_compiling
85+
86+
dnl Restore the old definitions
87+
dnl
88+
popdef([ac_link])dnl
89+
popdef([ac_compile])dnl
90+
popdef([ac_cpp])dnl
91+
popdef([ac_cv_host_os])dnl
92+
popdef([ac_cv_host_vendor])dnl
93+
popdef([ac_cv_host_cpu])dnl
94+
popdef([ac_cv_host_alias])dnl
95+
popdef([ac_cv_host])dnl
96+
popdef([host_os])dnl
97+
popdef([host_vendor])dnl
98+
popdef([host_cpu])dnl
99+
popdef([host_alias])dnl
100+
popdef([host])dnl
101+
popdef([LDFLAGS])dnl
102+
popdef([CPPFLAGS])dnl
103+
popdef([CFLAGS])dnl
104+
popdef([CPP])dnl
105+
popdef([CC])dnl
106+
popdef([ac_objext])dnl
107+
popdef([ac_exeext])dnl
108+
popdef([ac_cv_objext])dnl
109+
popdef([ac_cv_exeext])dnl
110+
popdef([ac_cv_prog_cc_g])dnl
111+
popdef([ac_cv_prog_cc_cross])dnl
112+
popdef([ac_cv_prog_cc_works])dnl
113+
popdef([ac_cv_prog_gcc])dnl
114+
popdef([ac_cv_prog_CPP])dnl
115+
116+
dnl Finally, set Makefile variables
117+
dnl
118+
BUILD_EXEEXT=$ac_build_exeext
119+
BUILD_OBJEXT=$ac_build_objext
120+
AC_SUBST(BUILD_EXEEXT)dnl
121+
AC_SUBST(BUILD_OBJEXT)dnl
122+
AC_SUBST([CFLAGS_FOR_BUILD])dnl
123+
AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
124+
AC_SUBST([LDFLAGS_FOR_BUILD])dnl
125+
])

build-aux/m4/bitcoin_secp.m4

+11-7
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ AC_MSG_RESULT([$has_64bit_asm])
1616

1717
dnl
1818
AC_DEFUN([SECP_OPENSSL_CHECK],[
19-
if test x"$use_pkgconfig" = x"yes"; then
20-
: #NOP
19+
has_libcrypto=no
2120
m4_ifdef([PKG_CHECK_MODULES],[
2221
PKG_CHECK_MODULES([CRYPTO], [libcrypto], [has_libcrypto=yes],[has_libcrypto=no])
2322
if test x"$has_libcrypto" = x"yes"; then
@@ -27,11 +26,16 @@ if test x"$use_pkgconfig" = x"yes"; then
2726
LIBS="$TEMP_LIBS"
2827
fi
2928
])
30-
else
31-
AC_CHECK_HEADER(openssl/crypto.h,[AC_CHECK_LIB(crypto, main,[has_libcrypto=yes; CRYPTO_LIBS=-lcrypto; AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])]
32-
)])
33-
LIBS=
34-
fi
29+
if test x$has_libcrypto = xno; then
30+
AC_CHECK_HEADER(openssl/crypto.h,[
31+
AC_CHECK_LIB(crypto, main,[
32+
has_libcrypto=yes
33+
CRYPTO_LIBS=-lcrypto
34+
AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])
35+
])
36+
])
37+
LIBS=
38+
fi
3539
if test x"$has_libcrypto" = x"yes" && test x"$has_openssl_ec" = x; then
3640
AC_MSG_CHECKING(for EC functions in libcrypto)
3741
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[

0 commit comments

Comments
 (0)