Skip to content

Fix warnings building secp256k1 tests with openssl 3.0 #23048

@andypost

Description

@andypost

Is your feature request related to a problem? Please describe.

Building package 22.0 for Alpinelinux using OpenSSL 3.0 getting warnings that tests using deprecated in 3.0 functions (only tests affected)

log of `make check`
make[4]: Entering directory '/home/skilld/aports/community/bitcoin/src/bitcoin-22.0/src/secp256k1'
  CC       src/exhaustive_tests-tests_exhaustive.o
  CC       src/tests-tests.o
src/tests.c: In function 'get_openssl_key':
src/tests.c:6161:5: warning: 'EC_KEY_new_by_curve_name' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 6161 |     EC_KEY *ec_key = EC_KEY_new_by_curve_name(NID_secp256k1);
      |     ^~~~~~
In file included from src/tests.c:25:
/usr/include/openssl/ec.h:996:31: note: declared here
  996 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_by_curve_name(int nid);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~
src/tests.c:6163:5: warning: 'd2i_ECPrivateKey' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 6163 |     CHECK(d2i_ECPrivateKey(&ec_key, &pbegin, privkeylen));
      |     ^~~~~
In file included from src/tests.c:25:
/usr/include/openssl/ec.h:1185:31: note: declared here
 1185 | OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey(EC_KEY **key,
      |                               ^~~~~~~~~~~~~~~~
src/tests.c:6164:5: warning: 'EC_KEY_check_key' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 6164 |     CHECK(EC_KEY_check_key(ec_key));
      |     ^~~~~
In file included from src/tests.c:25:
/usr/include/openssl/ec.h:1105:27: note: declared here
 1105 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_check_key(const EC_KEY *key);
      |                           ^~~~~~~~~~~~~~~~
src/tests.c: In function 'test_ecdsa_openssl':
src/tests.c:6189:5: warning: 'ECDSA_sign' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 6189 |     CHECK(ECDSA_sign(0, message, sizeof(message), signature, &sigsize, ec_key));
      |     ^~~~~
In file included from src/tests.c:25:
/usr/include/openssl/ec.h:1412:27: note: declared here
 1412 | OSSL_DEPRECATEDIN_3_0 int ECDSA_sign(int type, const unsigned char *dgst,
      |                           ^~~~~~~~~~
src/tests.c:6198:5: warning: 'ECDSA_verify' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 6198 |     CHECK(ECDSA_verify(0, message, sizeof(message), signature, secp_sigsize, ec_key) == 1);
      |     ^~~~~
In file included from src/tests.c:25:
/usr/include/openssl/ec.h:1445:27: note: declared here
 1445 | OSSL_DEPRECATEDIN_3_0 int ECDSA_verify(int type, const unsigned char *dgst,
      |                           ^~~~~~~~~~~~
src/tests.c:6200:5: warning: 'EC_KEY_free' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 6200 |     EC_KEY_free(ec_key);
      |     ^~~~~~~~~~~
In file included from src/tests.c:25:
/usr/include/openssl/ec.h:1001:28: note: declared here
 1001 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
      |                            ^~~~~~~~~~~
  CCLD     exhaustive_tests
  CCLD     tests
make  check-TESTS
make[5]: Entering directory '/home/skilld/aports/community/bitcoin/src/bitcoin-22.0/src/secp256k1'
make[6]: Entering directory '/home/skilld/aports/community/bitcoin/src/bitcoin-22.0/src/secp256k1'
PASS: exhaustive_tests
FAIL: tests
============================================================================
Testsuite summary for libsecp256k1 0.1
============================================================================
# TOTAL: 2
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

Describe the solution you'd like

According to man it needs replacement

Describe alternatives you've considered

Used to configure with --disable-openssl-tests

Additional context

Alpinelinux started OpenSSL 3.0 adoption

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions