1344 Commits

Author SHA1 Message Date
Jesse Posner
96c83a83dc Remove repeated schnorr flag from travis config 2021-01-05 16:09:04 -08:00
Andrew Poelstra
d2b6740688
Merge pull request #118 from jonasnick/clarify-rangeproof-rewind
rangeproof: clarify rewind outlen argument
2021-01-05 19:16:09 +00:00
Jonas Nick
41d6963bc1 rangeproof: clarify rewind outlen argument 2021-01-05 13:42:58 +00:00
Tim Ruffing
673e551f4d
Merge #111: Add ECDSA sign-to-contract module
47efb5e39a1bf6330bd3bf6bc4b4416c5ca11878 ecdsa-s2c: add ctime tests (Andrew Poelstra)
396b558273ce88969d4b0abc86e003f7557224f7 ecdsa-s2c: add anti-klepto protocol (Andrew Poelstra)
290dee566e14efa852d4e5437546f6a8ff8bfa1a ecdsa-s2c: add actual sign-to-contract functionality (Andrew Poelstra)
8e46cac5b31c3a3127d33d46466c29e97545cf16 ecdsa-s2c: block in module (Andrew Poelstra)
826bd04b43f823813c633449223595031d5c31f7 add eccommit functionality (Andrew Poelstra)

Pull request description:

  This is a backport and rebase of https://github.com/bitcoin-core/secp256k1/pull/669

ACKs for top commit:
  jonasnick:
    ACK 47efb5e39a1bf6330bd3bf6bc4b4416c5ca11878
  real-or-random:
    ACK 47efb5e39a1bf6330bd3bf6bc4b4416c5ca11878

Tree-SHA512: e1f3ee3985bc77197eb57c03884b5d4a5f8733523bba50e11309f86388471c6265b7241e9856e1b80a88f4c268f2826c0394e26161292aa438b2246a1ad86aa1
2021-01-04 14:56:47 +01:00
Andrew Poelstra
47efb5e39a ecdsa-s2c: add ctime tests 2020-12-21 20:50:19 +00:00
Andrew Poelstra
396b558273 ecdsa-s2c: add anti-klepto protocol
Co-authored-by: Marko Bencun <mbencun+pgp@gmail.com>
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2020-12-21 20:50:19 +00:00
Andrew Poelstra
290dee566e ecdsa-s2c: add actual sign-to-contract functionality
Co-authored-by: Marko Bencun <mbencun+pgp@gmail.com>
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2020-12-21 20:50:17 +00:00
Andrew Poelstra
8e46cac5b3 ecdsa-s2c: block in module
Co-authored-by: Marko Bencun <mbencun+pgp@gmail.com>
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2020-12-21 20:49:41 +00:00
Andrew Poelstra
826bd04b43 add eccommit functionality
Co-authored-by: Marko Bencun <mbencun+pgp@gmail.com>
Co-authored-by: Jonas Nick <jonasd.nick@gmail.com>
2020-12-21 20:49:41 +00:00
Jonas Nick
0129b77767
Merge #113: Upstream PRs #849 #851
f4fa8d226a95e42b252c07edb425c446370e01c0 forbid a test iteration of 0 or less (Andrew Poelstra)
0ce45548813709d828cb3abcc7db4c9ce6e26907 make test count iteration configurable by environment variable (Andrew Poelstra)
13c88efed0005eb6745a222963ee74564054eafb Convert Sage code to Python 3 (as used by Sage >= 9) (Frédéric Chapoton)

Pull request description:

Top commit has no ACKs.

Tree-SHA512: b17847a02843a36630a3c05065e0bda6895e042bbfd045feb2ad64e278a02842a80d66b6416eb3a6768f4b2f6c8f639fb293a537dff90a353624aff737058b8f
2020-12-04 13:49:30 +00:00
Jonas Nick
e1756dfddc Merge commits '3a106966 8f0c6f15 ' into temp-merge-851 2020-12-04 11:50:18 +00:00
Jonas Nick
7093e633b8
Merge pull request #106 from apoelstra/2020-11-reduce-test-rounds
reduce test rounds for rangeproof and surjectionproof
2020-12-03 16:04:38 +00:00
Andrew Poelstra
29f9a7dc62 reduce test rounds for rangeproof and surjectionproof 2020-12-03 15:35:50 +00:00
Jonas Nick
8f0c6f1545
Merge #851: make test count iteration configurable by environment variable
f4fa8d226a95e42b252c07edb425c446370e01c0 forbid a test iteration of 0 or less (Andrew Poelstra)
0ce45548813709d828cb3abcc7db4c9ce6e26907 make test count iteration configurable by environment variable (Andrew Poelstra)

Pull request description:

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

Tree-SHA512: 087771402c8e9536c07446baa7d02da5104d2b691f40c1dd04737329534422d895d3b692f485990d5791af8ccc124305b4f8b19be75e27b6b04cfb2337b28beb
2020-12-01 08:31:13 +00:00
Andrew Poelstra
f4fa8d226a forbid a test iteration of 0 or less 2020-11-30 18:12:31 +00:00
Andrew Poelstra
ff4714e641
Merge pull request #105 from jonasnick/update-musig
MuSig state machine simplifictions, API improvements and taproot tweaking
2020-11-30 16:11:34 +00:00
Jonas Nick
3fb4d6db9c travis: run musig test whenever schnorrsig tests are run
Previously the musig module was not tested under valgrind and not with
sanitizers.
2020-11-30 15:40:09 +00:00
Jonas Nick
b9d91b3ecb musig: add pubkey_tweak_add function to allow taproot tweaking 2020-11-30 15:40:09 +00:00
Andrew Poelstra
0d71b6c61f
Merge pull request #112 from jgriffiths/missed_rename
Update renamed decl missed in e0ced690cff035b61763686cb69b7d06571e23e2
2020-11-27 21:41:08 +00:00
Jon Griffiths
4721bec0ef
Update renamed decl missed in e0ced690cff035b61763686cb69b7d06571e23e2 2020-11-27 13:40:50 +13:00
Andrew Poelstra
ebf57dc2f5
Merge pull request #107 from thomaseizinger/secp256k1-zkp
Remove unused context initializer functions
2020-11-24 02:17:54 +00:00
Thomas Eizinger
4d20713425
Remove unused context initializer functions
Fixes #15.
2020-11-24 10:43:28 +11:00
Jonas Nick
3a106966aa
Merge #849: Convert Sage code to Python 3 (as used by Sage >= 9)
13c88efed0005eb6745a222963ee74564054eafb Convert Sage code to Python 3 (as used by Sage >= 9) (Frédéric Chapoton)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 13c88efed0005eb6745a222963ee74564054eafb

Tree-SHA512: 6b8a32c35554b7e881841c17fe21323035014d25003f14e399f03ec017ea1bae1c68eee18a4d0315fc0f3b40d8252b5c8790f6c355d7d074a8ebc5e1ca832795
2020-11-23 20:15:25 +00:00
Frédéric Chapoton
13c88efed0 Convert Sage code to Python 3 (as used by Sage >= 9)
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2020-11-23 15:56:22 +01:00
Andrew Poelstra
0ce4554881 make test count iteration configurable by environment variable 2020-11-23 01:05:31 +00:00
Jonas Nick
38a8b20991 musig: fix memory leak in musig test 2020-11-13 16:05:37 +00:00
Jonas Nick
5b4eb18ec5 musig: shorten partial nonce byte array from 33 to 32 bytes 2020-11-13 16:05:37 +00:00
Jonas Nick
62f0b2d867 musig: make musig partial nonces byte arrays instead of "pubkeys" 2020-11-13 16:05:37 +00:00
Jonas Nick
73792e4a27 musig: represent a combined_nonce as an xonly_pubkey 2020-11-13 16:05:36 +00:00
Jonas Nick
2117e7466a musig: improve variable naming and be consistent with schnorrsig module
session_initialize -> session_init
msg_is_set -> is_msg_set
is_negated -> pk_parity
nonce_is_negated -> nonce_parity
2020-11-13 16:05:36 +00:00
Jonas Nick
ebc31f1f9d musig: add ARG_CHECKs to functions to help debuggability 2020-11-13 16:05:36 +00:00
Jonas Nick
ac2d0e6697 musig: add magic to session to detect if session is uninitalized 2020-11-13 16:05:36 +00:00
Jonas Nick
29b4bd85d7 musig: simplify state machine by adding explicit round to session struct 2020-11-13 16:05:36 +00:00
Andrew Poelstra
6370bdd537
Merge pull request #104 from jonasnick/temp-merge-835
Upstream PRs  #812 #814 #782 #819 #813 #808 #818 #821 #827 #830 #809 #841 #838 #840 #839 #835
2020-11-09 21:59:22 +00:00
Jonas Nick
e0ced690cf Rename rands64 to testrandi64
This is to make it consistent with upstream changes.
2020-11-05 22:07:30 +00:00
Jonas Nick
b0917f3de1 Merge remote-tracking branch 'upstream/master' into temp-merge-835 2020-11-05 20:21:38 +00:00
Jonas Nick
81052ca411
Merge #103: Merge upstream schnorrsig PR
96b9236c425125f348c15b6629b3a73c8a3062f5 re-enable musig module (Andrew Poelstra)
23900a0d86730f719c52aebba41a1c1cdb9288bd Fix the MuSig module after integrating bip-schnorr updates (Jonas Nick)
f431b3f28ac95a3645ad5a6dc96b878fa30a1de3 valgrind_ctime_test: Add schnorrsig_sign (Jonas Nick)
16ffa9d97cef93f49544b016339c107882f9a1c3 schnorrsig: Add taproot test case (Jonas Nick)
8dfd53ee3fa059562483d1867815f78b9e00d947 schnorrsig: Add benchmark for sign and verify (Jonas Nick)
4e43520026f5bcd182d21f0759bac159ef47bb62 schnorrsig: Add BIP-340 compatible signing and verification (Jonas Nick)
7332d2db6b62fda851f9ed8adbfda187a875b84e schnorrsig: Add BIP-340 nonce function (Jonas Nick)
7a703fd97db0161bae07ef84513ddde6e0d27353 schnorrsig: Init empty experimental module (Jonas Nick)
eabd9bc46a31c0da6db6d88840eadbe9006447b1 Allow initializing tagged sha256 (Jonas Nick)
6fcb5b845d2832ce019d60507033f74426290768 extrakeys: Add keypair_xonly_tweak_add (Jonas Nick)
58254463f9a2e96d893157a341c9953c440fdf60 extrakeys: Add keypair struct with create, pub and pub_xonly (Jonas Nick)
f0010349b876bc6b3f0a6ec6c8bad0b12ca17b51 Separate helper functions for pubkey_create and seckey_tweak_add (Jonas Nick)
910d9c284c33b77774a9316d4524f313357d441c extrakeys: Add xonly_pubkey_tweak_add & xonly_pubkey_tweak_add_test (Jonas Nick)
176bfb1110147b5dca1834ea071acc846fb1cab3 Separate helper function for ec_pubkey_tweak_add (Jonas Nick)
4cd2ee474d178bd1b5602486104db346a7562c67 extrakeys: Add xonly_pubkey with serialize, parse and from_pubkey (Jonas Nick)
47e6618e11813cfabe91f0909ca031f960cb7dd4 extrakeys: Init empty experimental module (Jonas Nick)
3e08b02e2a78f2a1fc457efab665db8ab8085373 Make the secp256k1_declassify argument constant (Jonas Nick)
a11250330b24b3dffdf11d2de5d496397b4e4410 (actually) remove schnorrsig module (Andrew Poelstra)
bac746c55e72abc1cc1ba1e8e6fabb2fea503cfe (temporarily) disable musig module (Andrew Poelstra)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 96b9236c425125f348c15b6629b3a73c8a3062f5

Tree-SHA512: 6801f3b64a0f9b7ac39dec25c2f35793d66483b1e07678521ca82df1b978303d4b3c4693b8d34b2148840b551a4bc530a4e0e726848a6f8fb87bec3eca03d5e6
2020-11-05 08:56:00 +00:00
Pieter Wuille
9e5939d284
Merge #835: Don't use reserved identifiers memczero and benchmark_verify_t
1f4dd0383807bfb7fef884601357b4c629dfb566 Typedef (u)int128_t only when they're not provided by the compiler (Tim Ruffing)
e89278f211a526062745c391d48a7baf782b4b2b Don't use reserved identifiers memczero and benchmark_verify_t (Tim Ruffing)

Pull request description:

  As identified in #829 and #833. Fixes #829.

  Since we touch this anyway, this commit additionally makes the
  identifiers in the benchmark files a little bit more consistent.

  This is necessary before we can merge #833. I preferred a separate PR because it makes it easier to see the results of Travis in #833.

ACKs for top commit:
  sipa:
    utACK 1f4dd0383807bfb7fef884601357b4c629dfb566
  jonasnick:
    ACK 1f4dd0383807bfb7fef884601357b4c629dfb566

Tree-SHA512: c0ec92798f3c94f3ef6ac69b3f0f39a39257a32be9d9a068832cece1ebe64c89848b70e44652fc397004b8b240883ac4bc0c8f95abbe4ba4b028de120e6734bf
2020-11-04 15:29:25 -08:00
Andrew Poelstra
96b9236c42 re-enable musig module 2020-11-04 21:47:09 +00:00
Jonas Nick
23900a0d86 Fix the MuSig module after integrating bip-schnorr updates
1.  using xonly_pubkeys in MuSig for input public keys and the combined
    pk. For that to work we need to store whether the MuSig aggregated point
    has an even y in the session, may need to negate each signers secret
    key and may need to negate each signers public key in
    musig_partial_sig_verify.
2.  using a tagged hash for the message hash.
3.  use !fe_is_odd in place of fe_is_quad_var
2020-11-04 21:47:09 +00:00
Andrew Poelstra
005fe79262 Merge commit '8ab24e8d' into tmp 2020-11-04 21:46:54 +00:00
Andrew Poelstra
a11250330b (actually) remove schnorrsig module 2020-11-04 21:45:18 +00:00
Andrew Poelstra
bac746c55e (temporarily) disable musig module 2020-11-04 21:45:11 +00:00
Jonas Nick
d0a83f7328
Merge #839: Prevent arithmetic on NULL pointer if the scratch space is too small
29a299e373d5f0e326be74c514c7c70ddf50cce1 Run the undefined behaviour sanitizer on Travis (Fabien)
7506e064d791e529d2e57bb52c156deb33b897ef Prevent arithmetic on NULL pointer if the scratch space is too small (Fabien)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 29a299e373d5f0e326be74c514c7c70ddf50cce1. Reviewed the code changes and verified that building with these sanitizer flags catches the existing error, as well as a signed integer overflow if introduced.
  real-or-random:
    ACK 29a299e373d5f0e326be74c514c7c70ddf50cce1 code inspection
  jonasnick:
    utACK 29a299e373d5f0e326be74c514c7c70ddf50cce1

Tree-SHA512: 4d788f12f3d7b48018e884910adb9b530a05d88f504de83dadeab8a22d75da83c05a1518f7317de5f536c4dd243ea7b347b1eaddb2ca1d804c663e41b85db69d
2020-11-04 14:53:04 +00:00
Jonas Nick
903b16aa6c
Merge #840: Return NULL early in context_preallocated_create if flags invalid
ebfa2058e9cc2999dada47d2f1e1e5c0f4bcf619 Return NULL early in context_preallocated_create if flags invalid (Tim Ruffing)

Pull request description:

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

Tree-SHA512: 61310539046e015e5c9e6b5702ac7b542fda854a23915ef5dd549361c8ec6e70aa6d509e02b30fd859b24dfaf2250721bb55270767323d6e94854067b7d7e9a6
2020-10-30 17:48:46 +00:00
Tim Ruffing
1f4dd03838 Typedef (u)int128_t only when they're not provided by the compiler 2020-10-27 20:18:18 +01:00
Tim Ruffing
3967d96bf1
Merge #838: Make autotools check for all the used openssl functions
3734b68200ee37f5eea80f47d611e9b5a65548fe Configure echo if openssl tests are enabled (Elichai Turkel)
e6692778d3f6507eb1325785cdd424073a945ff7 Modify bitcoin_secp.m4's openssl check to call all the functions that we use in the tests/benchmarks. That way linking will fail if those symbols are missing (Elichai Turkel)

Pull request description:

  I added all the openssl functions that we call in `tests.c` and in `bench_verify.c` to the m4 check, that way if any of them are missing it won't enable openssl.
  I also modified it a little to prevent a segmentation fault when running that program (not that it really matters for autotools)

  This should fix #836

ACKs for top commit:
  sipa:
    ACK 3734b68200ee37f5eea80f47d611e9b5a65548fe
  real-or-random:
    ACK 3734b68200ee37f5eea80f47d611e9b5a65548fe

Tree-SHA512: c82aa96a4176061284dfa5fdb87ca874a25aa2e11f75c4ec6d1edebcc8a19e2bc940990f8a5cfa64776fd295b6fd3a140fa2afede29326564504bc8d1a3a6b69
2020-10-27 20:15:33 +01:00
Elichai Turkel
3734b68200
Configure echo if openssl tests are enabled 2020-10-27 16:11:27 +02:00
Tim Ruffing
ebfa2058e9 Return NULL early in context_preallocated_create if flags invalid
If the user passes invalid flags to _context_create, and the default
illegal callback does not abort the program (which is possible), then we
work with the result of malloc(0), which may be undefined behavior. This
violates the promise that a library function won't crash after the
illegal callback has been called.

This commit fixes this issue by returning NULL early in _context_create
in that case.
2020-10-27 15:03:21 +01:00
Jonas Nick
6f54e69f03
Merge #841: Avoids a potentially shortening size_t to int cast in strauss_wnaf_
8893f42438ac75838a9dc7df7e98b29e9a1a085f Avoids a potentially shortening size_t to int cast in strauss_wnaf_ (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 8893f42438ac75838a9dc7df7e98b29e9a1a085f. `np` and `no` shouldn't ever take on negative values.
  jonasnick:
    ACK 8893f42438ac75838a9dc7df7e98b29e9a1a085f
  elichai:
    ACK 8893f42438ac75838a9dc7df7e98b29e9a1a085f

Tree-SHA512: 431a6b88c8db8c8883b35c9bc03c90e37ecd0b06c7ee01c5d83cca4a7f6fc1f3cfbbaa871a4a23374ce4cc5bcfb9502c7f2e2540f9f9db9535e47e48827b6af6
2020-10-27 13:24:33 +00:00