2748 Commits

Author SHA1 Message Date
Tim Ruffing
44916ae915
Merge bitcoin-core/secp256k1#1147: ci: print env to allow reproducing the job outside of CI
4e54c03153a307af5cc80c7671ac7eef28138326 ci: print env to allow reproducing the job outside of CI (Jonas Nick)

Pull request description:

  Example output:

  ```
  WERROR_CFLAGS="-Werror -pedantic-errors"  MAKEFLAGS="-j4"  BUILD="check"  ECMULTWINDOW="auto"  ECMULTGENPRECISION="auto"  ASM="no"  WIDEMUL="int64"  WITH_VALGRIND="no"  EXTRAFLAGS=""  EXPERIMENTAL="no"  ECDH="no"  RECOVERY="yes"  SCHNORRSIG="no"  SECP256K1_TEST_ITERS=""  BENCH="yes"  SECP256K1_BENCH_ITERS="2"  CTIMETEST="yes"  EXAMPLES="yes"  WRAPPER_CMD=""  CC="gcc"  AR=""  NM=""  HOST=""  ./ci/cirrus.sh
  ```

ACKs for top commit:
  sipa:
    ACK 4e54c03153a307af5cc80c7671ac7eef28138326
  real-or-random:
    ACK 4e54c03153

Tree-SHA512: b74a8724e72b3de7884e4d93fe933dc5043aec37020672b7997a8faebda3b0cbbba1bca69c344109729261ab4a94e76f4eca0d8773dc101a443fdf9e0d7d54f5
2022-11-14 18:01:49 -05:00
Jonas Nick
c2ee9175e9
Merge bitcoin-core/secp256k1#1146: ci: prevent "-v/--version: not found" irrelevant error
49ae843592650ca02b33c188cf2aff7aa78985d3 ci: mostly prevent "-v/--version: not found" irrelevant error (Jonas Nick)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK 49ae843592650ca02b33c188cf2aff7aa78985d3

Tree-SHA512: 2e048b037826dff372e26103f198e0d490494e7909d17d8632b51f6d9e0629b51bcd0b55b65b2c21d63d522394ccfed481ce126cea165c087df670556bc8ccf6
2022-11-08 13:26:06 +00:00
Jonas Nick
e13fae487e
Merge bitcoin-core/secp256k1#1150: ci: always cat test_env.log
5c9f1a5c3774192f77c97474431bb70a124c7b0c ci: always cat all logs_snippets (Jonas Nick)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK 5c9f1a5c3774192f77c97474431bb70a124c7b0c

Tree-SHA512: fc715c5fc4006d80a4b0c2faa8ef81ed23c4479614945ffa7c96665a3acc38fe956dd6d148bcf97043232ceee055b724ea9490e4ac4142a210e4488fed8dd299
2022-11-08 13:24:29 +00:00
Jonas Nick
a340d9500a ci: add int128_struct tests 2022-11-07 16:55:43 -05:00
Tim Ruffing
dceaa1f579 int128: Tidy #includes of int128.h and int128_impl.h
After this commit, int128.h and int128_impl.h are included as follows:
 - .c files which use int128 include int128_impl.h (after util.h)
 - .h files which use int128 include int128.h (after util.h)

This list is exhaustive. util.h needs to included first because it sets
up necessary #defines.
2022-11-07 16:38:30 -05:00
Russell O'Connor
2914bccbc0 Simulated int128 type. 2022-11-07 16:37:24 -05:00
Tobin C. Harding
6a965b6b98 Remove usage of CHECK from non-test file
Currently CHECK is used only in test and bench mark files except for one
usage in `ecmult_impl.h`.

We would like to move the definition of CHECK out of `util.h` so that
`util.h` no longer has a hard dependency on `stdio.h`.

Done in preparation for moving the definition of `CHECK` as part of an
effort to allow secp256k1 to be compiled to WASM as part of
`rust-secp256k1`.
2022-11-08 07:29:52 +11:00
Jonas Nick
5c9f1a5c37
ci: always cat all logs_snippets 2022-11-07 20:12:33 +00:00
Jonas Nick
49ae843592
ci: mostly prevent "-v/--version: not found" irrelevant error
$CC, $WRAPPER_CMD and valgrind are not necessarily defined
2022-11-02 17:13:21 +00:00
Jonas Nick
4e54c03153
ci: print env to allow reproducing the job outside of CI 2022-11-02 15:57:14 +00:00
Jonas Nick
a43e982bca
Merge bitcoin-core/secp256k1#1144: Cleanup .gitignore file
f5039cb66c9f49d1c78fa59c0e83d0d122292697 Cleanup `.gitignore` file (Hennadii Stepanov)
798727ae1edc1b07257f7a884f8e57021063a089 Revert "Add test logs to gitignore" (Hennadii Stepanov)

Pull request description:

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

Tree-SHA512: 3586329e77958a9bfa06dd84e5b121cd456e93332670d5afc1a6691e165cdfa5a6fd6a61f82be12ec33f2a58b26a13adfedeb177ae1056202e53a530949fc549
2022-11-01 16:32:30 +00:00
Hennadii Stepanov
f5039cb66c
Cleanup .gitignore file
The removed line was introduced for `obj/.gitignore` file. Since the
`obj` directory has been removed, it is not longer required.
2022-10-28 16:30:20 +01:00
Hennadii Stepanov
798727ae1e
Revert "Add test logs to gitignore"
This reverts commit bceefd6547635132ba17f022a52db18f17e00df6.
2022-10-28 16:10:46 +01:00
Jonas Nick
d22774e248
Merge elementsproject/secp256k1-zkp#203: MuSig doc fixes
dd83e72d52da0873e0c1a64c5554efa9000a3454 Add ordinary tweak info (Jesse Posner)
d26100cab266b08fd131503ba8e37d9bf091adbb Exclude nonce_process from pre-processing steps (Jesse Posner)
b7607f93f23a1a342b4fba552598e2a578f50527 Fix reference to xonly_tweak_add (Jesse Posner)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK dd83e72d52da0873e0c1a64c5554efa9000a3454

Tree-SHA512: b5b94e94625e235557d4a0d9973b14ef74be153b6bdd9a0701add9aa8af4a54411344030db2e65aaac701e3e6a0c1f46190f0d760f7314d426d077959271b615
2022-09-02 12:20:12 +00:00
Jesse Posner
dd83e72d52
Add ordinary tweak info 2022-09-01 22:39:34 -07:00
Jesse Posner
d26100cab2
Exclude nonce_process from pre-processing steps 2022-09-01 22:39:22 -07:00
Jesse Posner
b7607f93f2
Fix reference to xonly_tweak_add 2022-09-01 22:38:03 -07:00
Jonas Nick
f7e9a8544f
Merge elementsproject/secp256k1-zkp#201: rangeproof: add secp256k1_rangeproof_max_size function to estimate rangeproof size
6b6ced9839f2576898ba334e7ed2d550a2062b32 rangeproof: add more max_size tests (Jonas Nick)
34876ecb5facfc274580c0549df14e6664c03d82 rangeproof: add more static test vectors (Jonas Nick)
310e5170619b03977d471e9f7461bbaf5b607ca9 rangeproof: add a bunch more testing (Andrew Poelstra)
f1410cb67a2de45f8b1b1c14862656c0ae09ff87 rangeproof: add secp256k1_rangeproof_max_size function to estimate rangeproof size (Andrew Poelstra)

Pull request description:

ACKs for top commit:
  real-or-random:
    tACK 6b6ced9839f2576898ba334e7ed2d550a2062b32
  jonasnick:
    ACK 6b6ced9839f2576898ba334e7ed2d550a2062b32

Tree-SHA512: 421dfb0824f67f3822be729dc7f11e4654a21e32e3a6c5565e09b191ec57710b33a73c3d09c08f1d767d769f0957006ac257eabe00a2f37f88b99377644e8741
2022-08-25 20:21:47 +00:00
Jonas Nick
6b6ced9839 rangeproof: add more max_size tests 2022-08-25 14:26:02 +00:00
Jonas Nick
34876ecb5f rangeproof: add more static test vectors
Fixes #42
2022-08-25 14:26:02 +00:00
Andrew Poelstra
310e517061 rangeproof: add a bunch more testing
Add two new fixed rangeproof vectors; check that various extracted
values are correct; add a test for creating and verifying single-value
proofs.
2022-08-25 14:26:02 +00:00
Andrew Poelstra
f1410cb67a rangeproof: add secp256k1_rangeproof_max_size function to estimate rangeproof size
Provides a method that will give an upper bound on the size of a rangeproof,
given an upper bound on the value to be passed in and an upper bound on the
min_bits parameter.

There is a lot of design freedom here since the actual size of the rangeproof
depends on every parameter passed to rangeproof_sign, including the value to
be proven, often in quite intricate ways. For the sake of simplicity we assume
a nonzero `min_value` and that `exp` will be 0 (the default, and size-maximizing,
choice), and provide an exact value for a proof of the given value and min_bits.
2022-08-25 14:26:00 +00:00
Jonas Nick
c137ddbdff
Merge elementsproject/secp256k1-zkp#200: build: automatically enable module dependencies
171b294a1c7a736c1b93fa194e3af90b625259fa build: improve error message if --enable-experimental is missed (Jonas Nick)
58ab152bb4b6c8b4ab17061e90d61fcbc1be9e6c build: move all output concerning enabled modules at single place (Jonas Nick)
1493113e61eb593a18b8e2328dbe9bc1b82f68d5 build: automatically enable module dependencies (Jonas Nick)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK 171b294a1c7a736c1b93fa194e3af90b625259fa

Tree-SHA512: 644e7d96b02c1f4f0751cf84b268f313cc0bd955ea6eacdeddb932b9ba7990be8e8aca9db8c050fd91a35d0a0173061e40fe8c1bf8bfd03107b86aa1bf85e871
2022-08-22 14:45:42 +00:00
Jonas Nick
0202d839fb
Merge elementsproject/secp256k1-zkp#199: surjectionproof: make sure that n_used_pubkeys > 0 in generate
5ac8fb035e8f0ad012d9f54b49e77b5d1f5e713a surjectionproof: make sure that n_used_pubkeys > 0 in generate (Jonas Nick)

Pull request description:

ACKs for top commit:
  apoelstra:
    utACK 5ac8fb035e8f0ad012d9f54b49e77b5d1f5e713a

Tree-SHA512: 915f7181e69e2c4e1f830d6c2620a2d9b0af4d2ae8a63709b489b01ed9e13ccfeeaedebd4680cf2d927cd473a6ae88602cf29e2fdd116cb597fba6c0ab77720d
2022-08-18 19:54:00 +00:00
Jonas Nick
5ac8fb035e surjectionproof: make sure that n_used_pubkeys > 0 in generate
If the proof was generated with surjectionproof_initialize (as mandated by the
API docs), then n_used_pubkeys can never be 0. Without this commit, compilers
will (rightfully) warn that borromean_s[ring_input_index] is not initialized in
surjectionproof_generate. Therefore, this commit makes sure that n_used_pubkeys
is greater than 0 which ensures that the array is initialized at
ring_input_index.
2022-08-15 20:01:39 +00:00
Andrew Poelstra
7ff446df8b
Merge ElementsProject/secp256k1-zkp#198: rangeproof: add a test for all-zero blinding factors
5a40f3d99bbd879391a3fb3c038a6d49ec01bc03 replace memcmp with secp256k1_memcmp_var throughout the codebase (Andrew Poelstra)
92820d944b52d923dad57b7d5bae5fec48f28ddd rangeproof: add a test for all-zero blinding factors (Andrew Poelstra)

Pull request description:

  I was curious about under what conditions you can create a rangeproof on an "unblinded" commitment which has a zero blinding factor. Apparently the answer is "when you are proving at least 3-bits". In this case rewinding words and you can encode 32 bytes of data. (In fact I believe you can encode up to 128 but I haven't tested that.)

ACKs for top commit:
  real-or-random:
    utACK 5a40f3d99bbd879391a3fb3c038a6d49ec01bc03

Tree-SHA512: bed7f9362d082d2b56668809077d5ddde52280109c992a290d87b55cb70138a08799fcca18cafbb3b3e9efed4349418bf9bb2c0ccedacdce0567e841e6d21e13
2022-08-12 23:55:46 +00:00
Andrew Poelstra
5a40f3d99b replace memcmp with secp256k1_memcmp_var throughout the codebase
memcmp only appears in -zkp-specific modules. Fix those.
2022-08-10 22:14:31 +00:00
Andrew Poelstra
92820d944b rangeproof: add a test for all-zero blinding factors 2022-08-10 22:10:33 +00:00
Jonas Nick
171b294a1c build: improve error message if --enable-experimental is missed 2022-08-10 09:20:26 +00:00
Jonas Nick
58ab152bb4 build: move all output concerning enabled modules at single place 2022-08-10 09:04:47 +00:00
Jonas Nick
1493113e61 build: automatically enable module dependencies 2022-08-10 08:58:29 +00:00
Tim Ruffing
4fd7e1eabd
Merge ElementsProject/secp256k1-zkp#197: fix include paths in all the -zkp modules
347f96d94a6c2840e045510672549897be743101 fix include paths in all the -zkp modules (Andrew Poelstra)

Pull request description:

  This is causing out-of-tree build failures in Elements.

ACKs for top commit:
  real-or-random:
    utACK 347f96d94a6c2840e045510672549897be743101

Tree-SHA512: 7d6211f3b8d5612f95bcb3085c22458e7ceaa79f1ee74e37404cc6d1fdf0fbc02b4443b02623b9b6c1225437c1a1954b6d36a953d52b020ac7913326404894e0
2022-08-05 23:42:10 +02:00
Andrew Poelstra
347f96d94a fix include paths in all the -zkp modules
This is causing out-of-tree build failures in Elements.
2022-08-05 14:56:10 +00:00
Tim Ruffing
41e8704b48 build: Enable some modules by default
We don't enable the ECDSA recovery module, because we don't recommend
ECDSA recovery for new protocols. In particular, the recovery API is
prone to misuse: It invites the caller to forget to check the public
key (and the verification function always returns 1).

In general, we also don't recommend ordinary ECDSA for new protocols.
But disabling the ECDSA functions is not possible because they're not
in a module, and let's be honest: disabling ECDSA would mean to ignore
reality blatantly.
2022-08-03 17:09:54 +02:00
Tim Ruffing
694ce8fb2d
Merge bitcoin-core/secp256k1#1131: readme: Misc improvements
88b00897e7ee8dc9bed878082b2277f12136c154 readme: Fix line break (Tim Ruffing)
78f5296da400db8e1034750d79d8cf6d2fd9b045 readme: Sell "no runtime dependencies" (Tim Ruffing)
ef48f088ad95862b6c52781f7ca71cf8535a9b91 readme: Add IRC channel (Tim Ruffing)

Pull request description:

ACKs for top commit:
  apoelstra:
    utACK 88b00897e7ee8dc9bed878082b2277f12136c154
  sipa:
    ACK 88b00897e7ee8dc9bed878082b2277f12136c154

Tree-SHA512: 174f1596406f98a19059a18cd4fb993102e5ffb8ec29fcc6d03e27f135fcb526b37204b64055b5e4f0a273daab05d395cf335f26241cf3a29a060041c9ef109b
2022-08-02 17:33:21 +02:00
Tim Ruffing
88b00897e7 readme: Fix line break 2022-08-02 10:41:15 +02:00
Tim Ruffing
78f5296da4 readme: Sell "no runtime dependencies" 2022-08-02 10:41:15 +02:00
Tim Ruffing
ef48f088ad readme: Add IRC channel 2022-08-02 10:41:15 +02:00
Tim Ruffing
d1d6e47c17
Merge ElementsProject/secp256k1-zkp#196: surjectionproof: fail to generate proofs when an input equals the output
d1175d265d514bd0c22faaf262d7df362f33af89 surjectionproof: use secp256k1_memcmp_var rather than bare memcmp (Andrew Poelstra)
bf18ff5a8c6295cb7db6e2989aefd6a78df7720f surjectionproof: fix generation to fail when any input == the output (Andrew Poelstra)
4ff6e4274d49cb95ab246b599b274104baf83f9f surjectionproof: add test for existing behavior on input=output proofs (Andrew Poelstra)

Pull request description:

  If any ephemeral input tag equals the ephemeral output tag (i.e. an input asset is exactly equal to the output asset), verification will fail due to an unexpected interaction between our surjectionproof logic and the underlying borromean ring siganture logic. However, our generation code still allows creating proofs like this, "succeeding" in creating bad proofs.

  Since we cannot fix the verification side without hardforking Liquid, fix the generation side to fail in this situation.

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

Tree-SHA512: c15e130de028d6c1f705543fe2774ec23016c71f9d6b38ef0708820a517d156e2126f8369e94f16f9fd1855c29cd907d406f6ea26c95499a9ae1ce0dd92f77b2
2022-08-01 13:25:31 +02:00
Andrew Poelstra
d1175d265d
surjectionproof: use secp256k1_memcmp_var rather than bare memcmp
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2022-07-29 21:04:04 +00:00
Andrew Poelstra
bf18ff5a8c surjectionproof: fix generation to fail when any input == the output
Verification will fail in this case, so don't "succeed" in generating a bad proof.
2022-07-26 17:14:49 +00:00
Andrew Poelstra
4ff6e4274d surjectionproof: add test for existing behavior on input=output proofs 2022-07-26 17:09:36 +00:00
Tim Ruffing
9f8a13dc8e
Merge bitcoin-core/secp256k1#1128: configure: Remove pkgconfig macros again (reintroduced by mismerge)
cabe085bb4371cc61286023ac9f6a8ce3138d7ea configure: Remove pkgconfig macros again (reintroduced by mismerge) (Tim Ruffing)

Pull request description:

  We had removed `PKG_PROG_PKG_CONFIG` in 21b2ebaf74222017f85123deb6f30a33c7678513
  (#1090). But then then the not rebased (!) merge of 2be6ba0fedd0d2d62ba6f346d7ced7abde0d66e4
  (#1084) brought that macro back at another location, without git
  complaining about a conflict.

  Fixes #1127.

ACKs for top commit:
  fanquake:
    ACK cabe085bb4371cc61286023ac9f6a8ce3138d7ea
  hebasto:
    ACK cabe085bb4371cc61286023ac9f6a8ce3138d7ea
  jonasnick:
    ACK cabe085bb4371cc61286023ac9f6a8ce3138d7ea

Tree-SHA512: ba497503db3a11e631b15c4fe875e62d892971c2c708d90b2f6be684e85d164043ea97c13af0452831eef41f3cf8230cd8a9eafa332dc5b5ae18e118b87c3828
2022-07-21 12:06:35 +02:00
Tim Ruffing
cabe085bb4 configure: Remove pkgconfig macros again (reintroduced by mismerge)
We had removed `PKG_PROG_PKG_CONFIG` in 21b2ebaf74222017f85123deb6f30a33c7678513
(#1090). But then then the not rebased (!) merge of 2be6ba0fedd0d2d62ba6f346d7ced7abde0d66e4
(#1084) brought that macro back at another location, without git
complaining about a conflict.

Fixes #1127.
2022-07-21 11:10:05 +02:00
Tim Ruffing
71a206fa5b
Merge ElementsProject/secp256k1-zkp#194: extrakeys: rename swap/swap64 to fix OpenBSD 7.1 compilation
db648478c3cc600dbe42c5badb45a1e1fa217f13 extrakeys: rename swap/swap64 to fix OpenBSD 7.1 compilation (Jon Griffiths)

Pull request description:

  OpenBSD defines swap64 in <endian.h>.

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

Tree-SHA512: a3bf4175918c06457ec941eb029fded98d367c82a352024a9f96919219cc494e40f96e090dc03b73d0d22b99374f0656f27b755a56caebcd5df27efbd978fd56
2022-07-20 21:07:32 +02:00
Jon Griffiths
db648478c3
extrakeys: rename swap/swap64 to fix OpenBSD 7.1 compilation
OpenBSD defines swap64 in <endian.h>.
2022-07-18 12:29:54 +12:00
Jonas Nick
3efeb9da21
Merge bitcoin-core/secp256k1#1121: config: Set preprocessor defaults for ECMULT_* config values
c27ae451440bdaf68bf8aaa60edb1f4b4614d492 config: Remove basic-config.h (Tim Ruffing)
da6514a04a0761f973bb7591a7b41fb235747a3d config: Introduce DEBUG_CONFIG macro for debug output of config (Tim Ruffing)
d0cf55e13a7f0914759fe4f3afd003ff37868269 config: Set preprocessor defaults for ECMULT_* config values (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK c27ae451440bdaf68bf8aaa60edb1f4b4614d492
  hebasto:
    ACK c27ae451440bdaf68bf8aaa60edb1f4b4614d492, I have reviewed the code and it looks correct.
  jonasnick:
    ACK c27ae451440bdaf68bf8aaa60edb1f4b4614d492

Tree-SHA512: 56b0f384bd9f42cf7c903bec08f4807db1415ddf9a06676dfe1e638e4d02431c522ef0422585e85429074e0dbb51da4f400cf53e8f883d6e07122731c57be1e3
2022-07-11 12:14:25 +00:00
Jonas Nick
6a873cc4a9
Merge bitcoin-core/secp256k1#1122: tests: Randomize the context with probability 15/16 instead of 1/4
17065f48ae261c6949dab74a7c197ac13b52eb1b tests: Randomize the context with probability 15/16 instead of 1/4 (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 17065f48ae261c6949dab74a7c197ac13b52eb1b
  jonasnick:
    ACK 17065f48ae261c6949dab74a7c197ac13b52eb1b

Tree-SHA512: 3b7005770007b922a294be610f23da60b0dde74dfd7585d64a2cb04eaa6ec879de8d21a0ade31c1857019a8dd97260fa3aa167ae16fc55027ef280a3e3feaa6d
2022-07-11 11:21:57 +00:00
Tim Ruffing
17065f48ae tests: Randomize the context with probability 15/16 instead of 1/4 2022-07-08 18:45:32 +02:00
Tim Ruffing
c27ae45144 config: Remove basic-config.h
It's unused and thus potentially confusing.
2022-07-07 20:32:18 +02:00