Commit Graph
120 Commits
Author SHA1 Message Date
Andrew Poelstra cad7cc8f34 Merge pull request #73 from jonasnick/fix-musig-message
Require message in musig protocol in an earlier state
2019-10-18 20:42:30 +00:00
Jonas Nick 217151df1c Fix ARG_NONNULL macro usage in musig include 2019-08-19 08:35:28 +00:00
Jonas Nick 6ba31b8cee Add cplusplus directive to musig include 2019-08-19 08:29:11 +00:00
Jonas Nick 6a57be09e3 Require message in musig protocol in an earlier state. In particular,
remove the set_msg function and require the message in get_public_nonce
at the latest.
2019-07-09 11:33:13 +00:00
Andrew Poelstra e3a10f4677 Merge pull request #74 from jonasnick/sig_combine_tweak
Add tweak32 parameter to musig_partial_sig_combine
2019-07-03 22:02:15 +00:00
Jonas Nick a0a4b4212c Add tweak32 parameter to musig_partial_sig_combine which allows to sign for p2c/taproot commitments 2019-07-02 18:31:12 +00:00
Tim Ruffing 11af7015de Merge pull request #58 from jonasnick/schnorrsig-fix
Add fixups from upstream schnorrsig PR
2019-06-25 14:31:15 +02:00
Jonas Nick cb8f059724 Add fixups from upstream schnorrsig PR
f make helper functions static
f hash noncedata into nonce in nonce_function_bipschnorr
f expose nonce_function_bipschnorr
f fix undefined behavior when shifting an int 31 places
f add cplusplus ifdef to schnorrsig include file
f hash complete pubkey into batch seed
f chacha20 for bigendians
f add schnorrsig to travis
f show in configure if schnorrsig is enabled
2019-06-25 12:20:06 +00:00
Roman Zeyde 112edb2c6a allow reducing surjection proof size (to lower generation stack usage) 2019-06-04 16:37:48 +00:00
Andrew Poelstra d512d78653 surjectionproof: introduce SECP256K1_SURJECTIONPROOF_MAX_USED_INPUTS constant and set it to 16 2019-06-04 16:37:48 +00:00
Dmitry Petukhov 250ebb364e work in progress: add _allocate_initialized/destroy funcs 2019-05-30 14:08:30 +00:00
Roman Zeyde 865b76186c Fix a small typo in the generator parameter name 2019-05-30 14:08:30 +00:00
Andrew Poelstra ff16651273 musig: add user documentation 2019-05-30 14:08:21 +00:00
Jonas Nick 0ad6b6036f Add 3-of-3 MuSig example 2019-05-30 14:04:38 +00:00
Jonas Nick b61a1a9d98 Add MuSig module which allows creating n-of-n multisignatures and adaptor signatures. 2019-05-30 14:04:38 +00:00
Andrew Poelstra 5d5374f92c Add schnorrsig module which implements BIP-schnorr [0] compatible signing, verification and batch verification.
[0] https://github.com/sipa/bips/blob/bip-schnorr/bip-schnorr.mediawiki
2019-05-30 14:04:38 +00:00
Jonas Nick dec1b9ce27 Add comment to explain effect of max_n_iterations in surjectionproof_init 2019-05-30 14:04:38 +00:00
Andrew Poelstra 972d056fac rangeproof: verify correctness of pedersen commitments when parsing 2019-05-30 14:04:38 +00:00
Andrew Poelstra 2cc4c6fef1 generator: verify correctness of point when parsing 2019-05-30 14:04:38 +00:00
Frank V. Castellucci b387ba0389 Expose generator in shared library
Was failing linking to `*.so` library
2019-05-30 14:04:38 +00:00
Gregory Sanders 8da432855c fix spelling in documentation 2019-05-30 14:04:38 +00:00
Andrew Poelstra a3ad4a8668 generator: add API tests 2019-05-30 14:04:38 +00:00
Jonas Nick 68be611317 Fix pedersen_blind_generator_blind_sum return value documentation 2019-05-30 14:04:38 +00:00
Jonas Nick 51fc58ae6b Add n_keys argument to whitelist_verify 2019-05-30 14:04:38 +00:00
Jonas Nick 36b100c779 Fix checks of whitelist serialize/parse arguments 2019-05-30 14:04:38 +00:00
Andrew Poelstra c8f54e12ec whitelist: fix serialize/parse API to take serialized length 2019-05-30 14:04:38 +00:00
Jonas Nick 56fca50778 Fix include/secp256k1_rangeproof.h function argument documentation. 2019-05-30 14:04:38 +00:00
Andrew Poelstra 4617f04784 rangeproof: add API tests 2019-05-30 14:04:38 +00:00
Andrew Poelstra 94e81a250e add surjection proof module
Includes fix and tests by Jonas Nick.
2019-05-30 14:04:38 +00:00
Andrew Poelstra a66ea35227 Implement ring-signature based whitelist delegation scheme 2019-05-30 14:04:38 +00:00
Andrew Poelstra 2bb5133615 rangeproof: several API changes
* add summing function for blinded generators
* drop `excess` and `gen` from `verify_tally`
* add extra_commit to rangeproof sign and verify
2019-05-30 14:04:38 +00:00
Pieter Wuille 9b00b61d9d Expose generator in pedersen/rangeproof API 2019-05-30 14:04:38 +00:00
Pieter Wuille 54fa2639e1 Constant-time generator module 2019-05-30 14:04:38 +00:00
Andrew Poelstra 023aa86ac0 rangeproof: expose sidechannel message field in the signing API
Including a fix by Jonas Nick.
2019-05-30 14:04:38 +00:00
Andrew Poelstra 89e7451d42 [RANGEPROOF BREAK] Use quadratic residue for tie break and modularity cleanup
Switch to secp256k1_pedersen_commitment by Andrew Poelstra.
Switch to quadratic residue based disambiguation by Pieter Wuille.
2019-05-30 14:04:38 +00:00
Gregory Maxwell f126331bc9 Pedersen commitments, borromean ring signatures, and ZK range proofs.
This commit adds three new cryptosystems to libsecp256k1:

Pedersen commitments are a system for making blinded commitments
 to a value.  Functionally they work like:
  commit_b,v = H(blind_b || value_v),
 except they are additively homorphic, e.g.
  C(b1, v1) - C(b2, v2) = C(b1 - b2, v1 - v2) and
  C(b1, v1) - C(b1, v1) = 0, etc.
 The commitments themselves are EC points, serialized as 33 bytes.
 In addition to the commit function this implementation includes
 utility functions for verifying that a set of commitments sums
 to zero, and for picking blinding factors that sum to zero.
 If the blinding factors are uniformly random, pedersen commitments
 have information theoretic privacy.

Borromean ring signatures are a novel efficient ring signature
 construction for AND/OR admissions policies (the code here implements
 an AND of ORs, each of any size).  This construction requires
 32 bytes of signature per pubkey used plus 32 bytes of constant
 overhead. With these you can construct signatures like "Given pubkeys
 A B C D E F G, the signer knows the discrete logs
 satisifying (A || B) & (C || D || E) & (F || G)".

ZK range proofs allow someone to prove a pedersen commitment is in
 a particular range (e.g. [0..2^64)) without revealing the specific
 value.  The construction here is based on the above borromean
 ring signature and uses a radix-4 encoding and other optimizations
 to maximize efficiency.  It also supports encoding proofs with a
 non-private base-10 exponent and minimum-value to allow trading
 off secrecy for size and speed (or just avoiding wasting space
 keeping data private that was already public due to external
 constraints).

A proof for a 32-bit mantissa takes 2564 bytes, but 2048 bytes of
 this can be used to communicate a private message to a receiver
 who shares a secret random seed with the prover.

Also: get rid of precomputed H tables (Pieter Wuille)
2019-05-30 14:04:38 +00:00
Tim Ruffing 5db782e655 Allow usage of external default callbacks 2019-05-26 22:32:36 +02:00
Andrew Poelstra a7a164f2c6 scratch: rename max_size to size, document that extra will actually be allocated 2019-05-25 23:01:07 +00:00
Andrew Poelstra c2b028a281 scratch space: thread error_callback into all scratch space functions
Use it when checking magic bytes
2019-05-25 22:59:50 +00:00
Tim Ruffing 0522caac8f Explain caller's obligations for preallocated memory 2019-05-25 14:01:09 +02:00
Tim Ruffing 238305fdbb Move _preallocated functions to separate header 2019-05-25 14:01:09 +02:00
Tim Ruffing 695feb6fbd Export _preallocated functions 2019-05-25 14:01:09 +02:00
Tim Ruffing c4fd5dab45 Switch to a single malloc call 2019-05-25 14:01:09 +02:00
Tim Ruffing 6198375218 Make randomization of a non-signing context a noop
Before this commit secp256k1_context_randomize called illegal_callback
when called on a context not initialized for signing. This is not
documented. Moreover, it is not desirable because non-signing contexts
may use randomization in the future.

This commit makes secp256k1_context_randomize a noop in this case. This
is safe because the context cannot be used for signing anyway.

This fixes #573 and it fixes rust-bitcoin/rust-secp256k1#82.
2019-01-27 13:33:52 +01:00
Pieter Wuille 314a61d724 Merge #553: add static context object which has no capabilities
40fde61 prevent attempts to modify `secp256k1_context_no_precomp` (Andrew Poelstra)
ed7c084 add static context object which has no capabilities (Andrew Poelstra)

Pull request description:

Tree-SHA512: a843ed7ba00a00a46eec3146ce428d4b49eb440af766f44d731b1f51553d08de8cc9a0af5ed114d0dfdca6f4bf4a2ede4dbd6a37d6bd818b81630089424a0ba5
2018-11-05 18:25:56 -08:00
Andrew Poelstra ed7c08417a add static context object which has no capabilities 2018-10-04 15:16:34 +00:00
Kirill Fomichev c8fbc3c397 [ECDH API change] Allow pass arbitrary data to hash function 2018-05-17 00:38:58 +03:00
Kirill Fomichev b00be65056 [ECDH API change] Support custom hash function 2018-05-17 00:05:09 +03:00
Andrew Poelstra 6fe50439ae scratch: add stack frame support 2018-04-05 22:49:29 +00:00
Thomas Kerin 1646ace4d5 secp256k1_ec_privkey_negate - fix documentation 2018-02-28 14:10:07 +01:00