Commit Graph

147 Commits

Author SHA1 Message Date
Tim Ruffing
4d90585fea docs: Improve API docs of _context_set_illegal_callback 2025-09-22 12:59:36 +02:00
Tim Ruffing
895f53d1cf docs: Clarify that callback can be called more than once 2025-09-22 12:58:48 +02:00
Tim Ruffing
ce7923874f build: Add SECP256K1_NO_API_VISIBILITY_ATTRIBUTES 2025-07-18 13:54:48 +02:00
Tim Ruffing
e5297f6d79 build: Refactor visibility logic 2025-07-18 08:54:03 +02:00
Jonas Nick
1b6e081538 include: remove WARN_UNUSED_RESULT for functions always returning 1
This makes the usage of the atribute consistent. In the musig and ellswift
module, functions that return 1 always already don't have the WARN_UNUSED_RESULT
attribute. In secp256k1.h and the extrakeys module, this has only been the case
partially.

In all cases where this was removed, the function only returns 0 if the illegal
callback has been called.
2025-03-13 09:36:03 +00:00
Jonas Nick
13ed6f65dc Merge bitcoin-core/secp256k1#1593: Remove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases from API
37d2c60bec Remove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases (Sebastian Falbesoner)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK 37d2c60bec
  sipa:
    utACK 37d2c60bec
  jonasnick:
    ACK 37d2c60bec

Tree-SHA512: 5d3c836c3c4d5cde143fe5b5235f9fc108174439b056f3418834f33d12ea28bdf09d11a81917d679b4b9a93da26304241c8fe389549e72796bbda116e9ff4945
2025-03-12 20:01:59 +00:00
Sebastian Falbesoner
37d2c60bec Remove deprecated _ec_privkey_{negate,tweak_add,tweak_mul} aliases
These function aliases have been described as DEPRECATED in the public
API docs already many years ago (see #701, commit 41fc7856), and in
addition explicit deprecation warnings are shown by the compiler at
least since the first official release 0.2.0 (see PR #1089, commit
fc94a2da), so it should be fine to just remove them by now.

Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2025-02-25 04:17:45 +01:00
Daniel Pfeifer
432ac57705 Make static context const 2025-02-24 17:25:27 +01:00
Ava Chow
694342fdb7 Name public API structs 2024-10-31 13:55:52 -04:00
merge-script
f0868a9b3d Merge bitcoin-core/secp256k1#1595: build: 45839th attempt to fix symbol visibility on Windows
447334cb06 include: Avoid visibility("default") on Windows (Tim Ruffing)

Pull request description:

  Fixes #1421. See code comments for rationale.

  Related meta-bug: #1181.  This reminds me that we should move forward with #1359.

ACKs for top commit:
  fanquake:
    ACK 447334cb06
  hebasto:
    ACK 447334cb06, tested on Ubuntu 24.04 using the following commands:
  theuni:
    ACK 447334cb06

Tree-SHA512: aaa47d88fd1b1f85c3e879a2b288c0eb3beebad0cc89e85f05d0b631f83e58d5a324fb441911970865eaa292f6820d03a1b516d6e8de37a87510e2082acc6e28
2024-10-21 18:02:53 +02:00
Jonas Nick
8be3839fb2 Remove unused scratch space from API 2024-10-21 09:18:44 +00:00
Jonas Nick
70b6be1834 extrakeys: improve doc of keypair_create (don't suggest retry) 2024-10-14 13:24:30 +00:00
Jonas Nick
01b5893389 Merge bitcoin-core/secp256k1#1599: #1570 improve examples: remove key generation loop
cd4f84f3ba Improve examples/documentation: remove key generation loops (cheapshot003)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK cd4f84f3ba
  jonasnick:
    ACK cd4f84f3ba

Tree-SHA512: 242ab99c36302b539fc95421142c3eec5ccfa2cf918989457886338febde45a33b1794e0f08e7a632747bc21cbf5c47b7361fd9a28b9a1c6dff7caecf7b31a9f
2024-10-13 07:25:09 +00:00
cheapshot003
cd4f84f3ba Improve examples/documentation: remove key generation loops
Co-Authored by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
2024-10-09 16:24:38 +03:00
Tim Ruffing
447334cb06 include: Avoid visibility("default") on Windows
Fixes #1421.
2024-09-17 16:21:39 +02:00
Sebastian Falbesoner
292310fbb2 doc: fix typos in secp256k1_ecdsa_{recoverable_,}signature API description 2024-09-09 12:07:21 +02:00
Jonas Nick
7d2591ce12 Add secp256k1_pubkey_sort
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
Co-authored-by: Russell O'Connor <roconnor@blockstream.io>
2024-04-25 20:23:31 +00:00
Jonas Nick
da7bc1b803 include: in doc, remove article in front of "pointer" 2024-01-05 13:06:50 +00:00
Jonas Nick
aa3dd5280b include: make doc about ctx more consistent
Replaces "ctx: a secp256k1 context object" with "ctx: pointer to a context
object". Also removes the word "existing".
2024-01-04 17:15:03 +00:00
Tim Ruffing
9e6d1b0e9b Merge bitcoin-core/secp256k1#1367: build: Improvements to symbol visibility logic on Windows (attempt 3)
c6cd2b15a0 ci: Add task for static library on Windows + CMake (Hennadii Stepanov)
020bf69a44 build: Add extensive docs on visibility issues (Tim Ruffing)
0196e8ade1 build: Introduce `SECP256k1_DLL_EXPORT` macro (Hennadii Stepanov)
9f1b1904a3 refactor: Replace `SECP256K1_API_VAR` with `SECP256K1_API` (Hennadii Stepanov)
ae9db95cea build: Introduce `SECP256K1_STATIC` macro for Windows users (Hennadii Stepanov)

Pull request description:

  Previous attempts:
  - https://github.com/bitcoin-core/secp256k1/pull/1346
  - https://github.com/bitcoin-core/secp256k1/pull/1362

  The result is as follows:
  1. Simple, concise and extensively documented code.
  2. Explicitly documented use cases with no ambiguities.
  3. No workarounds for linker warnings.
  4. Solves one item in https://github.com/bitcoin-core/secp256k1/issues/1235.

ACKs for top commit:
  real-or-random:
    utACK c6cd2b15a0

Tree-SHA512: d58694452d630aefbd047916033249891bc726b7475433aaaa7c3ea2a07ded8f185a598385b67c2ee3440ec5904ff9d9452c97b0961d84dcb2eb2cf46caa171e
2023-07-03 18:53:38 +02:00
Jonas Nick
fb758fe8d6 Merge bitcoin-core/secp256k1#1323: tweak_add: fix API doc for tweak=0
05873bb6b1 tweak_add: fix API doc for tweak=0 (Jonas Nick)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK 05873bb6b1

Tree-SHA512: ef587a680c3355c6328dd61e0f5fcac80ea995f6045b4392fe35f3ee1c04ee1bd941662c120758ad641588670c1f0f53bfb17a802821f54100f1385b8bb7375a
2023-07-03 13:11:20 +00:00
Tim Ruffing
020bf69a44 build: Add extensive docs on visibility issues 2023-07-03 13:57:17 +01:00
Hennadii Stepanov
0196e8ade1 build: Introduce SECP256k1_DLL_EXPORT macro
This change provides a way to build a shared library that is not tired
to the Libtool-specific `DLL_EXPORT` macro.
2023-07-03 13:57:17 +01:00
Hennadii Stepanov
9f1b1904a3 refactor: Replace SECP256K1_API_VAR with SECP256K1_API 2023-07-03 13:57:16 +01:00
Hennadii Stepanov
ae9db95cea build: Introduce SECP256K1_STATIC macro for Windows users
It is a non-Libtool-specific way to explicitly specify the user's
intention to consume a static `libseck256k1`.

This change allows to get rid of MSVC linker warnings LNK4217 and
LNK4286. Also, it makes possible to merge the `SECP256K1_API` and
`SECP256K1_API_VAR` into one.
2023-07-03 13:57:11 +01:00
Jonas Nick
05873bb6b1 tweak_add: fix API doc for tweak=0 2023-05-24 13:48:42 +00:00
Jonas Nick
3ad1027a40 Revert "Remove unused scratch space from API"
This reverts commit 712e7f8722.
2023-05-12 15:05:57 +00:00
Jonas Nick
712e7f8722 Remove unused scratch space from API 2023-05-11 13:39:56 +00:00
Cory Fields
bc7c8db179 abi: Use dllexport for mingw builds
This should fix mingw exports, specifically hiding the following:
secp256k1_pre_g_128
secp256k1_pre_g
secp256k1_ecmult_gen_prec_table

This changes our visibility macros to look more like gcc's recommendation:
https://gcc.gnu.org/wiki/Visibility#How_to_use_the_new_C.2B-.2B-_visibility_support
2023-05-08 15:25:26 +00:00
Tim Ruffing
a6f4bcf6e1 Merge bitcoin-core/secp256k1#1231: Move SECP256K1_INLINE macro definition out from include/secp256k1.h
8e142ca410 Move `SECP256K1_INLINE` macro definition out from `include/secp256k1.h` (Hennadii Stepanov)
77445898a5 Remove `SECP256K1_INLINE` usage from examples (Hennadii Stepanov)

Pull request description:

  From [IRC](https://gnusha.org/secp256k1/2023-01-31.log):
  > 06:29 \< hebasto\> What are reasons to define the `SECP256K1_INLINE` macro in user's `include/secp256k1.h` header, while it is used internally only?
  > 06:32 \< hebasto\> I mean, any other (or a new dedicated) header in `src` looks more appropriate, no?
  > 06:35 \< sipa\> I think it may just predate any "utility" internal headers.
  > 06:42 \< sipa\> I think it makes sense to move it to util.h

  Pros:
  - it is a step in direction to better organized headers (in context of #924, #1039)

  Cons:
  - code duplication for `SECP256K1_GNUC_PREREQ` macro

ACKs for top commit:
  sipa:
    utACK 8e142ca410
  real-or-random:
    utACK 8e142ca410

Tree-SHA512: 180e0ba7c2ef242b765f20698b67d06c492b7b70866c21db27c18d8b2e85c3e11f86c6cb99ffa88bbd23891ce3ee8a24bc528f2c91167ec2fddc167463f78eac
2023-04-20 18:18:11 +02:00
Jonas Nick
3d1f430f9f Make position of * in pointer declarations in include/ consistent 2023-03-28 19:39:02 +00:00
Hennadii Stepanov
8e142ca410 Move SECP256K1_INLINE macro definition out from include/secp256k1.h 2023-03-09 15:29:56 +00:00
Tim Ruffing
914276e4d2 build: Add SECP256K1_API_VAR to fix importing variables from DLLs
This fixes a build issue with MSVC. While MSVC imports *functions*
from DLLs automatically when building a consumer of the DLL, it does
not import *variables* automatically. In these cases, we need an
explicit __declspec(dllimport).

This commit simply changes our logic to what the libtool manual
suggests, which has a very comprehensive writeup on the topic. Note
that in particular, this solution is carefully designed not to break
static linking. However, as described in the libtool manual,
statically linking the library with MSVC will output warning LNK4217.
This is still the best solution overall, because the warning is
merely a cosmetic issue.
2023-02-06 21:44:56 +01:00
Tim Ruffing
61841fc9ee contexts: Forbid randomizing secp256k1_context_static 2023-01-18 16:47:31 +01:00
Tim Ruffing
4b6df5e33e contexts: Forbid cloning/destroying secp256k1_context_static 2023-01-18 16:39:31 +01:00
Tim Ruffing
a49e0940ad docs: Fix typo 2022-12-08 16:31:00 +01:00
Tim Ruffing
7289b51d31 docs: Use doxygen style if and only if comment is user-facing
and improve phrasing slightly.
2022-12-05 11:26:44 +01:00
Tim Ruffing
e7d0185c90 docs: Get rid of "initialized for signing" terminology 2022-12-05 11:26:44 +01:00
Tim Ruffing
06126364ad docs: Tidy and improve docs about contexts and randomization 2022-12-05 11:26:44 +01:00
Tim Ruffing
e02d6862bd selftest: Expose in public API 2022-12-05 11:26:44 +01:00
Tim Ruffing
53796d2b24 contexts: Rename static context 2022-12-05 11:26:44 +01:00
Tim Ruffing
72fedf8a6c docs: Improve docs for static context 2022-12-05 11:26:39 +01:00
Tim Ruffing
316ac7625a contexts: Deprecate all context flags except SECP256K1_CONTEXT_NONE 2022-12-05 11:26:02 +01:00
Tim Ruffing
1a553ee8be docs: Change signature "validation" to "verification" 2022-11-25 23:26:15 +01:00
Tim Ruffing
ee7341fbac docs: Never require a verification context 2022-11-25 23:26:15 +01:00
Cory Fields
6f6cab9989 abi: Don't export symbols in static Windows libraries
libtool takes care of building both object versions, we just need to pick the
right one to export symbols.
2022-05-04 20:12:21 +00:00
Tim Ruffing
b8f8b99f0f docs: Fix return value for functions that don't have invalid inputs
_tagged_sha256 simply cannot have invalid inputs.

The other functions could in some sense have invalid inputs but only in
violation of the type system. For example, a pubkey could be invalid but
invalid objects of type secp256k1_pubkey either can't be obtained
via the API or will be caught by an ARG_CHECK when calling pubkey_load.

This is consistent with similar functions in the public API, e.g.,
_ec_pubkey_negate or _ec_pubkey_serialize.
2022-03-18 11:33:23 +01:00
Tim Ruffing
fc94a2da44 Use SECP256K1_DEPRECATED for existing deprecated API functions 2022-03-17 22:41:36 +01:00
Tim Ruffing
3db0560606 Add SECP256K1_DEPRECATED attribute for marking API parts as deprecated 2022-03-17 22:41:36 +01:00
fanquake
812ff5c747 doc: remove use of 0xa0 "no break space" 2021-11-24 08:11:49 +08:00