clboss/external/secp256k1.patch
Vincenzo Palazzo f9a23f97f1 external: upgrade the secp256k1 to the latest version
With new dependencies version we see some wornings and
test failures.

This commit upgrade the secp256k1 dependencies in order to
fix our build system.

This commit fixes the following warnings

```
s -Wundef -Wno-unused-function -Wno-long-long -Wno-overlength-strings -W -g -c src/gen_context.c -o gen_context.o
  CC       src/bench_verify-bench_verify.o
  CC       src/bench_sign.o
  CC       src/valgrind_ctime_test.o
  CC       src/exhaustive_tests-tests_exhaustive.o
src/bench_verify.c: In function ‘bench_verify_openssl’:
src/bench_verify.c:63:13: warning: ‘EC_KEY_new’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   63 |             EC_KEY *pkey = EC_KEY_new();
      |             ^~~~~~
In file included from /usr/include/openssl/ecdsa.h:10,
                 from src/bench_verify.c:16:
/usr/include/openssl/ec.h:971:31: note: declared here
  971 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new(void);
      |                               ^~~~~~~~~~
src/bench_verify.c:68:13: warning: ‘EC_KEY_set_group’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   68 |             result = EC_KEY_set_group(pkey, data->ec_group);
      |             ^~~~~~
/usr/include/openssl/ec.h:1045:27: note: declared here
 1045 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
      |                           ^~~~~~~~~~~~~~~~
src/bench_verify.c:70:13: warning: ‘o2i_ECPublicKey’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   70 |             result = (o2i_ECPublicKey(&pkey, &pubkey, data->pubkeylen)) != NULL;
      |             ^~~~~~
/usr/include/openssl/ec.h:1239:31: note: declared here
 1239 | OSSL_DEPRECATEDIN_3_0 EC_KEY *o2i_ECPublicKey(EC_KEY **key,
      |                               ^~~~~~~~~~~~~~~
src/bench_verify.c:72:13: warning: ‘ECDSA_verify’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   72 |             result = ECDSA_verify(0, &data->msg[0], sizeof(data->msg), &data->sig[0], data->siglen, pkey) == (i == 0);
      |             ^~~~~~
/usr/include/openssl/ec.h:1450:27: note: declared here
 1450 | OSSL_DEPRECATEDIN_3_0 int ECDSA_verify(int type, const unsigned char *dgst,
      |                           ^~~~~~~~~~~~
src/bench_verify.c:74:13: warning: ‘EC_KEY_free’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   74 |             EC_KEY_free(pkey);
      |             ^~~~~~~~~~~
/usr/include/openssl/ec.h:1006:28: note: declared here
 1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);
      |                            ^~~~~~~~~~~
gcc -O2 -fvisibility=hidden -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-unused-function -Wno-long-long -Wno-overlength-strings -W -g  gen_context.o -o gen_context
./gen_context
  CC       src/libsecp256k1_la-secp256k1.lo
  CC       src/bench_internal-bench_internal.o
  CC       src/bench_ecmult-bench_ecmult.o
  CC       src/tests-tests.o
src/tests.c: In function ‘get_openssl_key’:
src/tests.c:5332:5: warning: ‘EC_KEY_new_by_curve_name’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 5332 |     EC_KEY *ec_key = EC_KEY_new_by_curve_name(NID_secp256k1);
      |     ^~~~~~
In file included from src/tests.c:24:
/usr/include/openssl/ec.h:1001:31: note: declared here
 1001 | OSSL_DEPRECATEDIN_3_0 EC_KEY *EC_KEY_new_by_curve_name(int nid);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~
src/tests.c:5334:5: warning: ‘d2i_ECPrivateKey’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 5334 |     CHECK(d2i_ECPrivateKey(&ec_key, &pbegin, privkeylen));
      |     ^~~~~
/usr/include/openssl/ec.h:1190:31: note: declared here
 1190 | OSSL_DEPRECATEDIN_3_0 EC_KEY *d2i_ECPrivateKey(EC_KEY **key,
      |                               ^~~~~~~~~~~~~~~~
src/tests.c:5335:5: warning: ‘EC_KEY_check_key’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 5335 |     CHECK(EC_KEY_check_key(ec_key));
      |     ^~~~~
/usr/include/openssl/ec.h:1110:27: note: declared here
 1110 | OSSL_DEPRECATEDIN_3_0 int EC_KEY_check_key(const EC_KEY *key);
      |                           ^~~~~~~~~~~~~~~~
src/tests.c: In function ‘test_ecdsa_openssl’:
src/tests.c:5360:5: warning: ‘ECDSA_sign’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 5360 |     CHECK(ECDSA_sign(0, message, sizeof(message), signature, &sigsize, ec_key));
      |     ^~~~~
/usr/include/openssl/ec.h:1417:27: note: declared here
 1417 | OSSL_DEPRECATEDIN_3_0 int ECDSA_sign(int type, const unsigned char *dgst,
      |                           ^~~~~~~~~~
src/tests.c:5369:5: warning: ‘ECDSA_verify’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 5369 |     CHECK(ECDSA_verify(0, message, sizeof(message), signature, secp_sigsize, ec_key) == 1);
      |     ^~~~~
/usr/include/openssl/ec.h:1450:27: note: declared here
 1450 | OSSL_DEPRECATEDIN_3_0 int ECDSA_verify(int type, const unsigned char *dgst,
      |                           ^~~~~~~~~~~~
src/tests.c:5371:5: warning: ‘EC_KEY_free’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
 5371 |     EC_KEY_free(ec_key);
      |     ^~~~~~~~~~~
/usr/include/openssl/ec.h:1006:28: note: declared here
 1006 | OSSL_DEPRECATEDIN_3_0 void EC_KEY_free(EC_KEY *key);

```

and the following test failure

```
============================================================================
make[4]: Leaving directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/basicsecure'
make[3]: Leaving directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/basicsecure'
make[2]: Leaving directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/basicsecure'
Making check in external/bitcoin-ripemd160
make[2]: Entering directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/bitcoin-ripemd160'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/bitcoin-ripemd160'
Making check in external/bitcoin-sha256
make[2]: Entering directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/bitcoin-sha256'
make[2]: Nothing to be done for 'check'.
make[2]: Leaving directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/bitcoin-sha256'
Making check in external/secp256k1/
make[2]: Entering directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/secp256k1'
make  check-TESTS
make[3]: Entering directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/secp256k1'
make[4]: Entering directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/secp256k1'
PASS: exhaustive_tests
../../../../external/secp256k1/build-aux/test-driver: line 112: 929773 Aborted                 "$@" >> "$log_file" 2>&1
FAIL: tests
============================================================================
Testsuite summary for libsecp256k1 0.1
============================================================================
============================================================================
See ./test-suite.log
============================================================================
make[4]: *** [Makefile:1209: test-suite.log] Error 1
make[4]: Leaving directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/secp256k1'
make[3]: *** [Makefile:1317: check-TESTS] Error 2
make[3]: Leaving directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/secp256k1'
make[2]: *** [Makefile:1535: check-am] Error 2
make[2]: Leaving directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub/external/secp256k1'
make[1]: *** [Makefile:5474: check-recursive] Error 1
make[1]: Leaving directory '/home/vincent/Github/clboss/clboss-0.13A/_build/sub'
make: *** [Makefile:6325: distcheck] Error 1
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-08-18 12:34:08 -07:00

76 lines
3.3 KiB
Diff

diff --git a/Makefile.am b/Makefile.am
index 29b8a69..8909287 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,10 +4,9 @@ ACLOCAL_AMFLAGS = -I build-aux/m4
# which does not have an explicit foo_CFLAGS variable set.
AM_CFLAGS = $(SECP_CFLAGS)
-lib_LTLIBRARIES = libsecp256k1.la
-include_HEADERS = include/secp256k1.h
-include_HEADERS += include/secp256k1_preallocated.h
-noinst_HEADERS =
+noinst_LTLIBRARIES = libsecp256k1.la
+noinst_HEADERS = include/secp256k1.h
+noinst_HEADERS += include/secp256k1_preallocated.h
noinst_HEADERS += src/scalar.h
noinst_HEADERS += src/scalar_4x64.h
noinst_HEADERS += src/scalar_8x32.h
@@ -71,7 +70,7 @@ noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
noinst_HEADERS += examples/examples_util.h
PRECOMPUTED_LIB = libsecp256k1_precomputed.la
-noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
+noinst_LTLIBRARIES += $(PRECOMPUTED_LIB)
libsecp256k1_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
# We need `-I$(top_srcdir)/src` in VPATH builds if libsecp256k1_precomputed_la_SOURCES have been recreated in the build tree.
# This helps users and packagers who insist on recreating the precomputed files (e.g., Gentoo).
@@ -85,7 +84,7 @@ endif
noinst_LTLIBRARIES += $(COMMON_LIB)
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libsecp256k1.pc
+noinst_DATA = libsecp256k1.pc
if USE_EXTERNAL_ASM
if USE_ASM_ARM
diff --git a/src/modules/ecdh/Makefile.am.include b/src/modules/ecdh/Makefile.am.include
index 7f7f95f..61fc1b0 100644
--- a/src/modules/ecdh/Makefile.am.include
+++ b/src/modules/ecdh/Makefile.am.include
@@ -1,4 +1,4 @@
-include_HEADERS += include/secp256k1_ecdh.h
+noinst_HEADERS += include/secp256k1_ecdh.h
noinst_HEADERS += src/modules/ecdh/main_impl.h
noinst_HEADERS += src/modules/ecdh/tests_impl.h
noinst_HEADERS += src/modules/ecdh/bench_impl.h
diff --git a/src/modules/extrakeys/Makefile.am.include b/src/modules/extrakeys/Makefile.am.include
index 0d901ec..017d6b4 100644
--- a/src/modules/extrakeys/Makefile.am.include
+++ b/src/modules/extrakeys/Makefile.am.include
@@ -1,4 +1,4 @@
-include_HEADERS += include/secp256k1_extrakeys.h
+noinst_HEADERS += include/secp256k1_extrakeys.h
noinst_HEADERS += src/modules/extrakeys/tests_impl.h
noinst_HEADERS += src/modules/extrakeys/tests_exhaustive_impl.h
noinst_HEADERS += src/modules/extrakeys/main_impl.h
diff --git a/src/modules/recovery/Makefile.am.include b/src/modules/recovery/Makefile.am.include
index 156ea69..c8a275b 100644
--- a/src/modules/recovery/Makefile.am.include
+++ b/src/modules/recovery/Makefile.am.include
@@ -1,4 +1,4 @@
-include_HEADERS += include/secp256k1_recovery.h
+noinst_HEADERS += include/secp256k1_recovery.h
noinst_HEADERS += src/modules/recovery/main_impl.h
noinst_HEADERS += src/modules/recovery/tests_impl.h
noinst_HEADERS += src/modules/recovery/tests_exhaustive_impl.h
diff --git a/src/modules/schnorrsig/Makefile.am.include b/src/modules/schnorrsig/Makefile.am.include
index 654fa2e..2fc623c 100644
--- a/src/modules/schnorrsig/Makefile.am.include
+++ b/src/modules/schnorrsig/Makefile.am.include
@@ -1,4 +1,4 @@
-include_HEADERS += include/secp256k1_schnorrsig.h
+noinst_HEADERS += include/secp256k1_schnorrsig.h
noinst_HEADERS += src/modules/schnorrsig/main_impl.h
noinst_HEADERS += src/modules/schnorrsig/tests_impl.h
noinst_HEADERS += src/modules/schnorrsig/tests_exhaustive_impl.h