Commit Graph

1940 Commits

Author SHA1 Message Date
Tim Ruffing
c565827c1a Use relative #include paths in ctime_test (as in upstream) 2023-04-21 11:50:34 +02:00
Tim Ruffing
4eca406f4c Use relative #include paths in library (as in upstream) 2023-04-21 11:50:24 +02:00
Jonas Nick
050d9b2912 Merge elementsproject/secp256k1-zkp#226: bppp: align terminology with paper
2c63d17c1e bppp: align terminology with paper (gamma) (Jonas Nick)
dbf2e4d3e1 bppp: align terminology with paper (mu, rho) (Jonas Nick)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK  2c63d17c1e

Tree-SHA512: 494db14717acf95de74ca14cdbd4908b31a2e81562ca18b8e3ddd795d40f60cd8ea8d7472c348da108db7d314d510f7366dc594809cf29c0c044c701c56119cc
2023-04-20 18:54:16 +00:00
Jonas Nick
2c63d17c1e bppp: align terminology with paper (gamma)
e -> gamma
2023-04-19 12:37:47 +00:00
Jonas Nick
dbf2e4d3e1 bppp: align terminology with paper (mu, rho)
q-> mu, r -> rho
2023-04-19 12:37:29 +00:00
Tim Ruffing
f4dd0419aa Merge ElementsProject/secp256k1-zkp#225: sync-upstream: Use --autostash to handle uncommitted changes
13c438cdee sync-upstream: Use --autostash to handle uncommitted changes (Tim Ruffing)

Pull request description:

  This makes it possible to use sync-upstream with uncommitted changes. (This is in particular helpful when working on the script itself.)

  Without this commit, git pull will fail due to the uncommitted changes.

ACKs for top commit:
  apoelstra:
    utACK 13c438cdee

Tree-SHA512: c3a2fce68382bf4e769c64bbdc5666a8f4d9cf6f387e7d8af408e9c3e07b4a875205b7cdae9f647b7127128c13ee58effc0045ac5faf5fba2851b38af40439e8
2023-04-17 11:49:56 +02:00
Tim Ruffing
13c438cdee sync-upstream: Use --autostash to handle uncommitted changes
This makes it possible to use sync-upstream with uncommitted changes. (This
is in particular helpful when working on the script itself.)

Without this commit, git pull will fail due to the uncommitted changes.
2023-04-11 12:25:51 +02:00
Jonas Nick
6ec1ff6040 Merge elementsproject/secp256k1-zkp#224: Backport of "ct: Use volatile "trick" in all fe/scalar cmov implementations"
96f4853850 ct: Use volatile "trick" in all fe/scalar cmov implementations (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 96f4853850

Tree-SHA512: b3524a817ad8787a19dd28fc38523ab0ee2ddb72c5d88dfef566a9baa849b8d6a12df93030ecf97251e078128ec8203478bf98f3e8d9b28cc595ea5e8579c762
2023-04-11 10:15:01 +00:00
Tim Ruffing
96f4853850 ct: Use volatile "trick" in all fe/scalar cmov implementations
Apparently clang 15 is able to compile our cmov code into a branch,
at least for fe_cmov and fe_storage_cmov. This commit makes the
condition volatile in all cmov implementations (except ge but that
one only calls into the fe impls).

This is just a quick fix. We should still look into other methods,
e.g., asm and #457. We should also consider not caring about
constant-time in scalar_low_impl.h

We should also consider testing on very new compilers in nightly CI,
see https://github.com/bitcoin-core/secp256k1/pull/864#issuecomment-769211867
2023-04-11 12:06:09 +02:00
Jonas Nick
1d25608900 Merge elementsproject/secp256k1-zkp#223: musig: Update to BIP v1.0.0-rc.4 (Check pubnonce in NonceGen vectors)
d23c23e24d musig: Update to BIP v1.0.0-rc.4 (Check pubnonce in NonceGen vectors) (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK d23c23e24d

Tree-SHA512: 5edc80a7c60a3699c06a46eaea300cf31478e561afa3d29efb9e1b8220969b3f0503ebd1bf906addde2c7367c4e99e2f62c7ef07198c3925d38194c4eb2e9f76
2023-03-03 21:45:23 +00:00
Tim Ruffing
d23c23e24d musig: Update to BIP v1.0.0-rc.4 (Check pubnonce in NonceGen vectors) 2023-03-03 22:31:28 +01:00
Tim Ruffing
c4862f6869 Merge ElementsProject/secp256k1-zkp#215: musig: include pubkey in secnonce and compare when signing
a1ec2bb67b musig: add test for signing with wrong secnonce for a keypair (Jonas Nick)
bd57a017aa musig: include pubkey in secnonce and compare when signing (Jonas Nick)

Pull request description:

  Builds on #211.

  This PR implements a defense-in-depth measure that is specified in BIP-MuSig2. In fact, it revealed a bug in the `scriptless_atomic_swap` test.

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

Tree-SHA512: dfd54a07c13648e6a7163962bb516cc4ec3a25e4534da2c14a593e2da0f3779eb9b84bfa12ffd94676bb3f6ab86a323e7ec7dee938fd870f36882fee0181ca05
2023-03-03 16:53:29 +01:00
Jonas Nick
a1ec2bb67b musig: add test for signing with wrong secnonce for a keypair 2023-03-03 12:55:00 +00:00
Jonas Nick
bd57a017aa musig: include pubkey in secnonce and compare when signing 2023-03-03 12:55:00 +00:00
Tim Ruffing
4f57024d86 Merge ElementsProject/secp256k1-zkp#211: Update musig module to BIP MuSig2 v1.0.0-rc.3
b43dd83b43 musig: add missing static keyword to function (Jonas Nick)
068e6a036a musig: add test vectors from BIP MuSig (Jonas Nick)
36621d13be musig: update to BIP v1.0.0-rc.2 "Add ''pk'' arg to ''NonceGen''" (Jonas Nick)
d717a4980b musig: update to BIP v0.8 "Switch from X-only to plain pk inputs." (Jonas Nick)
304f1bc96d extrakeys: add pubkey_sort test vectors from BIP MuSig2 (Jonas Nick)
ae89051547 extrakeys: replace xonly_sort with pubkey_sort (Jonas Nick)
98242fcdd9 extrakeys: add secp256k1_pubkey_cmp (Jonas Nick)
73d5b6654d musig: update to BIP v0.7.0 (NonceGen) (Jonas Nick)
060887e9d7 musig: update to BIP v0.5.1 "Rename ordinary tweaking to plain" (Jonas Nick)
cbe2815633 musig: update to BIP v0.4 "Allow the output of NonceAgg to be inf" (Jonas Nick)
206017d67d musig: update to BIP v0.3 (NonceGen) (Jonas Nick)
d800dd55db musig: remove test vectors (Jonas Nick)

Pull request description:

  Version 1.0.0-rc.3 of BIP MuSig2 can be found [here](https://github.com/jonasnick/bips/pull/75). This PR does _not_ implement the following optional features that have been added to BIP MuSig2:

  - variable length messages
  - deterministic signing
  - identifiable aborts

  The PR also does _not_ yet change the `secnonce` structure to also contain the signer's public key (which would also imply changing the seckey argument in `sign` to a keypair). Additionally, we may want to rename some things in the future to be more consistent with the BIP (e.g. keyagg_cache vs. keyagg_ctx, applytweak vs. tweak_add).

ACKs for top commit:
  ariard:
    Light Code Review ACK b43dd83b, mostly looks on how the user API will make sense for Lightning, thanks for the answers!
  real-or-random:
    ACK b43dd83b43

Tree-SHA512: 9b1410951b55a1b0e6590b8c302052996d1fb6d9771765498b4282ff68b44ab0d6add8144c9330217b682ec5a93508b5546099db9a1f2c865f99253010dd76f4
2023-03-02 15:24:50 +01:00
Jonas Nick
8ec6d111c8 Merge elementsproject/secp256k1-zkp#205: Bulletproofs++: Norm argument
d7fb25c8ca Make sure that bppp_log2 isn't called with value 0 (Jonas Nick)
e5a01d12c6 Rename buletproof_pp* to bppp* (sanket1729)
c983186872 transcript: add tests (Jonas Nick)
73edc75528 norm arg: add verification vectors (Jonas Nick)
13ad32e814 norm arg: add tests for zero length and zero vectors (Jonas Nick)
34c4847a6a ci: add bulletproofs (Jonas Nick)
2574516483 Add testcases for bulletproofs++ norm arugment (sanket1729)
46c7391154 Add norm argument verify API (sanket1729)
d9145455bb Add bulletproofs++ norm argument prove API (sanket1729)
8638f0e0ce Add internal BP++ commit API (sanket1729)
412f8f66a0 Add utility functions required in norm argument (sanket1729)
420353d7da Add utilities for log2 (sanket1729)
17417d44f3 Add utilities from uncompressed Bulletproofs PR (sanket1729)
48563c8c79 bulletproofs: add API functionality to generate a large set of generators (Andrew Poelstra)
048f9f8642 bulletproofs: add new empty module (Andrew Poelstra)
6162d577fe generator: cleanups in Pedersen/generator code (Andrew Poelstra)
0a6006989f Revert "Remove unused scalar_sqr" (Andrew Poelstra)
87373f5145 MOVE ONLY: move Pedersen commitment stuff to generator module from rangeproof module (Andrew Poelstra)

Pull request description:

ACKs for top commit:
  Liam-Eagen:
    ACK d7fb25c
  jonasnick:
    ACK d7fb25c8ca

Tree-SHA512: 0a51e2b404ab594e4ce6c4a65a35f6bbf870d718e0a3cdf7ddd085ed37a0e0c0db55dabca8fe9d8b8beb3f7e60280aa46a2951408c18942dd6ad1c9a71bab5cd
2023-02-27 17:37:46 +00:00
Jonas Nick
d7fb25c8ca Make sure that bppp_log2 isn't called with value 0
Author:    Jonas Nick <jonasd.nick@gmail.com>
Date:      Thu Feb 9 21:31:43 2023 +0000
2023-02-13 23:53:36 -08:00
sanket1729
e5a01d12c6 Rename buletproof_pp* to bppp* 2023-02-13 22:16:17 -08:00
Jonas Nick
c983186872 transcript: add tests 2023-02-13 22:15:47 -08:00
Jonas Nick
73edc75528 norm arg: add verification vectors
norm arg: add verify test vector with vector size > 1
2023-02-13 22:15:47 -08:00
Jonas Nick
13ad32e814 norm arg: add tests for zero length and zero vectors 2023-02-13 22:15:47 -08:00
Jonas Nick
34c4847a6a ci: add bulletproofs 2023-02-13 22:15:47 -08:00
sanket1729
2574516483 Add testcases for bulletproofs++ norm arugment 2023-02-13 22:15:47 -08:00
sanket1729
46c7391154 Add norm argument verify API 2023-02-13 22:15:46 -08:00
Jonas Nick
b43dd83b43 musig: add missing static keyword to function 2023-02-13 14:03:51 +00:00
Jonas Nick
068e6a036a musig: add test vectors from BIP MuSig 2023-02-13 14:03:51 +00:00
Jonas Nick
36621d13be musig: update to BIP v1.0.0-rc.2 "Add ''pk'' arg to ''NonceGen''" 2023-02-13 14:03:51 +00:00
Jonas Nick
d717a4980b musig: update to BIP v0.8 "Switch from X-only to plain pk inputs." 2023-02-13 14:03:51 +00:00
Jonas Nick
304f1bc96d extrakeys: add pubkey_sort test vectors from BIP MuSig2 2023-02-13 14:03:51 +00:00
Jonas Nick
ae89051547 extrakeys: replace xonly_sort with pubkey_sort 2023-02-13 14:03:51 +00:00
Jonas Nick
98242fcdd9 extrakeys: add secp256k1_pubkey_cmp 2023-02-13 14:03:51 +00:00
Jonas Nick
73d5b6654d musig: update to BIP v0.7.0 (NonceGen)
- 0.7.0: Change ''NonceGen'' such that output when message is not present is different from when message is present but has length 0.
- 0.6.0: Change order of arguments and serialization of the message in the ''NonceGen'' hash function
2023-02-13 14:03:51 +00:00
Jonas Nick
060887e9d7 musig: update to BIP v0.5.1 "Rename ordinary tweaking to plain" 2023-02-13 14:03:51 +00:00
sanket1729
d9145455bb Add bulletproofs++ norm argument prove API 2023-02-08 13:07:05 -08:00
sanket1729
8638f0e0ce Add internal BP++ commit API 2023-02-08 13:07:05 -08:00
sanket1729
412f8f66a0 Add utility functions required in norm argument 2023-02-08 03:09:11 -08:00
sanket1729
420353d7da Add utilities for log2 2023-02-08 03:09:11 -08:00
sanket1729
17417d44f3 Add utilities from uncompressed Bulletproofs PR
Add a transcript module for doing a generic Fiat Shamir
2023-02-08 03:09:11 -08:00
Andrew Poelstra
48563c8c79 bulletproofs: add API functionality to generate a large set of generators 2023-02-08 03:09:11 -08:00
Andrew Poelstra
048f9f8642 bulletproofs: add new empty module 2023-02-08 03:09:11 -08:00
Andrew Poelstra
6162d577fe generator: cleanups in Pedersen/generator code
Silence a compiler warning about an unitialized use of a scalar in case
the user tries to provide a 0-length list of commitments.

Also ensures that commitments have normalized field elements when they
are loaded into ges.
2023-02-08 03:09:11 -08:00
Andrew Poelstra
0a6006989f Revert "Remove unused scalar_sqr"
This reverts commit 5437e7bdfb.
2023-01-23 10:18:21 -08:00
Andrew Poelstra
87373f5145 MOVE ONLY: move Pedersen commitment stuff to generator module from rangeproof module
You can verify this commit with `git diff --color-moved=zebra`
2023-01-23 10:18:21 -08:00
Jonas Nick
b1f1675375 Merge elementsproject/secp256k1-zkp#214: sync-upstream: Fix $REPRODUCE_COMMAND for "select"
e04c660b11 sync-upstream: Fix $REPRODUCE_COMMAND for "select" (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    utACK e04c660b11

Tree-SHA512: 898b56f5931ef3a8e84546e5d2c0bd1a644cb7492aac4ecf80090edc250663b79b1bf4295a516868960c3a13113272f6fc50744b5daf0c90d5b9d9f561913c0b
2023-01-23 09:40:20 +00:00
Jonas Nick
cbe2815633 musig: update to BIP v0.4 "Allow the output of NonceAgg to be inf" 2023-01-23 09:36:46 +00:00
Jonas Nick
206017d67d musig: update to BIP v0.3 (NonceGen)
- 0.3.0: Hash i - 1 instead of i in NonceGen
- 0.2.0: Change order of arguments in NonceGen hash function
2023-01-23 09:36:45 +00:00
Jonas Nick
d800dd55db musig: remove test vectors
These vectors are superseded by test vectors in BIP MuSig2 which will be added
in a later commit.
2023-01-23 09:36:45 +00:00
Jonas Nick
a58c7d29bd Merge elementsproject/secp256k1-zkp#213: Update macOS image for CI
3b2c675955 Update macOS image for CI (Pieter Wuille)

Pull request description:

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

Tree-SHA512: 21987ea64929f7b43ea9a6f7eaa98bf47345aa03af10c45c0aa7a6e19b3a21c4a5d2aef0f6b99d6ddb4bf97752c8e2cdaeec619d4ef105e5d931790479de8ef5
2023-01-23 09:35:36 +00:00
Tim Ruffing
e04c660b11 sync-upstream: Fix $REPRODUCE_COMMAND for "select" 2023-01-20 17:09:18 +01:00
Pieter Wuille
3b2c675955 Update macOS image for CI 2023-01-20 07:08:50 -08:00