1910 Commits

Author SHA1 Message Date
Hennadii Stepanov
19516ed3e9
cmake: Use add_compile_options() in try_add_compile_option()
This change drops tinkering with the `COMPILE_OPTIONS` directory
property. Also `try_add_compile_option()` can handle a list of flags
now, if they are required to be checked simultaneously.

An explanatory comments have been added as well.
2023-04-27 14:39:10 +01:00
Tim Ruffing
4b84f4bf0f
Merge bitcoin-core/secp256k1#1239: cmake: Bugfix and other improvements after bumping CMake up to 3.13
a273d74b2ea1ef115a7e40fe89a64a6c744018c6 cmake: Improve version comparison (Hennadii Stepanov)
6a58b483efb96de32134611963c16f6bf7e94d51 cmake: Use `if(... IN_LIST ...)` command (Hennadii Stepanov)
2445808c0203215e7182355762944ab909d423d2 cmake: Use dedicated `GENERATOR_IS_MULTI_CONFIG` property (Hennadii Stepanov)
9f8703ef17db0144b320714cd56c1fe0317a5786 cmake: Use dedicated `CMAKE_HOST_APPLE` variable (Hennadii Stepanov)
8c2017035a9c0722aeb7f24162d57d795443fd4c cmake: Use recommended `add_compile_definitions` command (Hennadii Stepanov)
04d4cc071a7aa92ad5edcf970a6cc2a8f415d36c cmake: Add `DESCRIPTION` and `HOMEPAGE_URL` options to `project` command (Hennadii Stepanov)
8a8b6536ef52fbbd9690f859d2f02d7f4b3789f6 cmake: Use `SameMinorVersion` compatibility mode (Hennadii Stepanov)

Pull request description:

  This PR:
  - resolves two items from #1235, including a bugfix with package version compatibility
  - includes other improvements which have become available for CMake 3.13+.

  To test the `GENERATOR_IS_MULTI_CONFIG` property on Linux, one can use the "[Ninja Multi-Config](https://cmake.org/cmake/help/latest/generator/Ninja%20Multi-Config.html)" generator:
  ```sh
  cmake -S . -B build -G "Ninja Multi-Config"
  ```

ACKs for top commit:
  real-or-random:
    ACK a273d74b2ea1ef115a7e40fe89a64a6c744018c6
  theuni:
    ACK a273d74b2ea1ef115a7e40fe89a64a6c744018c6

Tree-SHA512: f31c4f0f30bf368303e70ab8952cde5cc8c70a5e79a04f879abcbee3d0a8d8c598379fb38f5142cb1f8ff5f9dcfc8b8eb4c13c975a1d05fdcc92d9c805a59d9a
2023-04-27 11:23:55 +01:00
Tim Ruffing
596b336ff6
Merge bitcoin-core/secp256k1#1234: cmake: Add dev-mode
ce5ba9e24dfcceb49ed7f83a87548fd8b3b0cab2 gitignore: Add CMakeUserPresets.json (Tim Ruffing)
0a446a312fdd6260320eeed51697ecadf61ee11f cmake: Add dev-mode CMake preset (Tim Ruffing)

Pull request description:

  To use, invoke `cmake` with argument `--preset dev-mode`.

  One disadvantage over `./configure --enable-dev-mode` is that CMake does not provide a way to "hide" presets from users. That is, `cmake --list-presets` will list dev-mode, and it will also appear in `cmake-gui`, even though it's not selectable there due to a bug in cmake-gui.

  Solves one item in #1224.

ACKs for top commit:
  hebasto:
    ACK ce5ba9e24dfcceb49ed7f83a87548fd8b3b0cab2
  theuni:
    ACK ce5ba9e24dfcceb49ed7f83a87548fd8b3b0cab2

Tree-SHA512: c14bd283bd5bf64006bf3a23d72e6e55777b084aff71eb2a002f8ddde1d3549ccb2f08feb2b83366a24272209ab579cac8b73cfc020919adf7f039beb65bc9cc
2023-04-27 11:05:25 +01:00
Tim Ruffing
6b7e5b717d
Merge bitcoin-core/secp256k1#1275: build: Fix C4005 "macro redefinition" MSVC warnings in examples
dc0657c7622f5a13afc3876eca7e2fc7cabb9a10 build: Fix C4005 "macro redefinition" MSVC warnings in examples (Hennadii Stepanov)

Pull request description:

  This PR:
  - fixes C4005 "macro redefinition" MSVC warnings in examples
  - removes warning suppressions in both build systems, Autotools-based and CMake-based ones

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

Tree-SHA512: fe3bb8f06b3ff1d51e5e20754a289e0e6b99ddf4c0bd4e6e4786e2558e71e043ab23ff7782a83a902df5db28d18ae65312674c373fdc49f5af252763a22bd0fb
2023-04-26 16:44:51 +01:00
Tim Ruffing
1c89536718
Merge bitcoin-core/secp256k1#1286: tests: remove extra semicolon in macro
c4062d6b5d83572c1932f32003a7c0e901fffc23 debug: move helper for printing buffers into util.h (Jonas Nick)
3858bad2c6493aa66cbfa62540d89da9c5a16040 tests: remove extra semicolon in macro (Jonas Nick)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK c4062d6b5d83572c1932f32003a7c0e901fffc23
  hebasto:
    ACK c4062d6b5d83572c1932f32003a7c0e901fffc23, I have reviewed the code and it looks OK.

Tree-SHA512: a2c97433d82c1ab2ba976c4fd8aaf337de5f225abcd459e84dcdab689e77e43d4ed654c971ab7f11f27af12e7a744122a0fdd9ece8e635d7a7041c45e9484de8
2023-04-25 23:10:00 +01:00
Jonas Nick
c4062d6b5d
debug: move helper for printing buffers into util.h 2023-04-25 16:07:10 +00:00
Jonas Nick
3858bad2c6
tests: remove extra semicolon in macro 2023-04-21 20:21:28 +00:00
Jonas Nick
1f33bb2b1c
Merge bitcoin-core/secp256k1#1205: field: Improve docs +tests of secp256k1_fe_set_b32
162da73e9a48875aab1ee6ca1c14f86ca4646946 tests: Add debug helper for printing buffers (Tim Ruffing)
e9fd3dff76e30fcd83d060ad9195cadae9cdc9a2 field: Improve docs and tests of secp256k1_fe_set_b32 (Tim Ruffing)
ca92a35d019730aec9d3ec8097dcbb9633a69874 field: Simplify code in secp256k1_fe_set_b32 (Tim Ruffing)
d93f62e3693d6763891edcad11472f9d475177e5 field: Verify field element even after secp256k1_fe_set_b32 fails (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 162da73e9a48875aab1ee6ca1c14f86ca4646946

Tree-SHA512: b3ed8e45c969d0420275ff154462f3820b72b57832ccba1f6f427e0cfd9cff3e27440c20994f69ea33a576b1903eb7f04a989f0dbd574bbd96ee56c6dd4500f7
2023-04-21 16:23:59 +00:00
Tim Ruffing
162da73e9a tests: Add debug helper for printing buffers 2023-04-21 17:20:37 +02:00
Tim Ruffing
e9fd3dff76 field: Improve docs and tests of secp256k1_fe_set_b32 2023-04-21 17:20:37 +02:00
Tim Ruffing
f6bef03c0a
Merge bitcoin-core/secp256k1#1283: Get rid of secp256k1_fe_const_b
69e1ec033120497b83dd95d92166fa05c54b8a06 Get rid of secp256k1_fe_const_b (Pieter Wuille)

Pull request description:

  Replaces #1282.

  Its only remaining use is in a test introduced in #1118, and it is easily replaced by the new `secp256k1_fe_add_int` from #1217.

ACKs for top commit:
  real-or-random:
    utACK 69e1ec033120497b83dd95d92166fa05c54b8a06

Tree-SHA512: 6ada192e0643fc5326198b60f019a5081444f9ba0a5b8ba6236f2a526829d8e5e479556600a604d9bc96c7ba86e3aab813f93c66679287d2135e95a2b75f5d3e
2023-04-21 13:07:59 +02:00
Tim Ruffing
5ec1333d4f
Merge bitcoin-core/secp256k1#1285: bench: Make sys/time.h a system include
68b16a1662af2db801a87d6f1afedca93ec2501c bench: Make sys/time.h a system include (Tim Ruffing)

Pull request description:

  just because it is minimally more correct

ACKs for top commit:
  hebasto:
    ACK 68b16a1662af2db801a87d6f1afedca93ec2501c, I've skimmed through the whole codebase and did not find any more similar cases.

Tree-SHA512: 0a929b36202100abf0d14e9328a2dc2b4c9db5532f95514315cb04dd0a970dbbb1dc02c6275be0ec109dc88f6090f6ce48a65003c852fd4dc750decf07e563c4
2023-04-21 12:52:01 +02:00
Tim Ruffing
68b16a1662 bench: Make sys/time.h a system include 2023-04-21 11:18:36 +02:00
Pieter Wuille
69e1ec0331 Get rid of secp256k1_fe_const_b 2023-04-20 16:07:56 -04:00
Tim Ruffing
ce5ba9e24d gitignore: Add CMakeUserPresets.json
This file is specifically intended for *local* CMake templates
(as opposed to CMakePresets.json).
2023-04-20 19:23:12 +02:00
Tim Ruffing
0a446a312f cmake: Add dev-mode CMake preset
To use, invoke `cmake` with argument `--preset dev-mode`.

Solves one item in #1235.

One disadvantage over `./configure --enable-dev-mode` is that CMake
does not provide a way to "hide" presets from users. That is,
`cmake --list-presets` will list dev-mode, and it will also appear
in `cmake-gui`, even though it's not selectable there due to bug
https://gitlab.kitware.com/cmake/cmake/-/issues/23341. (So in our
case, that's probably rather a feature than a bug.)

We curently use version 3 presets which require CMake 3.21+.
Unfortunately, CMake versions before 3.19 may ignore the `--preset`
argument silently. So if the preset is not picked up, make sure you
have a recent enough CMake version.

More unfortunately, we can't even spell this warning out in
CMakePresets.json because CMake does not support officially support
comments in JSON, see
 - https://gitlab.kitware.com/cmake/cmake/-/issues/21858
 - https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5853 .
We could use a hack hinted at in
https://gitlab.kitware.com/cmake/cmake/-/issues/21858#note_908543
but that's risky, because it could simply break for future versions,
and we probably want to use presets not only for dev mode.
2023-04-20 19:22:43 +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
Hennadii Stepanov
a273d74b2e
cmake: Improve version comparison 2023-04-20 17:03:42 +01:00
Hennadii Stepanov
6a58b483ef
cmake: Use if(... IN_LIST ...) command
Available in CMake 3.3+.
2023-04-20 17:00:11 +01:00
Hennadii Stepanov
2445808c02
cmake: Use dedicated GENERATOR_IS_MULTI_CONFIG property
Available in CMake 3.9+.
2023-04-20 17:00:10 +01:00
Hennadii Stepanov
9f8703ef17
cmake: Use dedicated CMAKE_HOST_APPLE variable 2023-04-20 17:00:10 +01:00
Hennadii Stepanov
8c2017035a
cmake: Use recommended add_compile_definitions command
Available in CMake 3.12+.
2023-04-20 17:00:10 +01:00
Hennadii Stepanov
04d4cc071a
cmake: Add DESCRIPTION and HOMEPAGE_URL options to project command
`DESCRIPTION` is available in CMake 3.9+.
`HOMEPAGE_URL` is available in CMake 3.12+.
2023-04-20 17:00:10 +01:00
Hennadii Stepanov
8a8b6536ef
cmake: Use SameMinorVersion compatibility mode
Available in CMake 3.11+.
2023-04-20 17:00:03 +01:00
Tim Ruffing
5b0444a3b5
Merge bitcoin-core/secp256k1#1263: cmake: Make installation optional
47ac3d63cd5e00a2d50cb489461c8bc349d37912 cmake: Make installation optional (Anna “CyberTailor”)

Pull request description:

  Useful for embedding secp256k1 in a subproject.

ACKs for top commit:
  theuni:
    ACK 47ac3d63cd5e00a2d50cb489461c8bc349d37912.
  real-or-random:
    utACK 47ac3d63cd5e00a2d50cb489461c8bc349d37912
  hebasto:
    ACK 47ac3d63cd5e00a2d50cb489461c8bc349d37912, tested on Ubuntu 23.04.

Tree-SHA512: 12ac0ba9dc38adf45684055386280b669384b5a4e528a3f6f4470fd0b7f57d64dfed6a8bb9f0a84cacfcb72f509534d71676c5ba37b27297b1a96676eea44e6e
2023-04-20 17:44:44 +02:00
Anna “CyberTailor”
47ac3d63cd
cmake: Make installation optional
Useful for embedding secp256k1 in a subproject.
2023-04-20 19:20:33 +05:00
Tim Ruffing
2e035af251
Merge bitcoin-core/secp256k1#1273: build: Make SECP_VALGRIND_CHECK preserve CPPFLAGS
1ecb94ebe9800900c7dd3a4f9883c600e25eecf7 build: Make `SECP_VALGRIND_CHECK` preserve `CPPFLAGS` (Hennadii Stepanov)

Pull request description:

  It was overlooked in #862 and #1027.

ACKs for top commit:
  real-or-random:
    utACK 1ecb94ebe9800900c7dd3a4f9883c600e25eecf7

Tree-SHA512: 263fc600ce9743e4aad767150f706bf7d4325dabb9c363ed57f08fe38faea94d7d1999804947cffeacbe698bb6d959ee6de3f6e50400050a390ecc0db957e426
2023-04-20 10:34:04 +02:00
Tim Ruffing
5be353d658
Merge bitcoin-core/secp256k1#1279: tests: lint wycheproof's python script
35ada3b954ccc6c54628fb3bcc0365d176297019 tests: lint wycheproof's python script (RandomLattice)

Pull request description:

  This PR lints tests_wycheproof_generate.py according to bitcoin's python linting scripts. This is a follow-up to PR #1245.

ACKs for top commit:
  sipa:
    utACK 35ada3b954ccc6c54628fb3bcc0365d176297019
  real-or-random:
    utACK 35ada3b954ccc6c54628fb3bcc0365d176297019

Tree-SHA512: ea405060d2e73ff3543626687de5bc5282be923b914bd5c8c53e65df8dca9bea0000c416603095efff29bc7ae43c2081454c4e506db0f6805443d023fbffaf4c
2023-04-19 16:28:39 +02:00
Tim Ruffing
04bf3f6778
Merge bitcoin-core/secp256k1#1230: Build: allow static or shared but not both
ef49a11d29601e09e94134975c968e92c0214102 build: allow static or shared but not both (Cory Fields)
36b0adf1b90139a41fdcb94390d0bb06e9224795 build: remove warning until it's reproducible (Cory Fields)

Pull request description:

  Continuing from here: https://github.com/bitcoin-core/secp256k1/issues/1224#issuecomment-1460438227

  Unfortunately it wasn't really possible to keep a clean diff here because of the nature of the change. I suggest reviewing the lib creation stuff in its entirety, sorry about that :\

  Rather than allowing for shared and static libs to be built at the same time like autotools, this PR switches to the CMake convention of allowing only 1.

  A new `BUILD_SHARED_LIBS` option is added to match CMake convention, as well as a `SECP256K1_DISABLE_SHARED` option which overrides it. That way even projects which have `BUILD_SHARED_LIBS=1` can opt-into a static libsecp in particular.

  Details:

  Two object libraries are created: `secp256k1_asm` and `secp256k1_precomputed_objs`. Some tests/benchmarks use the object libraries directly, some link against the real lib: `secp256k1`.

  Because the objs don't know what they're going to be linked into, they need to be told how to deal with PIC.

  The `DEFINE_SYMBOL` property sets the `DLL_EXPORT` define as necessary (when building a shared lib)

ACKs for top commit:
  hebasto:
    re-ACK ef49a11d29601e09e94134975c968e92c0214102, only [suggested](https://github.com/bitcoin-core/secp256k1/pull/1230#pullrequestreview-1388191165) changes since my recent [review](https://github.com/bitcoin-core/secp256k1/pull/1230#pullrequestreview-1352125381).
  real-or-random:
    ACK ef49a11d29601e09e94134975c968e92c0214102

Tree-SHA512: 8870de305176fdb677caff0fdfc6f8c59c0e906489cb72bc9980e551002812685e59e20d731f2a82e33628bdfbb7261eafd6f228038cad3ec83bd74335959600
2023-04-18 12:54:03 +02:00
Tim Ruffing
9ce9984f32
Merge bitcoin-core/secp256k1#1265: Remove bits argument from secp256k1_wnaf_const{_xonly}
a575339c0282ba49a4f46c9c660a4cc3b6bfc703 Remove bits argument from secp256k1_wnaf_const (always 256) (Pieter Wuille)

Pull request description:

  There is little reason for having the number of bits in the scalar as a parameter, as I don't think there are any (current) use cases for non-256-bit scalars.

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

Tree-SHA512: 994b1f19b4c513f6d070ed259a5d6f221a0c2450271ec824c5eba1cd0ecace276de391c170285bfeae96aaf8f1e0f7fe6260966ded0336c75c522ab6c56d182c
2023-04-18 12:25:09 +02:00
Jonas Nick
566faa17d3
Merge bitcoin-core/secp256k1#1267: doc: clarify process for patch releases
1b6fb5593c3b0dad8f8ad17ddd29ca30ebd00af3 doc: clarify process for patch releases (Jonas Nick)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK 1b6fb5593c3b0dad8f8ad17ddd29ca30ebd00af3

Tree-SHA512: 5c1da34c920f66327b91c1fd11ad2eccbb55c5befdb3ba59138faf921ce83d0e7c62de84f2431b0a63433f1edc0f7f0f025a852a76dd3638e3fd583ca13b83e4
2023-04-18 08:19:51 +00:00
Cory Fields
ef49a11d29 build: allow static or shared but not both 2023-04-17 16:25:27 +00:00
RandomLattice
35ada3b954 tests: lint wycheproof's python script
This PR lints tests_wycheproof_generate.py according to pylint.
This is a follow-up to PR #1245.

Co-authored-by: Sean Andersen <6730974+andozw@users.noreply.github.com>
2023-04-14 18:59:35 +02:00
Tim Ruffing
4258c54f4e
Merge bitcoin-core/secp256k1#1276: autotools: Don't regenerate Wycheproof header automatically
06c67dea9f6d46d3e24e810900fbb03045eae641 autotools: Don't regenerate Wycheproof header automatically (Tim Ruffing)

Pull request description:

  This is a hot fix for https://github.com/bitcoin/bitcoin/pull/27445 .

  ---

  Pregenerated files that we distribute should not have dependencies in Makefile.am. For rationale, see the comments about the precomputed table files.

  See also https://github.com/bitcoin/bitcoin/pull/27445#issuecomment-1502994264 .

ACKs for top commit:
  hebasto:
    ACK 06c67dea9f6d46d3e24e810900fbb03045eae641
  RandomLattice:
    ACK 06c67dea9f

Tree-SHA512: fa7f44eaa1c7e42ecba5829ac1b8ae8b5826d1a1551e01c3caf37af780bd5c102c8f54e88520723937f7016d93c67b62a334c7a28b96c4f422a38fcf8e6a1984
2023-04-14 13:46:48 +02:00
Tim Ruffing
06c67dea9f autotools: Don't regenerate Wycheproof header automatically
Pregenerated files that we distribute should not have dependencies
in Makefile.am. For rationale, see the comments about the precomputed
table files.

See also https://github.com/bitcoin/bitcoin/pull/27445#issuecomment-1502994264 .
2023-04-14 07:59:57 +02:00
Hennadii Stepanov
dc0657c762
build: Fix C4005 "macro redefinition" MSVC warnings in examples 2023-04-13 12:23:30 +01:00
Hennadii Stepanov
1ecb94ebe9
build: Make SECP_VALGRIND_CHECK preserve CPPFLAGS 2023-04-11 18:59:12 +01:00
Jonas Nick
3bab71cf05
Merge bitcoin-core/secp256k1#1268: release cleanup: bump version after 0.3.1
656c6ea8d8ec5b4f1fa91bc7f0a0ecd10c5cf5a0 release cleanup: bump version after 0.3.1 (Jonas Nick)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 656c6ea8d8ec5b4f1fa91bc7f0a0ecd10c5cf5a0
  real-or-random:
    ACK 656c6ea8d8ec5b4f1fa91bc7f0a0ecd10c5cf5a0

Tree-SHA512: da24326ed5feaa6a432522bddd64e6c129455cfe55a9e2decfce8c6039f4ce1a1da64233d17200f45d2c142f5414505b9a9b2ef5d136e047c1dd6cfdde1b560d
2023-04-10 20:05:59 +00:00
Jonas Nick
656c6ea8d8
release cleanup: bump version after 0.3.1 2023-04-10 19:50:27 +00:00
Jonas Nick
346a053d4c
Merge bitcoin-core/secp256k1#1269: changelog: Fix link
6a37b2a5ea9075c5dff14b3067c61114a334a2ba changelog: Fix link (Tim Ruffing)

Pull request description:

Top commit has no ACKs.

Tree-SHA512: 70d50c8fe958a197eb527e51c6f8120609e3166d93bfc1bbec75a3cb565c406d5ba0e6d088a724dcfda422b6594abf53f507211946a0533515df371d5d2a91bf
2023-04-10 19:31:28 +00:00
Tim Ruffing
6a37b2a5ea changelog: Fix link 2023-04-10 20:52:11 +02:00
Jonas Nick
ec98fcedd5
Merge bitcoin-core/secp256k1#1266: release: Prepare for 0.3.1
898e1c676e177af73b2c7b540cc93e72a2790fa2 release: Prepare for 0.3.1 (Tim Ruffing)
1d9a13fc2640b9bf870cba65dc69c504c1c9468d changelog: Remove inconsistent newlines (Tim Ruffing)
0e091669a13190289ed9dcc2ea9b8c330412cbc7 changelog: Catch up in preparation of 0.3.1 (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 898e1c676e177af73b2c7b540cc93e72a2790fa2
  jonasnick:
    ACK 898e1c676e177af73b2c7b540cc93e72a2790fa2

Tree-SHA512: 941b1524f8b34ca803a2ede55a7baf54d2faa69a4c5e47254297e96cc4ac2121094ed90e7cd64a708f3e9af830b0de0ef3c755dfee1b01ce958cc998fc1a1311
2023-04-10 17:28:39 +00:00
Jonas Nick
1b6fb5593c
doc: clarify process for patch releases 2023-04-10 15:19:07 +00:00
Tim Ruffing
898e1c676e release: Prepare for 0.3.1 2023-04-10 17:12:12 +02:00
Tim Ruffing
1d9a13fc26 changelog: Remove inconsistent newlines 2023-04-10 16:45:38 +02:00
Tim Ruffing
0e091669a1 changelog: Catch up in preparation of 0.3.1
Co-authored-by: Pieter Wuille <pieter@wuille.net>
2023-04-10 16:45:38 +02:00
Pieter Wuille
7b7503dac5
Merge bitcoin-core/secp256k1#1245: tests: Add Wycheproof ECDSA vectors
e5de45460953c8ae16521b1928ac14de218998a3 tests: Add Wycheproof ECDSA vectors (RandomLattice)

Pull request description:

  This PR adds a test using the Wycheproof vectors as outlined in #1106. We add all 463 ECDSA test vectors. These vectors cover:
  - edge cases in arithmetic operations
  - signatures with special values for (r,s) that should be rejected
  - special cases of public keys

  The vectors are pulled from the Wycheproof project using a python script to emit C code.

  All the new ECDSA Wycheproof vectors pass.

ACKs for top commit:
  sipa:
    ACK e5de45460953c8ae16521b1928ac14de218998a3
  real-or-random:
    ACK e5de45460953c8ae16521b1928ac14de218998a3

Tree-SHA512: e9684f14ff3f5225a4a4949b490e07527d559c28aa61ed03c03bc52ea64785f0b80b9e1b1628665eacf24006526271ea0fb108629c9c3c1d758e52d214a056f1
2023-04-10 09:29:02 -04:00
Pieter Wuille
a575339c02 Remove bits argument from secp256k1_wnaf_const (always 256) 2023-04-10 06:40:21 -04:00
Tim Ruffing
145078c418
Merge bitcoin-core/secp256k1#1118: Add x-only ecmult_const version with x specified as n/d
0f8642079b0f2e4874393792f5854e3c33742cbd Add exhaustive tests for ecmult_const_xonly (Pieter Wuille)
4485926ace489d87929be5218ae1ff3aa8591006 Add x-only ecmult_const version for x=n/d (Pieter Wuille)

Pull request description:

  This implements a generalization of Peter Dettman's sqrt-less x-only random-base multiplication algorithm from #262, using the Jacobi symbol algorithm from #979. The generalization is to permit the X coordinate of the base point to be specified as a fraction $n/d$:

  To compute $x(q \cdot P)$, where $x(P) = n/d$:
  * Compute $g=n^3 + 7d^3$.
  * Let $P' = (ng, g^2, 1)$ (the Jacobian coordinates of $P$ mapped to the isomorphic curve $y^2 = x^3 + 7(dg)^3$).
  * Compute the Jacobian coordinates $(X',Y',Z') = q \cdot P'$ on the isomorphic curve.
  * Return $X'/(dgZ'^2)$, which is the affine x coordinate on the isomorphic curve $X/Z'^2$ mapped back to secp256k1.

  This ability to specify the X coordinate as a fraction is useful in the context of x-only [Elligator Swift](https://eprint.iacr.org/2022/759), which can decode to X coordinates on the curve without inversions this way.

ACKs for top commit:
  jonasnick:
    ACK 0f8642079b0f2e4874393792f5854e3c33742cbd
  real-or-random:
    ACK 0f8642079b0f2e4874393792f5854e3c33742cbd

Tree-SHA512: eeedb3045bfabcb4bcaf3a1738067c83a5ea9a79b150b8fd1c00dc3f68505d34c19654885a90e2292ae40ddf40a58dfb27197d98eebcf5d6d9e25897e07ae595
2023-04-10 08:24:05 +02:00
RandomLattice
e5de454609 tests: Add Wycheproof ECDSA vectors
Adds a test using the Wycheproof vectors as outlined in #1106. The
vectors are taken from the Wycheproof repo. We use a python script
to convert the JSON-formatted vectors into C code.

Co-authored-by: Sean Andersen <6730974+andozw@users.noreply.github.com>
2023-04-09 06:17:16 +02:00