Skip to content

Commit 65285a6

Browse files
committed
Merge bitcoin#403: configure: add flag to disable OpenSSL tests
a9b2a5d configure: add flag to disable OpenSSL tests (Andrew Poelstra)
2 parents b340123 + a9b2a5d commit 65285a6

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

configure.ac

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ AC_ARG_ENABLE(tests,
9494
[use_tests=$enableval],
9595
[use_tests=yes])
9696

97+
AC_ARG_ENABLE(openssl_tests,
98+
AS_HELP_STRING([--enable-openssl-tests],[enable OpenSSL tests, if OpenSSL is available (default is auto)]),
99+
[enable_openssl_tests=$enableval],
100+
[enable_openssl_tests=auto])
101+
97102
AC_ARG_ENABLE(experimental,
98103
AS_HELP_STRING([--enable-experimental],[allow experimental configure options (default is no)]),
99104
[use_experimental=$enableval],
@@ -351,16 +356,25 @@ esac
351356
if test x"$use_tests" = x"yes"; then
352357
SECP_OPENSSL_CHECK
353358
if test x"$has_openssl_ec" = x"yes"; then
354-
AC_DEFINE(ENABLE_OPENSSL_TESTS, 1, [Define this symbol if OpenSSL EC functions are available])
355-
SECP_TEST_INCLUDES="$SSL_CFLAGS $CRYPTO_CFLAGS"
356-
SECP_TEST_LIBS="$CRYPTO_LIBS"
357-
358-
case $host in
359-
*mingw*)
360-
SECP_TEST_LIBS="$SECP_TEST_LIBS -lgdi32"
361-
;;
362-
esac
363-
359+
if test x"$enable_openssl_tests" != x"no"; then
360+
AC_DEFINE(ENABLE_OPENSSL_TESTS, 1, [Define this symbol if OpenSSL EC functions are available])
361+
SECP_TEST_INCLUDES="$SSL_CFLAGS $CRYPTO_CFLAGS"
362+
SECP_TEST_LIBS="$CRYPTO_LIBS"
363+
364+
case $host in
365+
*mingw*)
366+
SECP_TEST_LIBS="$SECP_TEST_LIBS -lgdi32"
367+
;;
368+
esac
369+
fi
370+
else
371+
if test x"$enable_openssl_tests" = x"yes"; then
372+
AC_MSG_ERROR([OpenSSL tests requested but OpenSSL with EC support is not available])
373+
fi
374+
fi
375+
else
376+
if test x"$enable_openssl_tests" = x"yes"; then
377+
AC_MSG_ERROR([OpenSSL tests requested but tests are not enabled])
364378
fi
365379
fi
366380

src/tests.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3623,12 +3623,14 @@ void run_ecdsa_end_to_end(void) {
36233623

36243624
int test_ecdsa_der_parse(const unsigned char *sig, size_t siglen, int certainly_der, int certainly_not_der) {
36253625
static const unsigned char zeroes[32] = {0};
3626+
#ifdef ENABLE_OPENSSL_TESTS
36263627
static const unsigned char max_scalar[32] = {
36273628
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
36283629
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe,
36293630
0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b,
36303631
0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x40
36313632
};
3633+
#endif
36323634

36333635
int ret = 0;
36343636

0 commit comments

Comments
 (0)