1893 Commits

Author SHA1 Message Date
Tim Gates
18aadf9d28
docs: fix simple typo, dependecy -> dependency
There is a small typo in src/group_impl.h.

Should read `dependency` rather than `dependecy`.
2020-12-08 21:45:13 +11:00
Jonas Nick
2d9e7175c6
Merge #852: Add sage script for generating scalar_split_lambda constants
329a2e0a3f2d9e936179cbf079773538f95bee33 sage: Add script for generating scalar_split_lambda constants (Tim Ruffing)
f554dfc7088c6ca8d4aff927a51bd889b29dc186 sage: Reorganize files (Tim Ruffing)

Pull request description:

ACKs for top commit:
  sipa:
    ACK 329a2e0a3f2d9e936179cbf079773538f95bee33

Tree-SHA512: d41fe5eba332f48af0b800778aa076925c4e8e95ec21c4371a500ddd6088b6d52961bdb93f7ce2b127e18095667dbb966a0d14191177f0d0e78dfaf55271d5e2
2020-12-07 21:49:32 +00:00
Tim Ruffing
dc6e5c3a5c
Merge #854: Rename msg32 to msghash32 in ecdsa_sign/verify and add explanation
6e85d675aaf9dc17842096f9cbf8cfab216c9331 Rename tweak to tweak32 in public API (Jonas Nick)
f587f04e35719883546afd54cb491ead18eb6fc7 Rename msg32 to msghash32 in ecdsa_sign/verify and add explanation (Jonas Nick)

Pull request description:

  This fixes #307 if there's nothing else that's confusing.

ACKs for top commit:
  real-or-random:
    ACK 6e85d675aaf9dc17842096f9cbf8cfab216c9331 I inspected the diff

Tree-SHA512: 1b0dc9dfffd497058dc39c962a512ed6d7f89218020fef9d2c03aaae1aefbf272b918c4fe6503434b62547714855fe1b8b89f2366f3ae6cde16143207c9e6b86
2020-12-07 22:10:47 +01:00
Jonas Nick
6e85d675aa Rename tweak to tweak32 in public API 2020-12-04 14:16:43 +00:00
Jonas Nick
f587f04e35 Rename msg32 to msghash32 in ecdsa_sign/verify and add explanation 2020-12-04 14:12:38 +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
Tim Ruffing
329a2e0a3f sage: Add script for generating scalar_split_lambda constants 2020-12-03 11:56:09 +01: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
Tim Ruffing
f554dfc708 sage: Reorganize files
* Move curve parameters to separate file
 * Rename main prover script for clarity
2020-11-25 13:50:40 +01: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
Fabien
29a299e373 Run the undefined behaviour sanitizer on Travis
Run UBSAN with both GCC and Clang, on Linux and macOS.
The `halt_on_error=1` option is required to make the build fail if the
sanitizer finds an issue.
2020-10-27 08:45:21 +01:00
Fabien
7506e064d7 Prevent arithmetic on NULL pointer if the scratch space is too small
If the scratch space is too small when calling
`secp256k1_ecmult_strauss_batch()`, the `state.pre_a` allocation will
fail and the pointer will be `NULL`. This causes `state.pre_a_lam` to be
computed from the `NULL` pointer.

It is also possible that the first allocation to fail is for `state.ps`,
which will cause the failure to occur when in
`secp256k1_ecmult_strauss_wnaf()`.

The issue has been detected by UBSAN using Clang 10:
```
CC=clang \
CFLAGS="-fsanitize=undefined -fno-omit-frame-pointer" \
LDFLAGS="-fsanitize=undefined -fno-omit-frame-pointer" \
../configure

UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 make check
```
2020-10-27 08:41:14 +01:00