Skip to content

Commit abe11bd

Browse files
fanquakesaikiran57
authored andcommitted
Squashed 'src/secp256k1/' changes from 4187a46649..b9313c6e1a
b9313c6e1a Merge bitcoin-core/secp256k1#1708: release cleanup: bump version after 0.7.0 a660a4976e Merge bitcoin-core/secp256k1#1707: release: Prepare for 0.7.0 7ab8b0cc01 release cleanup: bump version after 0.7.0 a3e742d947 release: Prepare for 0.7.0 f67b0ac1a0 ci: Don't hardcode ABI version 020ee60495 Merge bitcoin-core/secp256k1#1706: musig/tests: initialize keypair cde4130898 musig/tests: initialize keypair 6037833c9e Merge bitcoin-core/secp256k1#1702: changelog: update 40b4a06520 changelog: update 5e74086dc8 Merge bitcoin-core/secp256k1#1705: musig/test: Remove dead code 7c3380423c Merge bitcoin-core/secp256k1#1696: build: Refactor visibility logic and add override 8d967a602b musig/test: Remove dead code 983711cd6d musig/tests: Refactor vectors_signverify 73a695958a Merge bitcoin-core/secp256k1#1704: cmake: Make `secp256k1_objs` inherit interface defines from `secp256k1` bf082221ff cmake: Make `secp256k1_objs` inherit interface defines from `secp256k1` c82d84bb86 build: add CMake option for disabling symbol visibility attributes ce7923874f build: Add SECP256K1_NO_API_VISIBILITY_ATTRIBUTES e5297f6d79 build: Refactor visibility logic cbbbf3bd6e Merge bitcoin-core/secp256k1#1699: ci: enable musig module for native macOS arm64 job 943479a7a3 Merge bitcoin-core/secp256k1#1694: Revert "cmake: configure libsecp256k1.pc during install" 3352f9d667 ci: enable musig module for native macOS arm64 job ad60ef7ea7 Merge bitcoin-core/secp256k1#1689: ci: Convert `arm64` Cirrus tasks to GHA jobs c498779096 Merge bitcoin-core/secp256k1#1687: cmake: support the use of launchers in ctest -S scripts 44b205e9ee Revert "cmake: configure libsecp256k1.pc during install" 0dfe387dbe cmake: support the use of launchers in ctest -S scripts 89096c234d Merge bitcoin-core/secp256k1#1692: cmake: configure libsecp256k1.pc during install 7106dce6fd cmake: configure libsecp256k1.pc during install 29e73f4ba5 Merge bitcoin-core/secp256k1#1685: cmake: Emulate Libtool's behavior on FreeBSD 746e36b141 Merge bitcoin-core/secp256k1#1678: cmake: add a helper for linking into static libs a28c2ffa5c Merge bitcoin-core/secp256k1#1683: README: add link to musig example 2a9d374735 Merge bitcoin-core/secp256k1#1690: ci: Bump GCC snapshot major version to 16 add146e101 ci: Bump GCC snapshot major version to 16 004f57fcd8 ci: Move Valgrind build for `arm64` from Cirrus to GHA 5fafdfc30f ci: Move `gcc-snapshot` build for `arm64` from Cirrus to GHA e814b79a8b ci: Switch `arm64_debian` from QEMU to native `arm64` Docker image bcf77346b9 ci: Add `arm64` architecture to `docker_cache` job b77aae9226 ci: Rename Docker image tag to reflect architecture 145ae3e28d cmake: add a helper for linking into static libs 819210974b README: add link to musig example, generalize module enabling hint 95db29b144 Merge bitcoin-core/secp256k1#1679: cmake: Use `PUBLIC_HEADER` target property in installation logic 37dd422b5c cmake: Emulate Libtool's behavior on FreeBSD f24b838bed Merge bitcoin-core/secp256k1#1680: doc: Promote "Building with CMake" to standard procedure 3f31ac43e0 doc: Promote "Building with CMake" to standard procedure 6f67151ee2 cmake: Use `PUBLIC_HEADER` target property c32715b2a0 cmake, move-only: Move module option processing to `src/CMakeLists.txt` 201b2b8f06 Merge bitcoin-core/secp256k1#1675: cmake: Bump minimum required CMake version to 3.22 3af71987a8 cmake: Bump minimum required CMake version to 3.22 92394476e9 Merge bitcoin-core/secp256k1#1673: Assert field magnitude at control-flow join 3a4f448cb4 Assert field magnitude at control-flow join 9fab425256 Merge bitcoin-core/secp256k1#1668: bench_ecmult: add benchmark for ecmult_const_xonly 05445377f4 bench_ecmult: add benchmark for ecmult_const_xonly bb597b3d39 Merge bitcoin-core/secp256k1#1670: tests: update wycheproof files d73ed99479 tests: update wycheproof files git-subtree-dir: src/secp256k1 git-subtree-split: b9313c6e1a6082a66b4c75777e18ca4b176fcf9d
1 parent 63cb13d commit abe11bd

File tree

12 files changed

+126
-259
lines changed

12 files changed

+126
-259
lines changed

.cirrus.yml

Lines changed: 0 additions & 199 deletions
This file was deleted.

src/secp256k1/CHANGELOG.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.7.0] - 2025-07-21
11+
12+
#### Added
13+
- CMake: Added `secp256k1_objs` interface library to allow parent projects to embed libsecp256k1 object files into their own static libraries.
14+
- build: Added `SECP256K1_NO_API_VISIBILITY_ATTRIBUTES` preprocessor flag (CMake option: `SECP256K1_ENABLE_API_VISIBILITY_ATTRIBUTES`) that disables explicit "visibility" attributes for API symbols. Defining this macro enables the user to control the visibility of the API symbols via `-fvisibility=<value>` when building libsecp256k1. (All non-API declarations will always have hidden visibility, even with `SECP256K1_ENABLE_API_VISIBILITY_ATTRIBUTES` defined.) For instance, `-fvisibility=hidden` can be useful even for the API symbols, e.g., when building a static libsecp256k1 which is linked into a shared library, and the latter should not re-export the libsecp256k1 API.
15+
16+
#### Changed
17+
- The pointers `secp256k1_context_static` and `secp256k1_context_no_precomp` to the constant context objects are now `const`.
18+
- Removed `SECP256K1_WARN_UNUSED_RESULT` attribute (defined as `__attribute__ ((__warn_unused_result__))`) from several API functions that always return 1. Compilers will no longer warn if the return value is unused.
19+
- CMake: Building with CMake is no longer considered experimental.
20+
- CMake: The minimum required CMake version was increased to 3.22.
21+
- CMake: Shared libraries built with CMake on FreeBSD now create the full versioned filename and symlink chain, matching the behavior of autotools builds.
22+
1023
#### Removed
1124
- Removed previously deprecated function aliases `secp256k1_ec_privkey_negate`, `secp256k1_ec_privkey_tweak_add` and
1225
`secp256k1_ec_privkey_tweak_mul`. Use `secp256k1_ec_seckey_negate`, `secp256k1_ec_seckey_tweak_add` and
1326
`secp256k1_ec_seckey_tweak_mul` instead.
1427

28+
#### ABI Compatibility
29+
The symbols `secp256k1_ec_privkey_negate`, `secp256k1_ec_privkey_tweak_add`, and `secp256k1_ec_privkey_tweak_mul` were removed.
30+
The pointers `secp256k1_context_static` and `secp256k1_context_no_precomp` have been made `const`.
31+
Otherwise, the library maintains backward compatibility with version 0.6.0.
32+
1533
## [0.6.0] - 2024-11-04
1634

1735
#### Added
@@ -115,7 +133,7 @@ We strongly recommend updating to 0.3.1 if you use or plan to use Clang >=14 to
115133
- Fix "constant-timeness" issue with Clang >=14 that could leave applications using libsecp256k1 vulnerable to a timing side-channel attack. The fix avoids secret-dependent control flow and secret-dependent memory accesses in conditional moves of memory objects when libsecp256k1 is compiled with Clang >=14.
116134

117135
#### Added
118-
- Added tests against [Project Wycheproof's](https://github.com/google/wycheproof/) set of ECDSA test vectors (Bitcoin "low-S" variant), a fixed set of test cases designed to trigger various edge cases.
136+
- Added tests against [Project Wycheproof's](https://github.com/C2SP/wycheproof/) set of ECDSA test vectors (Bitcoin "low-S" variant), a fixed set of test cases designed to trigger various edge cases.
119137

120138
#### Changed
121139
- Increased minimum required CMake version to 3.13. CMake builds remain experimental.
@@ -169,7 +187,8 @@ This version was in fact never released.
169187
The number was given by the build system since the introduction of autotools in Jan 2014 (ea0fe5a5bf0c04f9cc955b2966b614f5f378c6f6).
170188
Therefore, this version number does not uniquely identify a set of source files.
171189

172-
[unreleased]: https://github.com/bitcoin-core/secp256k1/compare/v0.6.0...HEAD
190+
[unreleased]: https://github.com/bitcoin-core/secp256k1/compare/v0.7.0...HEAD
191+
[0.7.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.6.0...v0.7.0
173192
[0.6.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.5.1...v0.6.0
174193
[0.5.1]: https://github.com/bitcoin-core/secp256k1/compare/v0.5.0...v0.5.1
175194
[0.5.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.1...v0.5.0

src/secp256k1/ci/ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ then
113113
case "$HOST" in
114114
*mingw*)
115115
ls -l .libs
116-
python3 ./tools/symbol-check.py .libs/libsecp256k1-5.dll
116+
python3 ./tools/symbol-check.py .libs/libsecp256k1-*.dll
117117
;;
118118
*)
119119
python3 ./tools/symbol-check.py .libs/libsecp256k1.so

src/secp256k1/ci/linux-debian.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
4040
apt-get clean && rm -rf /var/lib/apt/lists/*
4141

4242
# Build and install gcc snapshot
43-
ARG GCC_SNAPSHOT_MAJOR=15
43+
ARG GCC_SNAPSHOT_MAJOR=16
4444
RUN apt-get update && apt-get install --no-install-recommends -y wget libgmp-dev libmpfr-dev libmpc-dev flex && \
4545
mkdir gcc && cd gcc && \
4646
wget --progress=dot:giga --https-only --recursive --accept '*.tar.xz' --level 1 --no-directories "https://gcc.gnu.org/pub/gcc/snapshots/LATEST-${GCC_SNAPSHOT_MAJOR}" && \

src/secp256k1/configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ AC_PREREQ([2.60])
44
# the API. All changes in experimental modules are treated as
55
# backwards-compatible and therefore at most increase the minor version.
66
define(_PKG_VERSION_MAJOR, 0)
7-
define(_PKG_VERSION_MINOR, 6)
7+
define(_PKG_VERSION_MINOR, 7)
88
define(_PKG_VERSION_PATCH, 1)
99
define(_PKG_VERSION_IS_RELEASE, false)
1010

@@ -13,7 +13,7 @@ define(_PKG_VERSION_IS_RELEASE, false)
1313
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
1414
# All changes in experimental modules are treated as if they don't affect the
1515
# interface and therefore only increase the revision.
16-
define(_LIB_VERSION_CURRENT, 5)
16+
define(_LIB_VERSION_CURRENT, 6)
1717
define(_LIB_VERSION_REVISION, 1)
1818
define(_LIB_VERSION_AGE, 0)
1919

src/secp256k1/include/secp256k1.h

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -121,45 +121,57 @@ typedef int (*secp256k1_nonce_function)(
121121
#endif
122122

123123
/* Symbol visibility. */
124-
#if defined(_WIN32)
125-
/* GCC for Windows (e.g., MinGW) accepts the __declspec syntax
126-
* for MSVC compatibility. A __declspec declaration implies (but is not
127-
* exactly equivalent to) __attribute__ ((visibility("default"))), and so we
128-
* actually want __declspec even on GCC, see "Microsoft Windows Function
129-
* Attributes" in the GCC manual and the recommendations in
130-
* https://gcc.gnu.org/wiki/Visibility. */
131-
# if defined(SECP256K1_BUILD)
132-
# if defined(DLL_EXPORT) || defined(SECP256K1_DLL_EXPORT)
133-
/* Building libsecp256k1 as a DLL.
134-
* 1. If using Libtool, it defines DLL_EXPORT automatically.
135-
* 2. In other cases, SECP256K1_DLL_EXPORT must be defined. */
136-
# define SECP256K1_API extern __declspec (dllexport)
137-
# else
138-
/* Building libsecp256k1 as a static library on Windows.
139-
* No declspec is needed, and so we would want the non-Windows-specific
140-
* logic below take care of this case. However, this may result in setting
141-
* __attribute__ ((visibility("default"))), which is supposed to be a noop
142-
* on Windows but may trigger warnings when compiling with -flto due to a
143-
* bug in GCC, see
144-
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116478 . */
145-
# define SECP256K1_API extern
146-
# endif
147-
/* The user must define SECP256K1_STATIC when consuming libsecp256k1 as a static
148-
* library on Windows. */
149-
# elif !defined(SECP256K1_STATIC)
150-
/* Consuming libsecp256k1 as a DLL. */
151-
# define SECP256K1_API extern __declspec (dllimport)
152-
# endif
124+
#if !defined(SECP256K1_API) && defined(SECP256K1_NO_API_VISIBILITY_ATTRIBUTES)
125+
/* The user has requested that we don't specify visibility attributes in
126+
* the public API.
127+
*
128+
* Since all our non-API declarations use the static qualifier, this means
129+
* that the user can use -fvisibility=<value> to set the visibility of the
130+
* API symbols. For instance, -fvisibility=hidden can be useful *even for
131+
* the API symbols*, e.g., when building a static library which is linked
132+
* into a shared library, and the latter should not re-export the
133+
* libsecp256k1 API.
134+
*
135+
* While visibility is a concept that applies only to shared libraries,
136+
* setting visibility will still make a difference when building a static
137+
* library: the visibility settings will be stored in the static library,
138+
* solely for the potential case that the static library will be linked into
139+
* a shared library. In that case, the stored visibility settings will
140+
* resurface and be honored for the shared library. */
141+
# define SECP256K1_API extern
153142
#endif
154-
#ifndef SECP256K1_API
155-
/* All cases not captured by the Windows-specific logic. */
156-
# if defined(__GNUC__) && (__GNUC__ >= 4) && defined(SECP256K1_BUILD)
157-
/* Building libsecp256k1 using GCC or compatible. */
158-
# define SECP256K1_API extern __attribute__ ((visibility ("default")))
159-
# else
160-
/* Fall back to standard C's extern. */
161-
# define SECP256K1_API extern
162-
# endif
143+
#if !defined(SECP256K1_API)
144+
# if defined(SECP256K1_BUILD)
145+
/* On Windows, assume a shared library only if explicitly requested.
146+
* 1. If using Libtool, it defines DLL_EXPORT automatically.
147+
* 2. In other cases, SECP256K1_DLL_EXPORT must be defined. */
148+
# if defined(_WIN32) && (defined(SECP256K1_DLL_EXPORT) || defined(DLL_EXPORT))
149+
/* GCC for Windows (e.g., MinGW) accepts the __declspec syntax for
150+
* MSVC compatibility. A __declspec declaration implies (but is not
151+
* exactly equivalent to) __attribute__ ((visibility("default"))),
152+
* and so we actually want __declspec even on GCC, see "Microsoft
153+
* Windows Function Attributes" in the GCC manual and the
154+
* recommendations in https://gcc.gnu.org/wiki/Visibility . */
155+
# define SECP256K1_API extern __declspec(dllexport)
156+
/* Avoid __attribute__ ((visibility("default"))) on Windows to get rid
157+
* of warnings when compiling with -flto due to a bug in GCC, see
158+
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116478 . */
159+
# elif !defined(_WIN32) && defined (__GNUC__) && (__GNUC__ >= 4)
160+
# define SECP256K1_API extern __attribute__ ((visibility("default")))
161+
# else
162+
# define SECP256K1_API extern
163+
# endif
164+
# else
165+
/* On Windows, SECP256K1_STATIC must be defined when consuming
166+
* libsecp256k1 as a static library. Note that SECP256K1_STATIC is a
167+
* "consumer-only" macro, and it has no meaning when building
168+
* libsecp256k1. */
169+
# if defined(_WIN32) && !defined(SECP256K1_STATIC)
170+
# define SECP256K1_API extern __declspec(dllimport)
171+
# else
172+
# define SECP256K1_API extern
173+
# endif
174+
# endif
163175
#endif
164176

165177
/* Warning attributes

0 commit comments

Comments
 (0)