295 Commits

Author SHA1 Message Date
Jesse Posner
fb34b29d7f
frost trusted dealer: add example file
This commit adds an example file to demonstrate how to use the module.
2024-05-14 15:28:12 -07:00
Jesse Posner
9170dd337c
frost trusted dealer: signature generation and aggregation
This commit adds signature generation and aggregation, as well as
partial signature serialization and parsing.
2024-05-14 15:28:12 -07:00
Jesse Posner
ea059393f0
frost trusted dealer: nonce aggregation and adaptor signatures
This commit adds nonce aggregation, as well as adaptor signatures.
2024-05-14 15:28:12 -07:00
Jesse Posner
5368c81a3c
frost trusted dealer: key tweaking
This commits add BIP-341 ("Taproot") and BIP-32 ("ordinary") public key
tweaking.
2024-05-14 15:28:00 -07:00
Jesse Posner
9b852191de
frost trusted dealer: nonce generation
This commits adds nonce generation, as well as serialization and
parsing.
2024-05-14 15:26:35 -07:00
Jesse Posner
8969cee21c
frost trusted dealer: share generation
This commit adds trusted share generation, as well as share
serialization and parsing.
2024-05-14 14:32:10 -07:00
Jesse Posner
6f47d2eb22
frost trusted dealer: initialize project
This commit adds the foundational configuration and building scripts
and an initial structure for the project.
2024-05-14 14:32:05 -07:00
Benedikt
3a9b1d46a3 New Experimental Module: Incremental Half-Aggregation for Schnorr Signatures 2024-02-27 14:04:40 +01:00
Jonas Nick
de54a1eff7 musig2: clean up ctx doc in include file 2024-01-23 16:04:45 +01:00
Tim Ruffing
4f65698865 extrakeys: Remove redundant secp256k1_pubkey_cmp
It was a verbatim copy of secp256k1_ec_pubkey_cmp.
2024-01-23 16:04:45 +01:00
Tim Ruffing
c29f28e638 include: make docs more consistent
Like upstream https://github.com/bitcoin-core/secp256k1/pull/1476 .
2024-01-23 16:04:45 +01:00
Tim Ruffing
e626f00d1e Merge commits 'b314cf28 1f1bb78b 40f50d0f c891c5c2 ea47c82e e7210393 c1b49664 5814d848 07687e81 10e6d29b d3e29db8 e2c9888e 4197d667 5e9a4d7a 77af1da9 1a81df82 1ad5185c efe85c70 79e09451 d373bf6d 74b7c3b5 a9db9f2d 44378867 3bf4d68f e4af41c6 ' into temp-merge-1249 2024-01-23 16:04:45 +01:00
Sanket Kanjalkar
e2eb3fae40 Make *key_cache const in musig_pubkey_get 2024-01-07 07:44:11 -08: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
Jonas Nick
e3f690015a
include: remove obvious "cannot be NULL" doc 2024-01-04 17:15:01 +00:00
Jonas Nick
80187089ff
Merge commits '4494a369 3aef6ab8 0fa84f86 249c81ea 7966aee3 fb758fe8 3fc1de5c 0aacf643 9e6d1b0e 332af315 afd7eb4a c9ebca95 cc557575 0f7657d5 907a6721 b40e2d30 c545fdc3 2bd5f3e6 0e00fc7d c734c642 26392da2 ' into temp-merge-1386 2023-07-27 18:57:30 +00:00
Jonas Nick
b160486766
ecdsa_adaptor: add missing include 2023-07-27 16:31:40 +00:00
Jonas Nick
74d9073414
Merge commits '83186db3 e9e4526a 5f7903c7 d373a721 09df0bfb 20a5da5f 908e02d5 d75dc59b debf3e5c bf29f8d0 60556c9f cb1a5927 67214f5f 45c5ca76 30574f22 0702ecb0 705ce7ed 3c1a0fd3 10836832 926dd3e9 ac43613d fd491ea1 799f4eec ' into temp-merge-1356 2023-07-27 16:31:40 +00:00
Jonas Nick
7a07f3d33f
Merge commits '3bab71cf 4258c54f 566faa17 9ce9984f 04bf3f67 5be353d6 2e035af2 5b0444a3 a6f4bcf6 5ec1333d f6bef03c 1f33bb2b 1c895367 6b7e5b71 596b336f 4b84f4bf 024a4094 222ecaf6 4b0f711d 3c818388 f30c7486 1cf15ebd 24c768ae 341cc197 c63ec88e 54d34b6c 073d98a0 9eb6934f ab5a9171 fb3a8063 006ddc1f 3353d3c7 b54a0672 7d4f86d2 e8295d07 3e3d125b acf5c55a ' into temp-merge-1312 2023-07-24 20:15:07 +00:00
Jonas Nick
a9a5c24de2
Merge commits '56582094 427bc3cd 0cf2fb91 9c8c4f44 70be3cad f16a709f 464a9115 1d8f3675 afd8b23b 2bca0a5c 2d51a454 4e682626 a0f4644f 145078c4 7b7503da ec98fced 346a053d ' into temp-merge-1269 2023-07-24 13:46:43 +00:00
Jonas Nick
0d540ec942
Merge commits '88e80722 ff8edf89 f29a3270 a7a7bfaf a01a7d86 b1579cf5 ad7433b1 233822d8 5fbff5d3 2b77240b 1bff2005 e1817a6f 5596ec5c 8ebe5c52 1cca7c17 1b21aa51 cbd25559 09b1d466 57573187 8962fc95 9d1b458d eb8749fc 6048e6c0 ' into temp-merge-1222 2023-07-20 16:29:40 +00:00
Jonas Nick
304fc88557
Merge commits '9a8d65f0 75d7b7f5 665ba77e 3f57b9f7 eacad90f 01b819a8 31ed5386 2a39ac16 0eb30004 cbe41ac1 cc3b8a4f ' into temp-merge-1187 2023-07-20 12:19:00 +00:00
Jonas Nick
6c54db1987
Merge commits '2286f809 751c4354 477f02c4 e3f84777 5c789dcd 8c949f56 21ffe4b2 ' into temp-merge-1055 2023-07-18 12:51:17 +00:00
Jonas Nick
9a981068ce
Merge commits '8b013fce 485f608f 44c2452f cd470333 accadc94 43756da8 ' into temp-merge-1115 2023-07-17 12:01:46 +00:00
Tim Ruffing
9e6d1b0e9b
Merge bitcoin-core/secp256k1#1367: build: Improvements to symbol visibility logic on Windows (attempt 3)
c6cd2b15a007ad0a2d5c4656ae641ba442d8b2fe ci: Add task for static library on Windows + CMake (Hennadii Stepanov)
020bf69a44ba700624d09de0c18ceb867369d24e build: Add extensive docs on visibility issues (Tim Ruffing)
0196e8ade16e2b2d8efadac01d8520205553ee39 build: Introduce `SECP256k1_DLL_EXPORT` macro (Hennadii Stepanov)
9f1b1904a358e4ce7248c6542e8c7ac143ba0e3f refactor: Replace `SECP256K1_API_VAR` with `SECP256K1_API` (Hennadii Stepanov)
ae9db95ceaa2605138fac9c237c640acea3f3bd6 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 c6cd2b15a007ad0a2d5c4656ae641ba442d8b2fe

Tree-SHA512: d58694452d630aefbd047916033249891bc726b7475433aaaa7c3ea2a07ded8f185a598385b67c2ee3440ec5904ff9d9452c97b0961d84dcb2eb2cf46caa171e
2023-07-03 18:53:38 +02:00
Alejandro
b6b9834e8d small fixes
restoring wycheproof files

restoring wycheproof files2
2023-07-03 17:05:55 +02:00
Jonas Nick
fb758fe8d6
Merge bitcoin-core/secp256k1#1323: tweak_add: fix API doc for tweak=0
05873bb6b1041227f413626717b7af69fb6176ef tweak_add: fix API doc for tweak=0 (Jonas Nick)

Pull request description:

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

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
Tim Ruffing
ac43613d25
Merge bitcoin-core/secp256k1#1354: Add ellswift to CHANGELOG
7c7467ab7f935f6b982064c8c48772a433da1f8f Refer to ellswift.md in API docs (Pieter Wuille)
c32ffd8d8c833a964ee7fbb294640764ad25de5d Add ellswift to CHANGELOG (Pieter Wuille)

Pull request description:

  A follow-up with a CHANGELOG entry for #1129.

ACKs for top commit:
  real-or-random:
    ACK 7c7467ab7f935f6b982064c8c48772a433da1f8f
  theStack:
    ACK 7c7467ab7f935f6b982064c8c48772a433da1f8f

Tree-SHA512: 4f066e4b8d5e130f2b5bea0ed4c634e9426bc576342aad6c306e0805a8354e27a5e679b15ec869d4e7d36eb5d53174e46b3bf5e15d19a7e165afc82e46ddfcf5
2023-06-25 09:49:40 +02:00
Tim Ruffing
926dd3e962
Merge bitcoin-core/secp256k1#1295: abi: Use dllexport for mingw builds
bc7c8db179a56cf7273f3c4c0decd10543a10521 abi: Use dllexport for mingw builds (Cory Fields)

Pull request description:

  Addresses the first part of #1181. See the discussion there for more context and history.

  After this, all that remains is a (platform-independent) exports checker for c-i. Or perhaps a linker script or .def file could be tricked into testing as a side-effect.

  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).

  Edit:
  Note that we could further complicate this by supporting `__attribute__ ((dllexport))` as well, though I didn't bother as I'm not sure what compiler combo would accept that but not the bare dllexport syntax.

  Edit2:
  As the title implies, this affects this ABI and could affect downstream libs/apps in unintended ways (though it's hard to imagine any real downside). Though because it's win32 only, I'm imagining very little real-world impact at all.

ACKs for top commit:
  hebasto:
    re-ACK bc7c8db179a56cf7273f3c4c0decd10543a10521, only a comment has been adjusted since my recent [review](https://github.com/bitcoin-core/secp256k1/pull/1295#pullrequestreview-1414928537),
  real-or-random:
    utACK bc7c8db179a56cf7273f3c4c0decd10543a10521

Tree-SHA512: 378e15556da49494f551bdf4f7b41304db9d03a435f21fcc947c9520aa43e3c655cfe216fba57a5179a871c975c806460eef7c33b105f2726e1de0937ff2444e
2023-06-24 10:37:55 +02:00
Pieter Wuille
7c7467ab7f Refer to ellswift.md in API docs 2023-06-23 16:05:24 -04:00
Pieter Wuille
df633cdeba Add _prefix and _bip324 ellswift_xdh hash functions 2023-06-20 11:31:58 -04:00
Pieter Wuille
c47917bbd6 Add ellswift module implementing ElligatorSwift
The scheme implemented is described below, and largely follows the paper
"SwiftEC: Shallue–van de Woestijne Indifferentiable Function To Elliptic Curves",
by Chavez-Saab, Rodriguez-Henriquez, and Tibouchi
(https://eprint.iacr.org/2022/759).

A new 64-byte public key format is introduced, with the property that *every*
64-byte array is an encoding for a non-infinite curve point. Each curve point
has roughly 2^256 distinct encodings. This permits disguising public keys as
uniformly random bytes.

The new API functions:
* secp256k1_ellswift_encode: convert a normal public key to an ellswift 64-byte
  public key, using additional entropy to pick among the many possible
  encodings.
* secp256k1_ellswift_decode: convert an ellswift 64-byte public key to a normal
  public key.
* secp256k1_ellswift_create: a faster and safer equivalent to calling
  secp256k1_ec_pubkey_create + secp256k1_ellswift_encode.
* secp256k1_ellswift_xdh: x-only ECDH directly on ellswift 64-byte public keys,
  where the key encodings are fed to the hash function.

The scheme itself is documented in secp256k1_ellswift.h.
2023-06-20 11:31:58 -04:00
Sebastian Falbesoner
f3644287b1 docs: correct pubkey param descriptions for secp256k1_keypair_{xonly_,}pub
From an API perspective, the functions `secp256k1_keypair_pub` and
`secp256k1_keypair_xonly_pub` always succeed (i.e. return the value 1),
so the other cases in the `pubkey` parameter descriptions never happen
and can hence be removed.

Note that the "1 always" return value description was previously done in
commit b8f8b99f0fb3a5cd4c6fb1c9c8dfed881839e19e (PR #1089), which also
explains why invalid inputs for the affected functions are in practice
only possible in violation of the type system.
2023-06-11 18:44:16 +02: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 712e7f8722eba5dec2bc6b37d75aadeb6f6e633b.
2023-05-12 15:05:57 +00:00
Jonas Nick
4ab4ec38a0
musig: add note about missing verification to partial_sign to doc 2023-05-11 17:50:18 +00:00
Jonas Nick
f50ad76004
musig: update version number of BIP 2023-05-11 17:50:06 +00:00
Tim Ruffing
cd54ac7c1c schnorrsig: Improve docs of schnorrsig_sign_custom 2023-05-11 18:36:42 +02: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
Sebastian Falbesoner
149c41cee1 docs: complete interface description for secp256k1_schnorrsig_sign_custom
For the sake of completeness, add the missing descriptions for the
return value and parameters (`ctx`, `sig64`, `keypair`), in the same
wording/style as for the function `secp256k1_schnorrsig_sign32`.
2023-05-08 13:09:42 +02:00
Jonas Nick
ce18267b66
Merge elementsproject/secp256k1-zkp#229: musig: Fix nits left open in #211
a0b51afc01dfc8dbdc43e4c36825fadf760daa3c musig: VERIFY_CHECK preconditions of _musig_keyaggcoef_internal() (Tim Ruffing)
da7702844e212f0cc165d1560a4dc09a05811dae extrakeys: Clarify comparison order of compare/sort functions (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK a0b51afc01dfc8dbdc43e4c36825fadf760daa3c

Tree-SHA512: ad509d7a55c6f832a25b896b0fe38e259b79864b2a8d1fb337b9d9b4a5e1950a9d579040285465c89d815becc6e49af4129ab2d904d32ac98cef74357a440c89
2023-04-23 08:06:33 +00:00
Tim Ruffing
da7702844e extrakeys: Clarify comparison order of compare/sort functions
Note that the touched functions don't exist upstream currently.
2023-04-21 16:17:52 +02:00
Tim Ruffing
e444d24bca Fix include guards: No _ prefix/suffix but _H suffix (as in upstream) 2023-04-21 12:02:28 +02:00
Tim Ruffing
a6f4bcf6e1
Merge bitcoin-core/secp256k1#1231: Move SECP256K1_INLINE macro definition out from include/secp256k1.h
8e142ca4102ade1b90dcb06d6c78405ef3220599 Move `SECP256K1_INLINE` macro definition out from `include/secp256k1.h` (Hennadii Stepanov)
77445898a5852ecd38ab95cfb329333a82673115 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 8e142ca4102ade1b90dcb06d6c78405ef3220599
  real-or-random:
    utACK 8e142ca410

Tree-SHA512: 180e0ba7c2ef242b765f20698b67d06c492b7b70866c21db27c18d8b2e85c3e11f86c6cb99ffa88bbd23891ce3ee8a24bc528f2c91167ec2fddc167463f78eac
2023-04-20 18:18:11 +02:00