2025 Commits

Author SHA1 Message Date
Tim Ruffing
debf3e5c08
Merge bitcoin-core/secp256k1#1330: refactor: take use of secp256k1_scalar_{zero,one} constants
ade5b367018a624ff7ca1ecbb4a64889d47b0142 tests: add checks for scalar constants `secp256k1_scalar_{zero,one}` (Sebastian Falbesoner)
654246c63585422a184121a26d42dcae792e87c6 refactor: take use of `secp256k1_scalar_{zero,one}` constants (Sebastian Falbesoner)

Pull request description:

  Rather than allocating a (non-constant) scalar variable on the stack with the sole purpose of setting it to a constant value, the global constants `secp256k1_scalar_{zero,one}` (apparently introduced in 34a67c773b0871e5797c7ab506d004e80911f120, PR #710) can be directly used instead for the values 0 or 1. There is very likely not even a difference in run-time, but it leads to simpler and less code which might be nice.

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

Tree-SHA512: 0ff05a449c153f7117a4a56efef04b2087c2330f4692f3390a0b1d95573785ac7ae3fe689ed0ec2ecc64b575d2489d6e341d32567e75a1a4b4d458c3ecd406a1
2023-05-31 19:39:05 +02:00
Tim Ruffing
d75dc59b58
Merge bitcoin-core/secp256k1#1333: test: Warn if both VERIFY and COVERAGE are defined
e83801f5db2cb63e6343eff0ecfa40b7cd4a9090 test: Warn if both `VERIFY` and `COVERAGE` are defined (Hennadii Stepanov)

Pull request description:

  Solves one item in https://github.com/bitcoin-core/secp256k1/issues/1235.

  Also see: https://github.com/bitcoin-core/secp256k1/pull/1113#discussion_r1127856040.

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

Tree-SHA512: 25e10a09ba2c3585148becd06f2a03d85306208bda333827c9ba73eb7fd94ad15536f10daf1b335703e5cb0539584f001501ce9c578f478ff1ebc1051aefde7d
2023-05-31 19:37:56 +02:00
Sebastian Falbesoner
ade5b36701 tests: add checks for scalar constants secp256k1_scalar_{zero,one} 2023-05-30 12:24:33 +02:00
Hennadii Stepanov
e83801f5db
test: Warn if both VERIFY and COVERAGE are defined 2023-05-30 11:17:20 +01:00
Sebastian Falbesoner
654246c635 refactor: take use of secp256k1_scalar_{zero,one} constants 2023-05-30 12:10:41 +02:00
Tim Ruffing
908e02d596
Merge bitcoin-core/secp256k1#1328: build: Bump MSVC warning level up to W3
1549db0ca5193b8ba5d8f7478d54af2ca4b36c7e build: Level up MSVC warnings (Hennadii Stepanov)

Pull request description:

  Solves one item in https://github.com/bitcoin-core/secp256k1/issues/1235.

ACKs for top commit:
  sipa:
    utACK 1549db0ca5193b8ba5d8f7478d54af2ca4b36c7e
  real-or-random:
    ACK 1549db0ca5193b8ba5d8f7478d54af2ca4b36c7e

Tree-SHA512: 769386f734709537291ddee45c7fbee501185d3eebe9daa117d36e13e8504fabd1127857bc661a751fdf63f2eee1e7e9507121bdb020c97eb87b8758cb0879f8
2023-05-26 16:14:16 +02:00
Hennadii Stepanov
1549db0ca5
build: Level up MSVC warnings 2023-05-25 09:43:55 +01:00
Tim Ruffing
20a5da5fb1
Merge bitcoin-core/secp256k1#1310: Refine release process
ad846032973cc1afd360613626c4e475bba66f56 release process: clarify change log updates (Jonas Nick)
6348bc7eeed8dbd9cb9bd5df643451a37392bae3 release process: fix process for maintenance release (Jonas Nick)
79fa50b082dd28dd4282d6211d52130db317389b release process: mention targeted release schedule (Jonas Nick)
165206789bc1ff1a95f62d9cd3ed79169b884d67 release process: add sanity checks (Jonas Nick)

Pull request description:

  Fixes #1176

ACKs for top commit:
  real-or-random:
    ACK ad846032973cc1afd360613626c4e475bba66f56
  hebasto:
    re-ACK ad846032973cc1afd360613626c4e475bba66f56

Tree-SHA512: 215b469f4ecc6ecb2b07ba4d29b6b01fc0dda752d9cfffc3f5ec518f2efb5ec9ae027056b113758fadbebcdfdd549ff5803c3d7257761da6e3859ff6131cc137
2023-05-24 15:50:06 +02:00
Jonas Nick
ad84603297
release process: clarify change log updates 2023-05-24 13:43:29 +00:00
Jonas Nick
6348bc7eee
release process: fix process for maintenance release 2023-05-24 13:43:29 +00:00
Jonas Nick
79fa50b082
release process: mention targeted release schedule 2023-05-24 13:43:28 +00:00
Jonas Nick
165206789b
release process: add sanity checks 2023-05-24 13:43:25 +00:00
Tim Ruffing
09df0bfb23
Merge bitcoin-core/secp256k1#1327: ci: Move wine prefix to /tmp to avoid error D8037 in cl.exe
27504d5c941df89bc828067248270179c9dcb04b ci: Move wine prefix to /tmp to avoid error D8037 in cl.exe (Tim Ruffing)

Pull request description:

  Don't ask me why this makes a difference. It may be some permission problem even though everything in Cirrus CI runs as root anyway. In any case, I'll probably get mad if I investigate this further.

  Fixes #1326.

ACKs for top commit:
  hebasto:
    ACK 27504d5c941df89bc828067248270179c9dcb04b, tested in my personal Cirrus account.

Tree-SHA512: 08bb1734827579b59c705a44ee8fad6d504031eb5659c2743649be95fb048794b95ac0869a994bfa732f7f0714b4d12674c325637fe079b2266f18a3c14bbec0
2023-05-24 15:36:01 +02:00
Tim Ruffing
27504d5c94 ci: Move wine prefix to /tmp to avoid error D8037 in cl.exe
Don't ask me why this makes a difference. It may be some permission
problem even though everything in Cirrus CI runs as root anyway. In
any case, I'll probably get mad if I investigate this further.

Fixes #1326.
2023-05-24 14:28:05 +02:00
Tim Ruffing
d373a7215b
Merge bitcoin-core/secp256k1#1316: Do not invoke fe_is_zero on failed set_b32_limit
6433175ffe2435bcee7333e21480e4194083caae Do not invoke fe_is_zero on failed set_b32_limit (Pieter Wuille)

Pull request description:

  Noticed in the CI output of #1313 (https://cirrus-ci.com/task/5117786435878912)

  The code violates the field element contract that states that a field element that comes out of a failed `secp256k1_fe_set_b32_limit` call cannot be used before overwriting it. This is not an issue in practice, as such failure can only occur with negligible probability, but the experimental compiler in that CI setting is technically correct in detecting this possibility.

  Fix it by setting it to 1 based on a `secp256k1_fe_normalizes_to_zero` test rather than a `secp256k1_fe_is_zero` one (which does not require normalization).

ACKs for top commit:
  stratospher:
    ACK 6433175
  real-or-random:
    utACK 6433175ffe2435bcee7333e21480e4194083caae

Tree-SHA512: 49da4535181c4607c1f4d23d1fd7cd65e7751c7cfa68643f1da77f3ec7961754fc8553bb415137fd61d86c805fe69f5adf97c05b9dc4d3bf357ae7c6409cc51a
2023-05-23 13:34:03 +02:00
Pieter Wuille
6433175ffe Do not invoke fe_is_zero on failed set_b32_limit 2023-05-19 08:40:28 -04:00
Tim Ruffing
5f7903c73c
Merge bitcoin-core/secp256k1#1318: build: Enable -DVERIFY for precomputation binaries
5768b502291ed4214cf84b7d80ff540ed57d45c4 build: Enable -DVERIFY for precomputation binaries (Tim Ruffing)

Pull request description:

  because... why not?!

  I realized that this can't hurt when working on #1313.

ACKs for top commit:
  sipa:
    ACK 5768b502291ed4214cf84b7d80ff540ed57d45c4

Tree-SHA512: 2412cb93097f5c7904cfded6816bc5cdc69d958b4023ddaffd6e7575615ac5bfcd3a7cfc9ce2c0b0e6526a6f000dd84ecd32909d9d207a3644aadb5d34905911
2023-05-19 10:05:19 +02:00
Tim Ruffing
e9e4526a4e
Merge bitcoin-core/secp256k1#1317: Make fe_cmov take max of magnitudes
31b4bbee1e115865a8a3aff6ccf04f6108371c5d Make fe_cmov take max of magnitudes (Pieter Wuille)

Pull request description:

  This addresses part of #1001.

  The magnitude and normalization of the output of `secp256k1_fe_cmov` should not depend on the runtime value of `flag`.

ACKs for top commit:
  real-or-random:
    utACK 31b4bbee1e115865a8a3aff6ccf04f6108371c5d
  stratospher:
    ACK 31b4bbe.

Tree-SHA512: 08bef9f63797cb8a1f3ea63c716c09aaa267dfee285b74ef5fbb47d614569d2787ec73d21bce080214872dfe70246f73cea42ad3c24e6baccecabe3312f71433
2023-05-19 09:55:08 +02:00
Tim Ruffing
5768b50229 build: Enable -DVERIFY for precomputation binaries 2023-05-17 23:28:36 +02:00
Pieter Wuille
31b4bbee1e Make fe_cmov take max of magnitudes 2023-05-15 09:36:55 -04:00
Tim Ruffing
83186db34a
Merge bitcoin-core/secp256k1#1314: release cleanup: bump version after 0.3.2
95448ef2f8a162c06b9cd566ce935164b14c6840 release cleanup: bump version after 0.3.2 (Pieter Wuille)

Pull request description:

ACKs for top commit:
  hebasto:
    ACK 95448ef2f8a162c06b9cd566ce935164b14c6840
  real-or-random:
    ACK 95448ef2f8a162c06b9cd566ce935164b14c6840

Tree-SHA512: 82724afd8c4b3a383a9a6b6db787fe9dd8dabd76df896a5e1d1a90733ef1c6a2fbbd6dd1d82faee359eb98fe3c636fb31ec659d49e70e17c649ded6155b9a71d
2023-05-13 19:55:44 +02:00
Pieter Wuille
95448ef2f8 release cleanup: bump version after 0.3.2 2023-05-13 13:54:32 -04:00
Tim Ruffing
acf5c55ae6
Merge bitcoin-core/secp256k1#1312: release: Prepare for 0.3.2
d490ca2046be118258c6a0617c3461c913d1f208 release: Prepare for 0.3.2 (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK d490ca2046be118258c6a0617c3461c913d1f208
  hebasto:
    ACK d490ca2046be118258c6a0617c3461c913d1f208
  jonasnick:
    ACK d490ca2046be118258c6a0617c3461c913d1f208

Tree-SHA512: 0785e9654974b25977dcdb00fe2e91d79a941143d278e315b96238e18c7aedd5814c2534c0aff356d8d4bb456ff8b815bea3657b99243e0a8296bbe635329cfb
2023-05-13 19:41:35 +02:00
Tim Ruffing
d490ca2046 release: Prepare for 0.3.2 2023-05-12 22:52:30 +02:00
Tim Ruffing
3e3d125b83
Merge bitcoin-core/secp256k1#1309: changelog: Catch up
697e1ccf4af7672d45d5ce61cd7d07764a1c8b90 changelog: Catch up (Tim Ruffing)
76b43f3443a9f87ff924f3d96fa14ec02576126d changelog: Add entry for #1303 (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 697e1ccf4af7672d45d5ce61cd7d07764a1c8b90
  jonasnick:
    ACK 697e1ccf4af7672d45d5ce61cd7d07764a1c8b90

Tree-SHA512: cfeb513effc69925bdedd3a298b1e2e5bf7709f68b453a5f157c584560b5400c3dc8b9ce87a775281cdea9db7f44e7e1337fbc93563f6efe350fe5defacbc4f6
2023-05-12 17:26:29 +02:00
Pieter Wuille
e8295d07ab
Merge bitcoin-core/secp256k1#1311: Revert "Remove unused scratch space from API"
3ad1027a4034da674aeee2a92dfba69b347bbe91 Revert "Remove unused scratch space from API" (Jonas Nick)

Pull request description:

  This reverts commit 712e7f8722eba5dec2bc6b37d75aadeb6f6e633b.

  Removing the scratch space from the API may break bindings to the library.

ACKs for top commit:
  sipa:
    ACK 3ad1027a4034da674aeee2a92dfba69b347bbe91
  real-or-random:
    ACK 3ad1027a4034da674aeee2a92dfba69b347bbe91

Tree-SHA512: ad394c0a2f83fe3a5f400c0e8f2b9bf40037ce4141d4414e6345918f5e6003c61da02a538425a49bdeb5700f5ecb713bd58f5752c0715fb1fcc4950099fdc0e6
2023-05-12 11:14:57 -04:00
Tim Ruffing
697e1ccf4a changelog: Catch up 2023-05-12 17:09:00 +02:00
Jonas Nick
3ad1027a40
Revert "Remove unused scratch space from API"
This reverts commit 712e7f8722eba5dec2bc6b37d75aadeb6f6e633b.
2023-05-12 15:05:57 +00:00
Tim Ruffing
76b43f3443 changelog: Add entry for #1303 2023-05-12 16:44:03 +02:00
Jonas Nick
7d4f86d242
Merge bitcoin-core/secp256k1#1307: Mark more assembly outputs as early clobber
8c9ae37a5a26cdeb6365624fee43f41b238830e4 Add release note (Pieter Wuille)
350b4bd6e6efd3c62875820fdeb2740738937922 Mark stack variables as early clobber for technical correctness (Pieter Wuille)
0c729ba70d963f2798184b0b8524d7de2f3ced9f Bugfix: mark outputs as early clobber in scalar x86_64 asm (Pieter Wuille)

Pull request description:

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

Tree-SHA512: 874d01f5540d14b5188aec25f6441dbc6631f8d3980416040a3e250f1aef75150068415e7a458a9a3fb0d7cbdeb97f5c7e089b187d6d3dd79aa6e45274c241b6
2023-05-12 13:37:09 +00:00
Tim Ruffing
b54a0672ef
Merge bitcoin-core/secp256k1#1304: build: Rename arm to arm32 and check if it's really supported
c6bb29b3037c6b5264f2d2916c5a2d38de25df19 build: Rename `64bit` to `x86_64` (Hennadii Stepanov)
03246457a8f7091e13af13a50d7ae33cf42e08b5 autotools: Add `SECP_ARM32_ASM_CHECK` macro (Hennadii Stepanov)
ed4ba238e2cb2f24301c1add238cf7ff062286c3 cmake: Add `check_arm32_assembly` function (Hennadii Stepanov)
e5cf4bf3ff9aac5b5897a8a9852cfbb84da0bfb1 build: Rename `arm` to `arm32` (Hennadii Stepanov)

Pull request description:

  Closes https://github.com/bitcoin-core/secp256k1/issues/1034.

  Solves one item in https://github.com/bitcoin-core/secp256k1/issues/1235.

ACKs for top commit:
  real-or-random:
    ACK c6bb29b3037c6b5264f2d2916c5a2d38de25df19 tested on x86_64 but not on ARM

Tree-SHA512: c3615a18cfa30bb2cc53be18c09ccab08fc800b84444d8c6b333347b4db039a3981da61e7da5086dd9f4472838d7c031d554be9ddc7c435ba906852bba593982
2023-05-12 14:58:32 +02:00
Hennadii Stepanov
c6bb29b303
build: Rename 64bit to x86_64 2023-05-12 10:50:18 +01:00
Pieter Wuille
8c9ae37a5a Add release note 2023-05-12 05:47:59 -04:00
Hennadii Stepanov
03246457a8
autotools: Add SECP_ARM32_ASM_CHECK macro 2023-05-12 10:38:51 +01:00
Hennadii Stepanov
ed4ba238e2
cmake: Add check_arm32_assembly function 2023-05-12 10:38:50 +01:00
Pieter Wuille
350b4bd6e6 Mark stack variables as early clobber for technical correctness
In the field 5x52 asm for x86_64, stack variables are provided as outputs.
The existing inputs are all forcibly allocated to registers, so cannot
coincide, but mark them as early clobber anyway to make this clearer.
2023-05-12 05:23:11 -04:00
Pieter Wuille
0c729ba70d Bugfix: mark outputs as early clobber in scalar x86_64 asm
In the existing code, the compiler is allowed to allocate the RSI register
for outputs m0, m1, or m2, which are written to before the input in RSI is
read from. Fix this by marking them as early clobber.

Reported by ehoffman2 in https://github.com/bitcoin-core/secp256k1/issues/766
2023-05-12 05:23:07 -04:00
Pieter Wuille
3353d3c753
Merge bitcoin-core/secp256k1#1207: Split fe_set_b32 into reducing and normalizing variants
5b32602295ff7ad9e1973f96b8ee8344b82f4af0 Split fe_set_b32 into reducing and normalizing variants (Pieter Wuille)

Pull request description:

  Follow-up to #1205.

  This splits the `secp256k1_fe_set_b32` function into two variants:
  * `secp256k1_fe_set_b32_mod`, which returns `void`, reduces modulo the curve order, and only promises weakly normalized output.
  * `secp256k1_fe_set_b32_limit`, which returns `int` indicating success/failure, and only promises valid output in case the input is in range (but guarantees it's strongly normalized in this case).

  This removes one of the few cases in the codebase where normalization status depends on runtime values, making it fixed at compile-time instead.

ACKs for top commit:
  real-or-random:
    ACK 5b32602295ff7ad9e1973f96b8ee8344b82f4af0
  jonasnick:
    ACK 5b32602295ff7ad9e1973f96b8ee8344b82f4af0

Tree-SHA512: 4b93502272638c6ecdef4d74afa629e7ee540c0a20b377dccedbe567857b56c4684fad3af4b4293ed7ba35fed4aa5d0beaacdd77a903f44f24e8d87305919b61
2023-05-11 16:06:15 -04:00
Pieter Wuille
5b32602295 Split fe_set_b32 into reducing and normalizing variants 2023-05-11 13:49:33 -04:00
Jonas Nick
006ddc1f42
Merge bitcoin-core/secp256k1#1306: build: Make tests work with external default callbacks
1907f0f1664e3a966daa58be956af18e48834ffd build: Make tests work with external default callbacks (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 1907f0f1664e3a966daa58be956af18e48834ffd
  jonasnick:
    ACK 1907f0f1664e3a966daa58be956af18e48834ffd

Tree-SHA512: 198598f7bf5292bf5709187f9a40ddf9a0fba93e8b62afb49df2c05b4ef61c394cea43ee07615b51ceea97862228d8ad351fddef13c190cb2e6690943ed63128
2023-05-11 17:31:29 +00:00
Tim Ruffing
1907f0f166 build: Make tests work with external default callbacks 2023-05-11 19:08:35 +02:00
Jonas Nick
fb3a806365
Merge bitcoin-core/secp256k1#1133: schnorrsig: Add test vectors for variable-length messages
cd54ac7c1cca509404b62e626a6291f434af88e8 schnorrsig: Improve docs of schnorrsig_sign_custom (Tim Ruffing)
28687b03128fbdd23a3f901297f523dfae2f82e3 schnorrsig: Add BIP340 varlen test vectors (Tim Ruffing)
97a98bed1ed479b1a23d8ae788020d8a6e081cf0 schnorrsig: Refactor test vector code to allow varlen messages (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK cd54ac7c1cca509404b62e626a6291f434af88e8. I didn't verify the included test vectors match the BIP.
  jonasnick:
    ACK cd54ac7c1cca509404b62e626a6291f434af88e8

Tree-SHA512: 268140e239b703aaf79825de2263675a8c31bef999f013ea532b0cd7b80f2d600d78f3872209a93774ba4dbc0a046108e87d151fc4604882c5636876026a0816
2023-05-11 16:44:08 +00:00
Tim Ruffing
cd54ac7c1c schnorrsig: Improve docs of schnorrsig_sign_custom 2023-05-11 18:36:42 +02:00
Tim Ruffing
28687b0312 schnorrsig: Add BIP340 varlen test vectors 2023-05-11 18:36:42 +02:00
Tim Ruffing
97a98bed1e schnorrsig: Refactor test vector code to allow varlen messages 2023-05-11 18:36:42 +02:00
Jonas Nick
ab5a917128
Merge bitcoin-core/secp256k1#1303: ct: Use more volatile
17fa21733aae97bf671fede3ce528c7a3b2f5f14 ct: Be cautious and use volatile trick in more "conditional" paths (Tim Ruffing)
5fb336f9ce7d287015ada5d1d6be35d63469c9a4 ct: Use volatile trick in scalar_cond_negate (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 17fa21733aae97bf671fede3ce528c7a3b2f5f14
  jonasnick:
    ACK 17fa21733aae97bf671fede3ce528c7a3b2f5f14

Tree-SHA512: 4a0fbee7b1cce4f4647bff697c0e645d93aa8fb49777feef5eb1e1eadce2116bafdcc6175c066ee4fe4bf1340047311e2d7d2c48bb288867a837ecd6c8687121
2023-05-11 16:14:44 +00:00
Tim Ruffing
9eb6934f69
Merge bitcoin-core/secp256k1#1305: Remove unused scratch space from API
712e7f8722eba5dec2bc6b37d75aadeb6f6e633b Remove unused scratch space from API (Jonas Nick)

Pull request description:

  Not sure if we want the typedef and `secp256k1_scratch_space_{create,destroy}` but if we don't keep them then this PR will be a rather large diff.

ACKs for top commit:
  sipa:
    ACK 712e7f8722eba5dec2bc6b37d75aadeb6f6e633b
  real-or-random:
    utACK 712e7f8722eba5dec2bc6b37d75aadeb6f6e633b

Tree-SHA512: b3a8feb0fe4639d5e48b708ccbf355bca5da658a291f63899086d2bbeb6d0ab33e3dcd55d8984ec7fa803f757b7d02e71bcb7e7eeecaab52ffc70ae85dce8c44
2023-05-11 18:07:53 +02:00
Jonas Nick
073d98a076
Merge bitcoin-core/secp256k1#1292: refactor: Make 64-bit shift explicit
d1e48e5474a2be29e17a477874a4963f8f612a5a refactor: Make 64-bit shift explicit (Hennadii Stepanov)
b2e29e43d0e5e65c1e1199f86f59689a1e736109 ci: Treat all compiler warnings as errors in "Windows (VS 2022)" task (Hennadii Stepanov)

Pull request description:

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

Tree-SHA512: fd07c8c136b1c947900d45b5a4ad4963e2c29884aca62a26be07713dfd1b0c5e7655f07a0b99217fc055bf3266e71cb5edabbd4d5c145a172b4be5d10f7ad51c
2023-05-11 15:06:47 +00:00
Tim Ruffing
17fa21733a ct: Be cautious and use volatile trick in more "conditional" paths
- secp256k1_scalar_cadd_bit
 - secp256k1_modinvXX_normalize_YY
 - secp256k1_modinvXX_divsteps_ZZ
 - ECMULT_CONST_TABLE_GET_GE

Even though those code loations are not problematic right now
(with current compilers).
2023-05-11 16:32:07 +02:00
Tim Ruffing
5fb336f9ce ct: Use volatile trick in scalar_cond_negate 2023-05-11 16:32:07 +02:00