2153 Commits

Author SHA1 Message Date
Hennadii Stepanov
4a24fae0bc ci: Remove "arm64: macOS Ventura" task from Cirrus CI 2023-08-17 15:56:32 +02:00
Jonas Nick
3d05c86d63
Merge bitcoin-core/secp256k1#1394: ci, gha: Run "x86_64: macOS Ventura" job on GitHub Actions
8e54a346d2fa5aeedd6ba5201fcb084c281cf6a7 ci, gha: Run "x86_64: macOS Ventura" job on GitHub Actions (Hennadii Stepanov)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK 8e54a346d2fa5aeedd6ba5201fcb084c281cf6a7
  jonasnick:
    ACK 8e54a346d2fa5aeedd6ba5201fcb084c281cf6a7

Tree-SHA512: c10f9d8d677409b37f1d8a49e580f3160a920fed78add3437184e5dabf79083b1ba6df920a233f27485630e5bbee9ff9825e908cc6fb64b0c9959c131bc9f070
2023-08-17 11:09:59 +00:00
Tim Ruffing
5d8fa825e2
Merge bitcoin-core/secp256k1#1274: test: Silent noisy clang warnings about Valgrind code on macOS x86_64
747ada35877d4392c453b7c7249465fb382125ea test: Silent noisy clang warnings about Valgrind code on macOS x86_64 (Hennadii Stepanov)

Pull request description:

  Since #1206, on macOS x86_64 with Valgrind installed, clang emits a massive amount of `-Wreserved-identifier` and `-Wreserved-macro-identifier` warnings from the `valgrind/valgrind.h` and `valgrind/memcheck.h` headers.

  This PR prevents warnings emitted for the Valgrind code.

ACKs for top commit:
  real-or-random:
    utACK 747ada35877d4392c453b7c7249465fb382125ea

Tree-SHA512: dd1b2b9db2d471939fdc30f9d8fd106a12f21ec5008ca98d8ebe3087d7ea352d564e8bbd0cec59a004e084af3a84d4680cb81f2ef6fe13cf164b7691e33f437d
2023-08-16 19:04:31 +02:00
Hennadii Stepanov
8e54a346d2
ci, gha: Run "x86_64: macOS Ventura" job on GitHub Actions 2023-08-16 16:45:21 +01:00
Tim Ruffing
b327abfcea
Merge bitcoin-core/secp256k1#1402: ci: Use Homebrew's gcc in native macOS task
d62db57427f60da57f936cbe049ee27b10c3f8d4 ci: Use Homebrew's gcc in native macOS task (Hennadii Stepanov)

Pull request description:

  Fixes an issue noticed in https://github.com/bitcoin-core/secp256k1/pull/1394#issuecomment-1680233151:

  > This uses the wrong GCC, namely Clang

  When `CC=gcc`:

  - on the [master](https://api.cirrus-ci.com/v1/task/5074854529990656/logs/test.log) branch:
  ```
  + gcc -v
  Apple clang version 14.0.3 (clang-1403.0.22.14.1)
  Target: arm64-apple-darwin22.5.0
  Thread model: posix
  InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  ```

  - with this [PR](https://api.cirrus-ci.com/v1/task/5460539170619392/logs/test.log):
  ```
  + gcc -v
  Using built-in specs.
  COLLECT_GCC=gcc
  COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/13.1.0/bin/../libexec/gcc/aarch64-apple-darwin22/13/lto-wrapper
  Target: aarch64-apple-darwin22
  Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-13 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 13.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin22 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk
  Thread model: posix
  Supported LTO compression algorithms: zlib zstd
  gcc version 13.1.0 (Homebrew GCC 13.1.0)
  ```

ACKs for top commit:
  real-or-random:
    ACK d62db57427f60da57f936cbe049ee27b10c3f8d4, it works: https://cirrus-ci.com/task/6200190252613632?logs=test#L27

Tree-SHA512: 34b3aa86584fc04b57301731ebf811cd5b457cebb13e64593b8efb776aec48c1be5d2662b1af3f482d39fdb43308dafa5f4bfc18bd2cf350f0f61f0be799346e
2023-08-16 16:32:19 +02:00
Hennadii Stepanov
d62db57427
ci: Use Homebrew's gcc in native macOS task
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2023-08-16 14:39:58 +01:00
Tim Ruffing
eedd781085
Merge bitcoin-core/secp256k1#1348: tighten group magnitude limits, save normalize_weak calls in group add methods (revival of #1032)
b7c685e74adbd83937990e90f076600fabf8ccf0 Save _normalize_weak calls in group add methods (Peter Dettman)
c83afa66e0c324e42d13adff0e4f7db9b2868788 Tighten group magnitude limits (Peter Dettman)
173e8d061a8d1526f80d9ae79dd7f0371d38f7e0 Implement current magnitude assumptions (Peter Dettman)
49afd2f5d8c323d32a21f2fe182823b6d7704eb2 Take use of _fe_verify_magnitude in field_impl.h (Sebastian Falbesoner)
4e9661fc426c6068b2472f52a772c312bc26acc9 Add _fe_verify_magnitude (no-op unless VERIFY is enabled) (Peter Dettman)
690b0fc05abd76cb7f6bd87e88bf7b8b0fd1ab70 add missing group element invariant checks (Sebastian Falbesoner)

Pull request description:

  This PR picks up #1032 by peterdettman. It's essentially a rebase on master; the original first commit (09dbba561fdb9d57a2cc9842ce041d9ba29a6189) which introduced group verification methods has mostly been replaced by PR #1299 (commit f20266722ac93ca66d1beb0d2f2d2469b95aafea) and what remains now is only adding a few missing checks at some places. The remaining commits are unchanged, though some (easy-to-solve) conflicts appeared through cherry-picking. The last commit which actually removes the `normalize_weak` calls is obviously the critical one and needs the most attention for review.

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

Tree-SHA512: f15167eff7ef6ed971c726a4d738de9a15be95b0c947d7e38329e7b16656202b7113497d36625304e784866349f2293f6f1d8cb97df35393af9ea465a4156da3
2023-08-16 13:51:11 +02:00
Jonas Nick
b2f6712dd3
Merge bitcoin-core/secp256k1#1400: ctimetests: Use new SECP256K1_CHECKMEM macros also for ellswift
9c91ea41b1987d73b9cbb7e569bb1f1e640a4110 ci: Enable ellswift module where it's missing (Tim Ruffing)
db32a247612d3d48c7c617b9dedf067649f82083 ctimetests: Use new SECP256K1_CHECKMEM macros also for ellswift (Tim Ruffing)

Pull request description:

ACKs for top commit:
  hebasto:
    ACK 9c91ea41b1987d73b9cbb7e569bb1f1e640a4110.
  jonasnick:
    ACK 9c91ea41b1987d73b9cbb7e569bb1f1e640a4110

Tree-SHA512: e918236cb38b2bb6e69f84fcfa5f550c54f0df018103627082646a8fd731c238ce68b1b85badf042f08300208015012677143a96f9b97d94065b9a00c1da7876
2023-08-16 09:32:01 +00:00
Tim Ruffing
9c91ea41b1 ci: Enable ellswift module where it's missing 2023-08-15 19:19:36 +02:00
Tim Ruffing
db32a24761 ctimetests: Use new SECP256K1_CHECKMEM macros also for ellswift 2023-08-15 19:13:09 +02:00
Jonas Nick
ce765a5b8e
Merge bitcoin-core/secp256k1#1399: ci, gha: Run "SageMath prover" job on GitHub Actions
8408dfdc4cfcc5cf87ac0a7d229f8a1c1d63128a Revert "ci: Run sage prover on CI" (Hennadii Stepanov)
c8d9914fb1bf2790e6837794111614b640757ea3 ci, gha: Run "SageMath prover" job on GitHub Actions (Hennadii Stepanov)

Pull request description:

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

Tree-SHA512: 4de628b6d5535023c5351faebfd98d2bd9effe6592f14ffe0d0f7c6eeedd7426b9891da70aa3ea7fa830f0abc054f6b015af01fb6e26f50d45eb26177a7a6310
2023-08-15 11:54:27 +00:00
Hennadii Stepanov
8408dfdc4c
Revert "ci: Run sage prover on CI"
This reverts commit d8d54859ed138a8ed9a8486d847155211c9f4a7d.
2023-08-14 14:28:54 +01:00
Hennadii Stepanov
c8d9914fb1
ci, gha: Run "SageMath prover" job on GitHub Actions 2023-08-14 14:28:53 +01:00
Tim Ruffing
8d2960c8e2
Merge bitcoin-core/secp256k1#1397: ci: Remove "Windows (VS 2022)" task from Cirrus CI
f1774e5ec4a49db5762ecccbabd7fb5db0a7fb2b ci, gha: Make MSVC job presentation more explicit (Hennadii Stepanov)
5ee039bb58962745e5f861ae6603b5961adcd1e3 ci: Remove "Windows (VS 2022)" task from Cirrus CI (Hennadii Stepanov)

Pull request description:

  A follow-up for https://github.com/bitcoin-core/secp256k1/pull/1389.

  https://github.com/bitcoin-core/secp256k1/pull/1389#issuecomment-1671345100:
  > Or actually... hebasto Can you remove the second commit for now, if we're unsure whether this works at all.

  ---

  Second commit effect:
  - [before (master branch)](https://github.com/bitcoin-core/secp256k1/actions/runs/5809860925):
  ![image](https://github.com/bitcoin-core/secp256k1/assets/32963518/041439a5-8d1a-4740-85c3-4223e8cd9f70)

  - [after (this PR)](https://github.com/bitcoin-core/secp256k1/actions/runs/5810140851):
  ![image](https://github.com/bitcoin-core/secp256k1/assets/32963518/9e0c8f2c-1ba6-4df9-8720-542788b24da6)

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

Tree-SHA512: ed36c5cef3ba4cf6769d480358f753ecc4a8a150103201f586b05d8d364c580ff637fe5b915918c695c8f7067c1bd7de6384eea1a12d1b8575ba5b629779ebf4
2023-08-09 16:57:53 +02:00
Hennadii Stepanov
f1774e5ec4
ci, gha: Make MSVC job presentation more explicit 2023-08-09 15:08:24 +01:00
Hennadii Stepanov
5ee039bb58
ci: Remove "Windows (VS 2022)" task from Cirrus CI 2023-08-09 14:48:11 +01:00
Tim Ruffing
96294c00fb
Merge bitcoin-core/secp256k1#1389: ci: Run "Windows (VS 2022)" job on GitHub Actions
a2f7ccdecc4721d972f36d6aacc5f0c85ce0557d ci: Run "Windows (VS 2022)" job on GitHub Actions (Hennadii Stepanov)

Pull request description:

  This PR solves one item in https://github.com/bitcoin-core/secp256k1/issues/1392.

  In response to upcoming [limiting free usage of Cirrus CI](https://cirrus-ci.org/blog/2023/07/17/limiting-free-usage-of-cirrus-ci/), suggesting to move (partially?) CI tasks/jobs from Cirrus CI to [GitHub Actions](https://docs.github.com/actions) (GHA).

  Here is example from my personal repo: https://github.com/hebasto/secp256k1/actions/runs/5806269046.

  For security concerns, see:
  - https://github.com/bitcoin/bitcoin/issues/28098#issuecomment-1651432106
  - https://github.com/bitcoin/bitcoin/issues/28098#issuecomment-1651688197

  I'm suggesting the repository "Actions permissions" as follows:

  ![image](https://github.com/bitcoin-core/secp256k1/assets/32963518/bd18d489-784f-48ba-b599-ed1c4dfc34fa)

  ![image](https://github.com/bitcoin-core/secp256k1/assets/32963518/632280e0-9c26-42eb-a0ed-24f9a8142faa)

  ---

  See build logs in my personal repo: https://github.com/hebasto/secp256k1/actions/runs/5692587475.

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

Tree-SHA512: b6329a29391146e3cdee9a56f6151b6672aa45837dfaacb708ba4209719801ed029a6928d638d314b71c7533d927d771b3eca4b9e740cfcf580a40ba07970ae4
2023-08-09 15:43:50 +02:00
Hennadii Stepanov
a2f7ccdecc
ci: Run "Windows (VS 2022)" job on GitHub Actions 2023-08-09 12:54:18 +01:00
Tim Ruffing
374e2b54e2
Merge bitcoin-core/secp256k1#1290: cmake: Set ENVIRONMENT property for examples on Windows
175db31149fff4b3dc3d3dab021f289d7e98381c ci: Drop no longer needed `PATH` variable update on Windows (Hennadii Stepanov)
116d2ab3df630455f23a7b21f50237689879ecc0 cmake: Set `ENVIRONMENT` property for examples on Windows (Hennadii Stepanov)
cef373997c29c5e6077b9367c92812bcc99bc8bf cmake, refactor: Use helper function instead of interface library (Hennadii Stepanov)

Pull request description:

  This PR simplifies running examples on Windows, because the DLL must reside either in the same folder where the executable is or somewhere in PATH.

  It is an alternative to #1233.

ACKs for top commit:
  real-or-random:
    utACK 175db31149fff4b3dc3d3dab021f289d7e98381c

Tree-SHA512: 8188018589a5bcf0179647a039cdafcce661dc103a70a5bb9e6b6f680b899332ba30b1e9ef5dad2a8c22c315d7794747e49d8cf2e391eebea21e3d8505ee334b
2023-08-03 15:15:03 +02:00
Jonas Nick
1b13415df9
Merge bitcoin-core/secp256k1#1391: refactor: take use of secp256k1_scalar_{zero,one} constants (part 2)
a1bd4971d6c6113f140143275141adb336fc3702 refactor: take use of `secp256k1_scalar_{zero,one}` constants (part 2) (Sebastian Falbesoner)

Pull request description:

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

Tree-SHA512: 09ef6d9be1d3f9c19f8fe4614fe629de5c45197027e0e3f9dd8d4679a510a7b57f8aa499707a6daf652041f255c87316c9883bf7cf9a08bd41a3651bff54299e
2023-08-03 09:41:58 +00:00
Sebastian Falbesoner
a1bd4971d6 refactor: take use of secp256k1_scalar_{zero,one} constants (part 2) 2023-08-01 02:40:21 +02:00
Peter Dettman
b7c685e74a Save _normalize_weak calls in group add methods
Also update the operations count comments in each of the affected
functions accordingly and remove a redundant VERIFY_CHECK in
secp256k1_gej_add_ge (the infinity value range check [0,1] is already
covered by secp256k1_gej_verify above).

Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2023-07-29 01:10:21 +02:00
Peter Dettman
c83afa66e0 Tighten group magnitude limits
- adjust test methods that randomize magnitudes

Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2023-07-28 13:05:04 +02:00
Tim Ruffing
26392da2fb
Merge bitcoin-core/secp256k1#1386: ci: print $ELLSWIFT in cirrus.sh
4692478853df2149375d1447908a792fcf240fbf ci: print $ELLSWIFT in cirrus.sh (Jonas Nick)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK 4692478853df2149375d1447908a792fcf240fbf

Tree-SHA512: 84c6021e2135857541def6ba058d9c9a1c180fd32a625854ff82d51d0561a4dd243623d38d335aeaf40200501581c0678878a9166f4a96ae3fb32717b8d39fbd
2023-07-27 15:05:29 +02:00
Jonas Nick
4692478853
ci: print $ELLSWIFT in cirrus.sh 2023-07-27 10:20:50 +00:00
Tim Ruffing
c734c64278
Merge bitcoin-core/secp256k1#1384: build: enable ellswift module via SECP_CONFIG_DEFINES
78ca8807880def68a575b2487f374fdf4b49962d build: enable ellswift module via SECP_CONFIG_DEFINES (Jonas Nick)

Pull request description:

  ...like the other modules.

ACKs for top commit:
  sipa:
    utACK 78ca8807880def68a575b2487f374fdf4b49962d
  real-or-random:
    utACK 78ca8807880def68a575b2487f374fdf4b49962d

Tree-SHA512: c157a1ed912b9aa1a318aa0a70859a3ac67cb22303993f08ff00ed601e6ac197380dd503d3b361cbc4e698fc6489b5283b782f570f2703809d23668f3ebe5ba6
2023-07-27 09:21:00 +02:00
Jonas Nick
78ca880788
build: enable ellswift module via SECP_CONFIG_DEFINES
...like the other modules.
2023-07-26 14:44:20 +00:00
Tim Ruffing
0e00fc7d10
Merge bitcoin-core/secp256k1#1383: util: remove unused checked_realloc
b097a466c168dcdb3fde435ec4a1e0b63609f55d util: remove unused checked_realloc (Cory Fields)

Pull request description:

  Usage was removed in 6fe50439 . This should be a NOOP.

  Noticed when analyzing for zenbleed exposure: stdlib calls that aren't optimized away.

  In this case realloc isn't making it into the final binary, but as far as I can tell this is completely dead code and should be dropped.

ACKs for top commit:
  jonasnick:
    ACK b097a466c168dcdb3fde435ec4a1e0b63609f55d
  real-or-random:
    ACK b097a466c168dcdb3fde435ec4a1e0b63609f55d

Tree-SHA512: d4249215eddd4035be2b50a8bb48b8a681abdab4ab41ca53f6c2a2507edfbc9ffa39ba22eb48e7da52f978e224198294495ce64f9d571d98c19283b20b82a63a
2023-07-26 13:50:23 +02:00
Cory Fields
b097a466c1 util: remove unused checked_realloc
Usage was removed in 6fe50439 .
2023-07-25 20:37:46 +00:00
Jonas Nick
2bd5f3e618
Merge bitcoin-core/secp256k1#1382: refactor: Drop unused cast
4f8c5bd76132a0d0242c7a29b666153f927800bb refactor: Drop unused cast (Hennadii Stepanov)

Pull request description:

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

Tree-SHA512: cc94b524f53e393bd843383e92bbc5b84dd7557d8121241f2d0461b960a0706236147d02b6f5bfc433272849f517c62eb6f1e0cfae892e1b8054817c27365430
2023-07-24 19:07:54 +00:00
Hennadii Stepanov
4f8c5bd761
refactor: Drop unused cast 2023-07-24 13:14:23 +01:00
Peter Dettman
173e8d061a Implement current magnitude assumptions
Remove also the explicit magnitude restriction `a->x.magnitude <= 31`
in `secp256k1_gej_eq_x_var` (introduced in commit
07c0e8b82e2cea87f85263512945fed7adffea18), as this is implied by the
new limits.

Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
2023-07-22 01:52:06 +02:00
Sebastian Falbesoner
49afd2f5d8 Take use of _fe_verify_magnitude in field_impl.h 2023-07-22 01:52:06 +02:00
Peter Dettman
4e9661fc42 Add _fe_verify_magnitude (no-op unless VERIFY is enabled)
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2023-07-22 01:52:06 +02:00
Sebastian Falbesoner
690b0fc05a add missing group element invariant checks
The group element checks `secp256k1_{ge,gej}_verify` have first been
implemented and added in commit f20266722ac93ca66d1beb0d2f2d2469b95aafea
(PR #1299). This commit adds additional verification calls in group
functions, to match the ones that were originally proposed in commit
09dbba561fdb9d57a2cc9842ce041d9ba29a6189 of WIP-PR #1032 (which is
obviously not rebased on #1299 yet).

Also, for easier review, all functions handling group elements are
structured in the following wasy for easier review (idea suggested by
Tim Ruffing):

- on entry, verify all input ge, gej (and fe)
- empty line
- actual function body
- empty line
- on exit, verify all output ge, gej

Co-authored-by: Peter Dettman <peter.dettman@gmail.com>
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2023-07-22 01:52:06 +02:00
Jonas Nick
c545fdc374
Merge bitcoin-core/secp256k1#1298: Remove randomness tests
6ec3731e8c53658fcf68634c81bb1e47cad791ad Simplify test PRNG implementation (Pieter Wuille)
fb5bfa4eed834dcd58109525408a2d88dabc48c5 Add static test vector for Xoshiro256++ (Tim Ruffing)
723e8ca8f7ee75126bac4240feeac825c23a0d44 Remove randomness tests (Pieter Wuille)

Pull request description:

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

Tree-SHA512: 4cbbb9c42e31f067b17dd9169ae5d5e68bce77d1253452db9df523d3be2b5d61002d5a4203e5a153f257ec63c5ff2113555743eeb402d4b6c573069ea494d407
2023-07-18 14:05:46 +00:00
Tim Ruffing
b40e2d30b7
Merge bitcoin-core/secp256k1#1378: ellswift: fix probabilistic test failure when swapping sides
c424e2fb43c8ed959b2af7b2216028ce2a023488 ellswift: fix probabilistic test failure when swapping sides (Jonas Nick)

Pull request description:

  Reported by jonatack in https://github.com/bitcoin/bitcoin/issues/28079.

  When configured with `--disable-module-ecdh --enable-module-recovery`, then `./tests  64 81af32fd7ab8c9cbc2e62a689f642106` fails with
  ```
  src/modules/ellswift/tests_impl.h:396: test condition failed: secp256k1_memcmp_var(share32_bad, share32a, 32) != 0
  ```

  This tests verifies that changing the `party` bit of the `secp256k1_ellswift_xdh` function results in a different share. However, that's not the case when the secret keys of both parties are the same and this is actually what happens in the observed test failure. The keys can be equal in this test case because they are created by the `random_scalar_order_test` function whose output is not uniformly random (it's biased towards 0).

  This commit restores the assumption that the secret keys differ.

ACKs for top commit:
  sipa:
    utACK c424e2fb43c8ed959b2af7b2216028ce2a023488
  real-or-random:
    utACK c424e2fb43c8ed959b2af7b2216028ce2a023488

Tree-SHA512: d1ab61473a77478f9aeffb21ad73e0bba478c90d8573c72ec89d2e0140434cc65c9d5f4d56e5f259931dc68fc1800695c6cd5d63d9cfce4c1c4d6744eeaa2028
2023-07-17 18:37:20 +02:00
Jonas Nick
c424e2fb43
ellswift: fix probabilistic test failure when swapping sides
When configured with `--disable-module-ecdh --enable-module-recovery`, then
`./tests  64 81af32fd7ab8c9cbc2e62a689f642106` fails with
```
src/modules/ellswift/tests_impl.h:396: test condition failed: secp256k1_memcmp_var(share32_bad, share32a, 32) != 0
```

This tests verifies that changing the `party` bit of the
`secp256k1_ellswift_xdh` function results in a different share. However, that's
not the case when the secret keys of both parties are the same and this is
actually what happens in the observed test failure. The keys can be equal in
this test case because they are created by the `random_scalar_order_test`
function whose output is not uniformly random (it's biased towards 0).

This commit restores the assummption that the secret keys differ.
2023-07-17 09:50:32 +00:00
Hennadii Stepanov
175db31149
ci: Drop no longer needed PATH variable update on Windows 2023-07-14 08:43:08 +01:00
Hennadii Stepanov
116d2ab3df
cmake: Set ENVIRONMENT property for examples on Windows
This change simplifies running examples on Windows, because the DLL
must reside either in the same folder where the executable is or
somewhere in PATH.
2023-07-14 08:42:48 +01:00
Hennadii Stepanov
cef373997c
cmake, refactor: Use helper function instead of interface library
This change aims to simplify the following commit.
2023-07-14 08:41:26 +01:00
Jonas Nick
907a67212e
Merge bitcoin-core/secp256k1#1313: ci: Test on development snapshots of GCC and Clang
981e5be38c492f0c0230fbe61be555d157380331 ci: Fix typo in comment (Tim Ruffing)
e9e96482196da641733a8a6763341a84f8b9806a ci: Reduce number of macOS tasks from 28 to 8 (Tim Ruffing)
609093b3877b2fb21bd4bb2301a3eafb444a2fdb ci: Add x86_64 Linux tasks for gcc and clang snapshots (Tim Ruffing)
1deecaaf3b94dbf08896e015e7f1e5ec328a40f2 ci: Install development snapshots of gcc and clang (Tim Ruffing)

Pull request description:

ACKs for top commit:
  hebasto:
    re-ACK 981e5be38c492f0c0230fbe61be555d157380331
  jonasnick:
    ACK 981e5be38c492f0c0230fbe61be555d157380331

Tree-SHA512: a36ef6f3c30a7f6e09e186e67b8eeb6e16e05de3bd97f21342866e75e33275103d463b6a12603ce235da7e26e4acdef4d811f62f369f18db9ac4e7ff06749136
2023-07-13 14:44:45 +00:00
Tim Ruffing
0f7657d59c
Merge bitcoin-core/secp256k1#1366: field: Use restrict consistently in fe_sqrt
b79ba8aa4c074b2cd09188f6f85ba68d6b80fe50 field: Use `restrict` consistently in fe_sqrt (Tim Ruffing)

Pull request description:

  That is, use it also in the definition and not only the declaration.

  I believe this was the intention of commit
  be82bd8e03, but it was omitted there.

  edit: Changed the description. I'm not entirely sure but after looking at the standard, I tend to think this is more than a cosmetic change, and only this change actually makes the parameters `restrict`. Anyway, I believe making them `restrict` was simply forgotten in be82bd8e0347e090037ff1d30a22a9d614db8c9f.

ACKs for top commit:
  sipa:
    utACK b79ba8aa4c074b2cd09188f6f85ba68d6b80fe50

Tree-SHA512: eecec7674d8cef7833d50f4041b87241ca8de4839aa8027df1c422b89f5a1bcef3916ac785057a596c459ce1aa9d41e5a21ecb6fed9c5d15a1d9f588c7ee208e
2023-07-12 01:14:22 +02:00
Tim Ruffing
cc55757552
Merge bitcoin-core/secp256k1#1340: clean up in-comment Sage code (refer to secp256k1_params.sage, update to Python3)
600c5adcd59240305e22918943f45dceeabb7e93 clean up in-comment Sage code (refer to secp256k1_params.sage, update to Python3) (Sebastian Falbesoner)

Pull request description:

  Some of the C source files contain contain in-comment Sage code calculating secp256k1 parameters that are already defined in the file secp256k1_params.sage.  Replace that by a corresponding load instruction and access the necessary variables. In ecdsa_impl.h, update the comment to use a one-line shell command calling sage to get the values.

  The remaining code (test `test_add_neg_y_diff_x` in tests.c) is updated to work with a current version based on Python3 (Sage 9.0+, see https://wiki.sagemath.org/Python3-Switch).

  The latter can be seen as a small follow-up to PR #849 (commit 13c88efed0005eb6745a222963ee74564054eafb).

ACKs for top commit:
  sipa:
    ACK 600c5adcd59240305e22918943f45dceeabb7e93
  real-or-random:
    ACK 600c5adcd59240305e22918943f45dceeabb7e93

Tree-SHA512: a9e52f6afbce65edd9ab14203612c3d423639f450fe8f0d269a3dda04bebefa95b607f7aa0faec864cb78b46d49f281632bb1277118749b7d8613e9f5dcc8f3d
2023-07-10 18:34:16 +02:00
Sebastian Falbesoner
600c5adcd5 clean up in-comment Sage code (refer to secp256k1_params.sage, update to Python3)
Some of the C source files contain contain in-comment Sage code
calculating secp256k1 parameters that are already defined in the file
secp256k1_params.sage.  Replace that by a corresponding load instruction
and access the necessary variables. In ecdsa_impl.h, update the comment
to use a one-line shell command calling sage to get the values.

The remaining code (test `test_add_neg_y_diff_x` in tests.c) is updated
to work with a current version based on Python3 (Sage 9.0+, see
https://wiki.sagemath.org/Python3-Switch).

The latter can be seen as a small follow-up to PR #849 (commit
13c88efed0005eb6745a222963ee74564054eafb).
2023-07-10 02:28:31 +02:00
Tim Ruffing
981e5be38c ci: Fix typo in comment 2023-07-06 20:19:07 +02:00
Tim Ruffing
e9e9648219 ci: Reduce number of macOS tasks from 28 to 8 2023-07-06 20:19:04 +02:00
Tim Ruffing
609093b387 ci: Add x86_64 Linux tasks for gcc and clang snapshots 2023-07-06 20:19:04 +02:00
Tim Ruffing
1deecaaf3b ci: Install development snapshots of gcc and clang
TODO: Make sure the Docker image is actually rebuild
2023-07-06 20:19:04 +02:00
Tim Ruffing
b79ba8aa4c field: Use restrict consistently in fe_sqrt
That is, use it also in the definition and not only the declaration.

I believe this was the intention of commit
be82bd8e0347e090037ff1d30a22a9d614db8c9f, but it was omitted there.
2023-07-06 16:44:52 +02:00