Commit Graph

74 Commits

Author SHA1 Message Date
mllwchrry
b1f9e6e360 Merge branch 'master' into sync-ebf59432 2026-07-02 18:43:56 +03:00
Jonas Nick
21645c03a2 SECURITY.md: remove Jonas Nick from trusted keys 2026-06-29 07:06:10 +00:00
mllwchrry
4681be065b docs: Fix README module descriptions 2026-03-12 15:07:42 +02:00
DarkWindman
38284aa008 Merge commits '2c076d90 20e3b447 74b8068c e523e4f9 d5997141 d2dcf520 f36afb8b 8113671f d93380fb 03fb60ad 4985ac0f 36e76952 ' into temp-merge-1738 2026-02-25 10:44:34 +02:00
DarkWindman
cc4a92b510 Merge commits '70f149b9 13906b71 4187a466 bb597b3d 9fab4252 92394476 201b2b8f f24b838b 95db29b1 2a9d3747 a28c2ffa 746e36b1 ' into temp-merge-1678 2026-02-23 18:07:05 +02:00
DarkWindman
913be29ea2 Merge commits 'b161bffb 0cdc758a ec329c25 8deef00b f79f46c7 00774d07 2e3bf136 c0d9480f ' into temp-merge-1654 2026-02-18 15:57:18 +02:00
mllwchrry
8c7c24eb8a docs: simplify README description, fix musig docs 2026-02-16 13:01:42 +02:00
mllwchrry
21c24fdc7a musig: Remove module in preparation for upstream merge 2026-02-13 11:36:52 +02:00
DarkWindman
d0dde4aa2a Merge commits '35c0fdc 5dd637f 69b2192 d7ae25c d403eea f473c95 4af241b a526937 fcc5d73 ca06e58 ea2d5f0 0055b86 ' into temp-merge-1551 2026-02-10 13:06:38 +02:00
merge-script
03fb60ad2e Merge bitcoin-core/secp256k1#1681: doc: Recommend clang-cl when building on Windows
737912430d ci: Add more tests for clang-cl (Hennadii Stepanov)
7379a5bed3 doc: Recommend clang-cl when building on Windows (Hennadii Stepanov)

Pull request description:

  There are several reasons to prefer clang-cl over MSVC, such as improved [security](https://github.com/bitcoin-core/secp256k1/issues/1164) and performance.

  Below are the benchmark results for the master branch @ 201b2b8f06:
  - using [MSVC](https://github.com/bitcoin-core/secp256k1/actions/runs/15439981265/job/43455271726):
  ```
  Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)

  ecdsa_verify                  ,    66.0       ,    71.0       ,   113.0
  ecdsa_sign                    ,    37.0       ,    37.1       ,    37.5
  ec_keygen                     ,    28.5       ,    28.9       ,    29.0
  ecdh                          ,    66.0       ,    66.2       ,    67.0
  ecdsa_recover                 ,    67.0       ,    74.9       ,   123.0
  schnorrsig_sign               ,    30.0       ,    30.3       ,    30.5
  schnorrsig_verify             ,    66.5       ,    70.6       ,   104.0
  ellswift_encode               ,    17.5       ,    17.9       ,    18.0
  ellswift_decode               ,    14.5       ,    15.3       ,    19.0
  ellswift_keygen               ,    55.0       ,    56.4       ,    63.5
  ellswift_ecdh                 ,    72.5       ,    73.5       ,    79.5
  ```

  - using [clang-cl](https://github.com/bitcoin-core/secp256k1/actions/runs/15439981265/job/43455271749):
  ```
  Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)

  ecdsa_verify                  ,    41.0       ,    47.5       ,   100.0
  ecdsa_sign                    ,    27.0       ,    27.2       ,    27.5
  ec_keygen                     ,    19.0       ,    19.3       ,    19.5
  ecdh                          ,    42.0       ,    42.4       ,    43.0
  ecdsa_recover                 ,    41.5       ,    45.7       ,    80.0
  schnorrsig_sign               ,    20.0       ,    20.5       ,    20.5
  schnorrsig_verify             ,    41.5       ,    45.5       ,    77.5
  ellswift_encode               ,    13.0       ,    13.0       ,    13.0
  ellswift_decode               ,    10.0       ,    10.4       ,    10.5
  ellswift_keygen               ,    38.5       ,    39.1       ,    41.5
  ellswift_ecdh                 ,    47.0       ,    48.5       ,    59.0
  ```

  On my local machine, the "Release" build configuration:
  - using MSVC:
  ```
  > .\build-msvc\bin\Release\bench.exe
  Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)

  ecdsa_verify                  ,    81.2       ,    90.6       ,   102.0
  ecdsa_sign                    ,    46.5       ,    48.6       ,    52.9
  ec_keygen                     ,    31.6       ,    34.8       ,    36.2
  ecdh                          ,    73.0       ,    76.4       ,    79.5
  schnorrsig_sign               ,    32.1       ,    34.4       ,    35.8
  schnorrsig_verify             ,    74.6       ,    76.2       ,    79.8
  ellswift_encode               ,    33.4       ,    34.0       ,    34.8
  ellswift_decode               ,    14.9       ,    15.5       ,    17.1
  ellswift_keygen               ,    64.5       ,    65.6       ,    67.1
  ellswift_ecdh                 ,    78.3       ,    80.7       ,    90.1
  ```

  - using clang-cl:
  ```
  > .\build-clangcl\bin\Release\bench.exe
  Benchmark                     ,    Min(us)    ,    Avg(us)    ,    Max(us)

  ecdsa_verify                  ,    40.3       ,    40.6       ,    40.9
  ecdsa_sign                    ,    30.6       ,    30.9       ,    31.3
  ec_keygen                     ,    21.2       ,    21.3       ,    21.5
  ecdh                          ,    41.5       ,    42.4       ,    44.8
  schnorrsig_sign               ,    22.5       ,    22.7       ,    22.8
  schnorrsig_verify             ,    41.2       ,    41.4       ,    41.7
  ellswift_encode               ,    20.3       ,    20.6       ,    20.8
  ellswift_decode               ,     8.50      ,     8.64      ,     8.76
  ellswift_keygen               ,    41.7       ,    42.0       ,    42.4
  ellswift_ecdh                 ,    45.1       ,    45.5       ,    46.3
  ```

ACKs for top commit:
  real-or-random:
    utACK 737912430d

Tree-SHA512: b0a4219cf24208e875a9757a490376af021dd3771911a670d80bb4979713bf1bbdbe206b8e121a3c4d1913c58f4b4593047410aa8104eff19aa3d3f359fd94af
2025-09-02 22:55:03 +02:00
Hennadii Stepanov
7379a5bed3 doc: Recommend clang-cl when building on Windows 2025-08-24 11:11:07 +01:00
Sebastian Falbesoner
819210974b README: add link to musig example, generalize module enabling hint
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2025-06-16 16:53:47 +02:00
Hennadii Stepanov
3f31ac43e0 doc: Promote "Building with CMake" to standard procedure
The CMake-based build system has demonstrated its maturity through its
use in Bitcoin Core 29.0.
2025-06-04 19:13:49 +01:00
James O'Beirne
b682dbcf84 README: add instructions for verifying GPG signatures 2025-02-06 08:20:03 -05:00
Fabian Jahr
2ac9f558c4 doc: Improve cmake instructions in README 2024-12-06 19:45:22 +01:00
Jonas Nick
f411841a46 Add module "musig" that implements MuSig2 multi-signatures (BIP 327) 2024-10-07 14:03:42 +00:00
Jonas Nick
0055b86780 Merge bitcoin-core/secp256k1#1551: Add ellswift usage example
31f84595c4 Add ellswift usage example (Sebastian Falbesoner)
fe4fbaa7f3 examples: fix case typos in secret clearing paragraphs (s/, Or/, or/) (Sebastian Falbesoner)

Pull request description:

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

Tree-SHA512: 5fe894b599c78db585a6d5238c17a894d020106561a625027efc4d67c870a288aad0814e77e7c3cb03e96b7cf940db95a6933d5a5e34a93aa644b3dcbfd8e938
2024-07-10 18:23:58 +00:00
Hennadii Stepanov
9420eece24 cmake: Bump CMake minimum required version up to 3.16 2024-07-03 08:23:20 +01:00
Sebastian Falbesoner
31f84595c4 Add ellswift usage example
This should hopefully be useful as orientation for users implementing
the key exchange part of BIP324. Conceptually the example is not very
different to the ECDH one, so a lot of code/comments are just copied
(e.g. context creation, secret key generation, shared secret comparison,
console output, cleanup with secret key clearing).
2024-06-25 17:11:20 +02:00
Sebastian Falbesoner
7454a53736 README: mention ellswift module
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2024-06-24 12:49:01 +02:00
Tim Ruffing
4228fd1124 cmake: Add support for -zkp modules
Co-authored-by: lightyear15 <g.minist8@gmail.com>
2024-01-25 15:58:52 +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
Tim Ruffing
3777e3f36a cmake: Recommend native CMake commands in README
Resolves one item in #1235. Closes #1294.
2024-01-17 15:19:53 +01:00
Tim Ruffing
4197d667ec Merge bitcoin-core/secp256k1#1431: Add CONTRIBUTING.md
0e5ea62207 CONTRIBUTING: add some coding and style conventions (Jonas Nick)
1a432cb982 README: update first sentence (Jonas Nick)
0922a047fb docs: move coverage report instructions to CONTRIBUTING (Jonas Nick)
76880e4015 Add CONTRIBUTING.md including scope and guidelines for new code (Jonas Nick)

Pull request description:

  Following offline discussions, this PR documents the scope of the library and the requirements for adding new modules. I think this fixes most of #997. It also updates the README very slightly.

  In addition, I added some coding conventions that I remembered explaining to new contributors in the past year. Even though it's far from exhaustive, I think this is an easy improvement to the CONTRIBUTING.md. Feel free to suggest more conventions.

ACKs for top commit:
  sipa:
    ACK 0e5ea62207
  real-or-random:
    ACK 0e5ea62207

Tree-SHA512: ffdbab22982fd632de92e81bd135f141ac86e24cc0dcfc0e1ae12b0d2a2e4f91377ab2c0cc440cb919889eaed8bfc1447b880fa1430fd771b956f2af0fe3766e
2023-12-07 09:16:50 +01:00
Jonas Nick
1a432cb982 README: update first sentence
libsecp256k1 has become more than a library for just ECDSA and key tweaking.
2023-12-05 20:48:12 +00:00
Jonas Nick
0922a047fb docs: move coverage report instructions to CONTRIBUTING 2023-12-04 20:08:33 +00:00
Jonas Nick
76880e4015 Add CONTRIBUTING.md including scope and guidelines for new code 2023-12-04 20:08:25 +00:00
Tim Ruffing
2f0762fa8f field: Remove x86_64 asm
Widely available versions of GCC and Clang beat our field asm on -O2.
In particular, GCC 10.5.0, which is Bitcoin Core's current compiler
for official x86_64 builds, produces code that is > 20% faster for
fe_mul and > 10% faster for signature verification (see #726).

These are the alternatives to this PR:

We could replace our current asm with the fastest compiler output
that we can find. This is potentially faster, but it has multiple
drawbacks:
 - It's more coding work because it needs detailed benchmarks (e.g.,
   with many compiler/options).
 - It's more review work because we need to deal with inline asm
   (including clobbers etc.) and there's a lack of experts reviewers
   in this area.
 - It's not unlikely that we'll fall behind again in a few compiler
   versions, and then we have to deal with this again, i.e., redo the
   benchmarks. Given our history here, I doubt that we'll revolve
   this timely.

We could change the default of the asm build option to off. But this
will also disable the scalar asm, which is still faster.

We could split the build option into two separate options for field
and scalar asm and only disable the field asm by default. But this
adds complexity to the build and to the test matrix.

My conclusion is that this PR gets the low-hanging fruit in terms of
performance. It simplifies our code significantly. It's clearly an
improvement, and it's very easy to review. Whether re-introducing
better asm (whether from a compiler or from CryptOpt) is worth the
hassle can be evaluated separately, and should not hold up this
improvement.

Solves #726.
2023-11-24 08:11:08 +01:00
Jonas Nick
5dab0baa80 README: remove CI badge
We're not solely using cirrus anymore and github already displays the CI status
at a different location.
2023-10-22 11:50:09 +00:00
Jonas Nick
64717a7b16 Merge commits '8b013fce 485f608f 44c2452f cd470333 accadc94 43756da8 af65d30c 63a3565e 6a873cc4 3efeb9da 9f8a13dc 694ce8fb a43e982b e13fae48 c2ee9175 ' into temp-merge-1146 2023-07-17 13:02:36 +00:00
Tim Ruffing
4d9d8f92d4 Simple dedicated -zkp README 2023-04-21 12:38:34 +02:00
Tim Ruffing
756b61d451 readme: Use correct build type in CMake/Windows build instructions 2023-03-08 19:21:13 +01:00
Hennadii Stepanov
5468d70964 build: Add CMake-based build system
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2023-03-08 13:33:16 +00:00
Tim Ruffing
88b00897e7 readme: Fix line break 2022-08-02 10:41:15 +02:00
Tim Ruffing
78f5296da4 readme: Sell "no runtime dependencies" 2022-08-02 10:41:15 +02:00
Tim Ruffing
ef48f088ad readme: Add IRC channel 2022-08-02 10:41:15 +02:00
Jonas Nick
8298c0c79b Merge commits 'c8aa516b 0a40a486 d8a24632 85b00a1c 59547943 5dcc6f8d 07752831 3ef94aa5 1253a277 64b34979 ac83be33 0e5cbd01 e0508ee9 587239db 1ac7e31c d0ad5814 912b7ccc 8746600e ' into temp-merge-1093
Revert: util: Remove endianness detection
2022-03-30 15:00:03 +00:00
Elliott Jin
d9d94a9969 doc: mention optional modules in README 2022-03-25 08:14:18 -07:00
Jonas Nick
7f09d0f311 README: mention that ARM assembly is experimental 2022-03-18 13:22:21 +00:00
Jonas Nick
80cf4eea5f build: stop treating schnorrsig, extrakeys modules as experimental 2022-03-17 14:14:08 +00:00
Elichai Turkel
42e03432e6 Add usage examples to the readme 2022-02-23 16:14:59 +02:00
Jonas Nick
72c8deac03 Merge commits with sync-upstream.sh
da0092bc 10f9bd84 297ce820 f34b5cae 920a0e5f 9526874d aa1b889b 20d791ed 3e7b2ea1 21c188b3 8fa41201 515a5dbd c74a7b7e 74c34e72 7006f1b9 ea5e8a9c 793ad901 2e5e4b67 fecf436d 49f608de 49002274 6ad908aa 4f01840b 61ae37c6 486205aa 5d0dbef0 0559fc6e be6944ad a69df3ad b39d431a 0b83b203 09971a3f 9281c9f4 423b6d19 a310e79e 39a36db9 a1102b12

Deal with
  - secp256k1_test_rng removal in commit
    77a19750b4
  - ecmult_gen context simplification after making table static in commit
    3b0c2185ea
2022-01-02 16:11:15 +00:00
Tim Ruffing
4c94c55bce doc: Remove obsolete hint for valgrind stack size
Also don't mention exhaustive_tests without explanation. They're
included in our test suite (`make check`) anyway.
2021-12-03 11:23:33 +01:00
siv2r
b4b130678d create csv file from the benchmark output 2021-10-19 21:30:23 +05:30
Andrew Poelstra
2979e4d9d4 Merge commits '8ae56e33 75ce488c 4866178d 446d28d9 253f90cd ec3aaa50 0440945f 7688a4f1 be8d9c26 ' into temp-merge-965 2021-07-27 18:12:45 +00:00
Jonas Nick
edcacc2b2e Merge commits '26de4dfe 6e898534 c083cc6e 1e5d50fa cc2c09e3 efad3506 7012a188 34388af6 98e0358d d0bd2693 185a6af2 6c52ae87 69394879 1e78c18d 202a030f bf0ac460 399722a6 3dc8c072 50f33677 7973576f 1758a92f ' into temp-merge-950 2021-06-14 18:16:46 +00:00
Jonas Nick
99e8614812 README: mention schnorrsig module 2021-05-28 11:40:52 +00:00
Tim Ruffing
09b3bb8648 Clean up git tree
This removes the ununsed `obj` directory. It also suggests in the README
to create the "coverage" files in a separate directory and adds the
coverage files to .gitignore.

readme: Improve instructions for coverage reports
2021-05-14 11:37:44 +02:00
Jesse Posner
654cd633f5 ecdsa_adaptor: initialize project
This commit adds the foundational configuration and building scripts
and an initial structure for the project.
2021-03-16 16:13:31 -07:00
Pieter Wuille
1e0e885c8a Make field/scalar code use the new modinv modules for inverses 2021-03-12 10:06:14 -08:00