1870 Commits

Author SHA1 Message Date
Tim Ruffing
b1cb969e8a ci: Revert "Attempt to make macOS builds more reliable"
This reverts commit d9396a56da13df97827e193f636a7593fb4d7864, which
didn't have the desired effect.
2022-02-08 13:53:05 +01:00
Jonas Nick
f0edc90755 musig: fix number of tweaks in tweak_test 2022-02-07 13:56:56 +00:00
Jonas Nick
5dcc6f8dbd
Merge bitcoin-core/secp256k1#1069: build: Replace use of deprecated autoconf macro AC_PROG_CC_C89
e0db3f8a25c20a247a0b49ca00dd6c973b6a16e0 build: Replace use of deprecated autoconf macro AC_PROG_CC_C89 (laanwj)

Pull request description:

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

Tree-SHA512: 00d6719fcdea69d002c795bbed07ccbd69900fef7dcba8ee42aa4e77765034feeb036ac9147b7fccc88b41623f735f62d4c72e25b3a1e68caad08a1237d6c5f5
2022-02-06 20:44:55 +00:00
Jonas Nick
59547943d6
Merge bitcoin-core/secp256k1#1072: ci: Attempt to make macOS builds more reliable
d9396a56da13df97827e193f636a7593fb4d7864 ci: Attempt to make macOS builds more reliable (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK d9396a56da13df97827e193f636a7593fb4d7864

Tree-SHA512: 68df44107d74671de148e9c3e6dbc6b16bec937137d7d9771efce10f5d66459559b372346d05ecc23237b2e3af9479156f733219717cb93f5204f9ea5b2636a9
2022-02-06 19:30:14 +00:00
Jonas Nick
85b00a1c65
Merge bitcoin-core/secp256k1#1068: sage: Fix incompatibility with sage 9.4
ebb1beea7832207e5c8c5112d250fd216259ef41 sage: Ensure that constraints are always fastfracs (Tim Ruffing)
d8d54859ed138a8ed9a8486d847155211c9f4a7d ci: Run sage prover on CI (Tim Ruffing)
77cfa98dbc40f9494048447b8a302867235300da sage: Normalize sign of polynomial factors in prover (Tim Ruffing)
eae75869cfbbbcb69d881bc5d313bd94c6155655 sage: Exit with non-zero status in case of failures (Tim Ruffing)
b54d843eac905993eba2314a89a2d7f155445eaa sage: Fix printing of errors (Tim Ruffing)
e108d0039c36483dffe4be00815c1b6d65ef5751 sage: Fix incompatibility with sage 9.4 (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK ebb1beea7832207e5c8c5112d250fd216259ef41
  jonasnick:
    ACK ebb1beea7832207e5c8c5112d250fd216259ef41

Tree-SHA512: 7a4732fd31d925d3dff471911183acc465ddcadbb5c88c46995502df61a913433c7639cb52fad3db72373b7cc47b9b0f063f7f5d5f8189c9ef998955e409479f
2022-02-05 22:06:29 +00:00
Tim Ruffing
ebb1beea78 sage: Ensure that constraints are always fastfracs
Even if they are constants created in the formula functions. We now
lift integer constants to fastfracs.
2022-02-04 15:39:44 +01:00
Tim Ruffing
d8d54859ed ci: Run sage prover on CI 2022-02-04 15:37:32 +01:00
Tim Ruffing
77cfa98dbc sage: Normalize sign of polynomial factors in prover
The prover, when run on recent sage versions,  failed to prove some of its
goals due to a change in sage. This commit adapts our code accordingly.
The prover passes again after this commit.
2022-02-04 15:37:32 +01:00
Tim Ruffing
eae75869cf sage: Exit with non-zero status in case of failures 2022-02-04 15:37:32 +01:00
Tim Ruffing
d9396a56da ci: Attempt to make macOS builds more reliable
The macOS CI tasks often error fail when doing `brew update` with
git fetch errors:
```
remote: fatal: packfile /data/repositories/b/nw/b6/07/5c/123272362/network.git/objects/pack/pack-2139bd07361b62a358e380a0e7d58ec35593d191.pack cannot be accessed
fatal: protocol error: bad pack header
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!
```
Superficially this seems to be a problem on the GitHub server because
the message shows a "remote" error. But it seems we're the only one in
the world running into this specific issue when doing `brew update`, so
it's more likely that the something else is the culprit, and this error
message is just a symptom.

This commit replaces `brew update` with a complete reinstallation of
brew. This is essentially a shot in the dark but it's worth a try, and
I doubt it's significantly more expensive. If that won't work, we may
consider simply retrying `brew update` a few times.
2022-02-04 10:55:19 +01:00
laanwj
e0db3f8a25 build: Replace use of deprecated autoconf macro AC_PROG_CC_C89
According to [autoconf 2.70](https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Obsolete-Macros.html)
documentation, the `AC_PROG_CC_C89' is replaced by `AC_PROG_CC`, which
defines the same variable `ac_cv_prog_cc_c89`.

Avoids the following message:
```
configure.ac:23: warning: The macro `AC_PROG_CC_C89' is obsolete.
```

Also, remove deprecated `AM_PROG_CC_C_O`.
2022-02-03 08:57:36 +01:00
Peter Dettman
e848c3799c Update sage files for new formulae
- formula_secp256k1_gej_double_var
- formula_secp256k1_gej_add_ge
2022-02-01 17:51:13 +07:00
Peter Dettman
d64bb5d4f3 Add fe_half tests for worst-case inputs
- Add field method _fe_get_bounds
2022-02-01 17:51:05 +07:00
Tim Ruffing
b54d843eac sage: Fix printing of errors
Python 3 often returns iterable map objects where Python 2 returned
list. We can just them down to lists explicitly.

Overlooked in 13c88efed0005eb6745a222963ee74564054eafb.
2022-01-31 15:17:46 +01:00
Jonas Nick
725d895fc5
Merge elementsproject/secp256k1-zkp#165: musig-spec: improve security argument for handling infinity
aa1acb4bd101c83c6977961a62666f92535581e6 musig-spec: improve security argument for handling infinity (Elliott Jin)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK aa1acb4bd101c83c6977961a62666f92535581e6

Tree-SHA512: bea792019462a6de4d3e5f5c60982a1e1b2faa90b047681592a22ac56e872ef8f86f976adb41586bbf8cf86f39cc012dd1d02e58ff8e7226f7d857d9a67d05f6
2022-01-31 14:07:15 +00:00
Peter Dettman
4eb8b932ff Further improve doubling formula using fe_half 2022-01-31 19:41:07 +07:00
Pieter Wuille
557b31fac3 Doubling formula using fe_half 2022-01-31 19:41:07 +07:00
Pieter Wuille
2cbb4b1a42 Run more iterations of run_field_misc
At count=64, this makes the test take around 1% of the total time.
2022-01-31 19:41:07 +07:00
Pieter Wuille
9cc5c257ed Add test for secp256k1_fe_half 2022-01-31 19:41:07 +07:00
Peter Dettman
925f78d55e Add _fe_half and use in _gej_add_ge
- Trades 1 _half for 3 _mul_int and 2 _normalize_weak
- Updated formula and comments in _gej_add_ge
- Added internal benchmark for _fe_half
2022-01-31 19:41:01 +07:00
Tim Ruffing
e108d0039c sage: Fix incompatibility with sage 9.4
`allexprs` is already the product all numerators. Don't take it's
numerator again.

Fixes #1067.
2022-01-31 12:15:16 +01:00
Elliott Jin
aa1acb4bd1 musig-spec: improve security argument for handling infinity
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2022-01-27 05:23:15 -08:00
Jonas Nick
d8a2463246
Merge bitcoin-core/secp256k1#899: Reduce stratch space needed by ecmult_strauss_wnaf.
b797a500ec194948eecbea8bd80f6b7d455f7ca2 Create a SECP256K1_ECMULT_TABLE_VERIFY macro. (Russell O'Connor)
a731200cc30fcf019af08a41f7b6f329a08eaa0c Replace ECMULT_TABLE_GET_GE_STORAGE macro with a function. (Russell O'Connor)
fe34d9f3419d090e94b0c0897895c5b2b9fdc244 Eliminate input_pos state field from ecmult_strauss_wnaf. (Russell O'Connor)
0397d00ba0401bf5be7c4312d84d17fc789a6566 Eliminate na_1 and na_lam state fields from ecmult_strauss_wnaf. (Russell O'Connor)
7ba3ffcca0ae054cf0a1d6407c2dcf7445a46935 Remove the unused pre_a_lam allocations. (Russell O'Connor)
b3b57ad6eedac86bda40f062daee7d5f4241d25c Eliminate the pre_a_lam array from ecmult_strauss_wnaf. (Russell O'Connor)
ae7ba0f922b4c1439888b8488b307cd0f0e8ec59 Remove the unused prej allocations. (Russell O'Connor)
e5c18892db69b5db44d282225ab4fea788af8035 Eliminate the prej array from ecmult_strauss_wnaf. (Russell O'Connor)
c9da1baad125e830901f0ed6ad65eb4f9ccb81f4 Move secp256k1_fe_one to field.h (Russell O'Connor)

Pull request description:

ACKs for top commit:
  sipa:
    ACK b797a500ec194948eecbea8bd80f6b7d455f7ca2
  jonasnick:
    ACK b797a500ec194948eecbea8bd80f6b7d455f7ca2

Tree-SHA512: 6742469979c306104a0861be76c2be86bf8ab14116b00afbd24f91b9e3ea843bf9b9a74552b367bd06ee617090019ad4df6be037d58937c8c869f8b37ddaa6cc
2022-01-26 14:49:40 +00:00
Tim Ruffing
73f0cbd3cc
Merge ElementsProject/secp256k1-zkp#157: Add description of MuSig signing to musig-spec.md
69b392f3cbd4dbff953ec8f2ff44f6a8f612b661 musig: move explanation for aggnonce=inf to spec (Jonas Nick)
4824220bb71102064babf832372f4e5ae43ef16f musig-spec: describe NonceGen, NonceAgg, Sign,PartialSig{Verify,Agg} (Jonas Nick)
3c122d07807dfaea6457d8a48ba4adc7a15f1182 musig-spec: improve definition of lift_x (Jonas Nick)
e0bb2d7009eebe2b25dfe977fe3534ad507251ab musig-spec: improve KeyAgg description (Jonas Nick)
b8f4e75d89071515231be03727d47a34b1c12cab musig-spec: move to doc directory (Jonas Nick)

Pull request description:

  Will wait before adding tweaking until #151 is merged.

ACKs for top commit:
  robot-dreams:
    ACK 69b392f3cbd4dbff953ec8f2ff44f6a8f612b661 based on:
  real-or-random:
    ACK 69b392f3cb I haven't looked at every detail but it's certainly ready to be merged as draft spec

Tree-SHA512: e3aa0265a9d7a7648e03ca42575397100edd5af43f0224937af51aa5c77efc451d7938149bdc711f69e24fb9291438453b8cd762affaa1a2e7bcc89f121485df
2022-01-25 10:55:25 +01:00
Tim Ruffing
8fd97d8116
Merge ElementsProject/secp256k1-zkp#158: Small musig improvements
d895b10c18b8aa19a77f0a80f318e1a2052e7c9b musig: mention musig.md in example (Jonas Nick)
588009d26ffc58864b6e9fc3f1ab2eae633476c3 musig: improve doc of partial_sig_verify regarding signing sessions (Jonas Nick)
b1094953c4497947222df12ef8f9adb2191e2b17 musig: remove superfluous comment (Jonas Nick)

Pull request description:

ACKs for top commit:
  robot-dreams:
    ACK d895b10c18b8aa19a77f0a80f318e1a2052e7c9b
  real-or-random:
    ACK d895b10c18b8aa19a77f0a80f318e1a2052e7c9b

Tree-SHA512: 35169240868500bb27e5a6b8779f090d3f33a6c0cb1a4574e6e53e9c52782f454fe7df6d49b68e0acdd174e25a756bf6267339f0d4e94f28d5ae49145f21e298
2022-01-25 10:53:38 +01:00
Tim Ruffing
772df3694e
Merge ElementsProject/secp256k1-zkp#151: MuSig: Add Minimal Compatibility with BIP32 Tweaking
8088eddc534cbbb89dd5f892828c4013416c4f2b musig: add test vector for ordinary (non xonly) tweaking (Elliott Jin)
57a17929fc0056efb5436a6001597d656591e1ad musig: add ordinary and xonly tweaking to the example (Jonas Nick)
37107361a0ff3b8764903e3b384cfc12ed484e7a musig: allow ordinary, non-xonly tweaking (Jonas Nick)
c519b468791670654f8b66368a675655cd337ae8 musig: add pubkey_get to obtain a full pubkey from a keyagg_cache (Jonas Nick)

Pull request description:

  In short, `musig_pubkey_tweak_add` now allows for xonly _and_ "ordinary" tweaking. Also, in order to allow using `ec_pubkey_tweak_add` on the non-xonly aggregate public key, there's a new function `musig_pubkey_get` that allows obtaining it from the `keyagg_cache`.

  One alternative would be that instead of adding `musig_pubkey_get`, we could change `pubkey_agg` to output an ordinary (non-xonly) pubkey. Then users of the API who do not need ordinary (BIP32) tweaking would be forced to call `xonly_pubkey_from_pubkey`. And we'd probably want to change the spec. And it would be a bit weird to output a pubkey that can't be directly schnorrsig_verify'd.

  Based on #131

ACKs for top commit:
  robot-dreams:
    ACK 8088eddc534cbbb89dd5f892828c4013416c4f2b based on https://github.com/ElementsProject/secp256k1-zkp/pull/151#issuecomment-1005198409 and the following `range-diff`:

Tree-SHA512: a4a0100f0470c870f88a8da27dbcc4684fcc2caabb368d4340e962e08d5ee04634e6289bafa3448dbfd0b5793a3e70de5bd6ddca7a619cc3220ff762d518a8fe
2022-01-25 10:18:40 +01:00
Tim Ruffing
0a40a4861a
Merge bitcoin-core/secp256k1#1049: Faster fixed-input ecmult tests
070e772211b3fcd297577b90b56bbf7a5cfbd0a3 Faster fixed-input ecmult tests (Pieter Wuille)

Pull request description:

  Given how much #920 slowed down the tests with low iteration count, replace it with 3 different similar test:
  * count >= 1: a test with 1024 multiplies that tests any pattern of 6 bits in windows not more than 20 bits wide
  * count >= 3: a test with 2048 multiplies that tests any pattern of 8 consecutive bits
  * count >= 35: the old test (which effectively tests all 2-bit patterns)

ACKs for top commit:
  robot-dreams:
    ACK 070e772211b3fcd297577b90b56bbf7a5cfbd0a3, the addition of the `CONDITIONAL_TEST` macro is nice.
  real-or-random:
    ACK 070e772211b3fcd297577b90b56bbf7a5cfbd0a3

Tree-SHA512: b4ccca42c71fcd1baa7143f73d1c3ac9d012c296485164a03341dbeee02e4ba9f7c7ad6b441923a5fe0286c97eff60815033adb4e1d30b3ef08bcb79590327ff
2022-01-24 22:01:54 +01:00
Jonas Nick
69b392f3cb musig: move explanation for aggnonce=inf to spec 2022-01-24 15:50:42 +00:00
Jonas Nick
4824220bb7 musig-spec: describe NonceGen, NonceAgg, Sign,PartialSig{Verify,Agg} 2022-01-24 15:50:42 +00:00
Jonas Nick
3c122d0780 musig-spec: improve definition of lift_x 2022-01-24 15:50:42 +00:00
Jonas Nick
e0bb2d7009 musig-spec: improve KeyAgg description
It's easier to identify a signer with a public key instead of an index in
KeyAggCoef because it doesn't force the signer to know its index.
2022-01-24 15:50:39 +00:00
Jonas Nick
b8f4e75d89 musig-spec: move to doc directory 2022-01-24 15:45:51 +00:00
Pieter Wuille
070e772211 Faster fixed-input ecmult tests 2022-01-22 18:44:32 -05:00
Pieter Wuille
c8aa516b57
Merge bitcoin-core/secp256k1#1064: Modulo-reduce msg32 inside RFC6979 nonce fn to match spec. Fixes #1063
45f37b650635e46865104f37baed26ef8d2cfb97 Modulo-reduce msg32 inside RFC6979 nonce fn to match spec. Fixes #1063. (Paul Miller)

Pull request description:

ACKs for top commit:
  siv2r:
    ACK 45f37b6. The diff looks good. It reduces `msg32` to modulo curve order for rfc6979 nonce generation. All tests passed on my machine with `make check`.
  sipa:
    utACK 45f37b650635e46865104f37baed26ef8d2cfb97
  real-or-random:
    ACK 45f37b650635e46865104f37baed26ef8d2cfb97

Tree-SHA512: 4c36784b2d6f2983bc0c3f380ff59cd9f2bd1822b98116d70964cd15183742fcc1f2ccde225a76dd30d946b3678b2cf29caff018efc07f40a200ee85843b39dd
2022-01-22 18:38:27 -05:00
Elliott Jin
8088eddc53 musig: add test vector for ordinary (non xonly) tweaking 2022-01-21 17:07:06 +00:00
Jonas Nick
57a17929fc musig: add ordinary and xonly tweaking to the example 2022-01-21 17:07:06 +00:00
Jonas Nick
37107361a0 musig: allow ordinary, non-xonly tweaking 2022-01-21 17:07:06 +00:00
Jonas Nick
c519b46879 musig: add pubkey_get to obtain a full pubkey from a keyagg_cache 2022-01-21 17:07:06 +00:00
Russell O'Connor
b797a500ec Create a SECP256K1_ECMULT_TABLE_VERIFY macro. 2022-01-19 11:51:43 -05:00
Russell O'Connor
a731200cc3 Replace ECMULT_TABLE_GET_GE_STORAGE macro with a function. 2022-01-19 11:51:43 -05:00
Russell O'Connor
fe34d9f341 Eliminate input_pos state field from ecmult_strauss_wnaf. 2022-01-19 11:51:43 -05:00
Russell O'Connor
0397d00ba0 Eliminate na_1 and na_lam state fields from ecmult_strauss_wnaf. 2022-01-19 11:51:43 -05:00
Russell O'Connor
7ba3ffcca0 Remove the unused pre_a_lam allocations. 2022-01-19 11:51:43 -05:00
Russell O'Connor
b3b57ad6ee Eliminate the pre_a_lam array from ecmult_strauss_wnaf. 2022-01-19 11:51:43 -05:00
Russell O'Connor
ae7ba0f922 Remove the unused prej allocations. 2022-01-19 11:51:43 -05:00
Russell O'Connor
e5c18892db Eliminate the prej array from ecmult_strauss_wnaf. 2022-01-19 11:51:42 -05:00
Russell O'Connor
c9da1baad1 Move secp256k1_fe_one to field.h
This makes secp256k1_fe_one part of field.h's interface, and allows other modules to appropriately access the constant.
2022-01-19 09:53:02 -05:00
Paul Miller
45f37b6506
Modulo-reduce msg32 inside RFC6979 nonce fn to match spec. Fixes #1063. 2022-01-17 04:07:16 +02:00
Jonas Nick
a5b5909e8d
Merge elementsproject/secp256k1-zkp#163: Typo, add subscript i
44001ad716a789520550dcdd304daf90abdf58c5 Typo fix, add subscript i (Kalle Rosenbaum)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK 44001ad716a789520550dcdd304daf90abdf58c5

Tree-SHA512: a0d472e8708a467c471be033113bff9f3c6ab5990751173c6150452efdb403f1af8d61314e8358fa817a9a20cbeefd1c33154231a4d1d68ca09ced64dbb8d2b2
2022-01-15 15:12:30 +00:00
Kalle Rosenbaum
44001ad716
Typo fix, add subscript i 2022-01-15 12:31:00 +01:00