1146 Commits

Author SHA1 Message Date
Andrew Poelstra
068f03c35b generator: remove CHECK abort calls exposed by public API 2020-07-24 14:59:36 +02:00
Andrew Poelstra
3424cb1fa3 musig: add user documentation 2020-07-24 14:59:36 +02:00
Jonas Nick
13ef445721 Add 3-of-3 MuSig example 2020-07-24 14:59:36 +02:00
Jonas Nick
b86c210747 Add MuSig module which allows creating n-of-n multisignatures and adaptor signatures. 2020-07-24 14:59:36 +02:00
Andrew Poelstra
c59c602dd6 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
2020-07-24 14:59:36 +02:00
Andrew Poelstra
a1f16a0a53 add chacha20 function 2020-07-24 14:50:49 +02:00
Gregory Sanders
3cdc02ef8a use proper types for rangeproof min/max 2020-07-24 14:50:49 +02:00
Andrew Poelstra
cf21c9d715 rangeproof: reduce iteration count in unit tests 2020-07-24 14:50:49 +02:00
Gregory Sanders
0dfb356f95 Enable more builds with rest of experimental flags 2020-07-24 14:50:49 +02:00
Jonas Nick
4c231568fb Add explanation about how BIP32 unhardened derivation can be used to simplify whitelisting 2020-07-24 14:50:49 +02:00
Jonas Nick
f416e039bb Add comment to explain effect of max_n_iterations in surjectionproof_init 2020-07-24 14:50:49 +02:00
Andrew Poelstra
936d62f248 add unit test for generator and pedersen commitment roundtripping 2020-07-24 14:50:48 +02:00
Andrew Poelstra
e06540de8c rangeproof: fix serialization of pedersen commintments 2020-07-24 14:50:48 +02:00
Andrew Poelstra
edb879f578 rangeproof: verify correctness of pedersen commitments when parsing 2020-07-24 14:50:48 +02:00
Andrew Poelstra
fca4c3b62f generator: verify correctness of point when parsing 2020-07-24 14:50:48 +02:00
Andrew Poelstra
c50b218698 rangeproof: check that points deserialize correctly when verifying rangeproof 2020-07-24 14:50:48 +02:00
Andrew Poelstra
c33e597245 rangeproof: add fixed vector test case 2020-07-24 14:50:48 +02:00
Frank V. Castellucci
0c5cb7cd08 Expose generator in shared library
Was failing linking to `*.so` library
2020-07-24 14:50:48 +02:00
Gregory Sanders
dbc49df80c fix spelling in documentation 2020-07-24 14:50:48 +02:00
Tim Ruffing
47be098bac Test for rejection of trailing bytes in range proofs 2020-07-24 14:50:48 +02:00
Tim Ruffing
16aaa4a02c Test for rejection of trailing bytes in surjection proofs 2020-07-24 14:50:48 +02:00
Tim Ruffing
949e994cb3 Reject surjection proofs with trailing garbage 2020-07-24 14:50:48 +02:00
datavetaren
c87618157e Minor bugfix. Wrong length due to NUL character. 2020-07-24 14:50:48 +02:00
Jonas Nick
fc3dc94049 Add whitelisting benchmark 2020-07-24 14:50:48 +02:00
Gregory Sanders
edc7cb6cdd add whitelist_impl.h to include for dist 2020-07-24 14:49:33 +02:00
Andrew Poelstra
4320490e88 generator: add API tests 2020-07-24 14:49:33 +02:00
Andrew Poelstra
126493ef01 generator: remove unnecessary ARG_CHECK from generate() 2020-07-24 14:49:33 +02:00
Gregory Sanders
253f131310 Fix generator makefile
Include test_impl.h
2020-07-24 14:49:33 +02:00
Jonas Nick
3997128ad9 Fix pedersen_blind_generator_blind_sum return value documentation 2020-07-24 14:49:33 +02:00
Jonas Nick
04f4c09111 Add n_keys argument to whitelist_verify 2020-07-24 14:49:33 +02:00
Jonas Nick
dbf3d752a8 Fix checks of whitelist serialize/parse arguments 2020-07-24 14:49:33 +02:00
Andrew Poelstra
29d0d562dc whitelist: fix serialize/parse API to take serialized length 2020-07-24 14:49:33 +02:00
Jonas Nick
660ad39fb3 Fix include/secp256k1_rangeproof.h function argument documentation. 2020-07-24 14:49:33 +02:00
Andrew Poelstra
e13bdf2f23 rangeproof: add API tests 2020-07-24 14:49:33 +02:00
Andrew Poelstra
18c5c62b45 surjectionproof: rename unit test functions to be more consistent with other modules 2020-07-24 14:49:33 +02:00
Andrew Poelstra
5f1ad03d00 surjectionproof: add API unit tests 2020-07-24 14:49:33 +02:00
Andrew Poelstra
f858a4e3d5 surjectionproof: tests_impl.h s/assert/CHECK/g 2020-07-24 14:49:33 +02:00
Andrew Poelstra
002002e735 rangeproof: fix memory leak in unit tests 2020-07-24 14:49:33 +02:00
Andrew Poelstra
ba8b4f53ef add surjection proof module
Includes fix and tests by Jonas Nick.
2020-07-24 14:49:33 +02:00
Andrew Poelstra
8c77fe1590 Implement ring-signature based whitelist delegation scheme 2020-07-24 14:49:33 +02:00
Andrew Poelstra
94425d4a67 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
2020-07-24 14:49:33 +02:00
Pieter Wuille
f6c84a02f3 Expose generator in pedersen/rangeproof API 2020-07-24 14:49:33 +02:00
Pieter Wuille
360e218043 Constant-time generator module 2020-07-24 14:49:33 +02:00
Andrew Poelstra
e7a8a5f638 rangeproof: expose sidechannel message field in the signing API
Including a fix by Jonas Nick.
2020-07-24 14:49:33 +02:00
Andrew Poelstra
a88db4a744 [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.
2020-07-24 14:49:33 +02:00
Gregory Maxwell
16618fcd8d 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)
2020-07-24 14:49:33 +02:00
Greg Maxwell
3cf8f70ba1 Add 64-bit integer utilities 2020-07-24 14:44:53 +02:00
Jonas Nick
2309c7dd4a
Merge #769: Undef HAVE___INT128 in basic-config.h to fix gen_context compilation
22e578bb11fe62d3e8ac05b5278a076bf7f2fa2e Undef HAVE___INT128 in basic-config.h to fix gen_context compilation (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 22e578bb11fe62d3e8ac05b5278a076bf7f2fa2e

Tree-SHA512: 91e11c3feade13923a01c30025b7f01d0cb6d7d88cd7a19d490373d2fb4552f2ca1ab0d9138096268999bcbfd51ef3c9af64ec8ab0dc8ee2fa60be16d2b5af64
2020-07-21 19:12:49 +00:00
Tim Ruffing
22e578bb11 Undef HAVE___INT128 in basic-config.h to fix gen_context compilation
Fixes #768.
2020-07-21 11:09:23 +02:00
Jonas Nick
3f4a5a10e4
Merge #765: remove dead store in ecdsa_signature_parse_der_lax
f00d6575ca0dcca11e085b20afa4d73dc8742ddc remove dead store in ecdsa_signature_parse_der_lax (fanquake)

Pull request description:

ACKs for top commit:
  elichai:
    utACK f00d6575ca0dcca11e085b20afa4d73dc8742ddc, it does look like we don't use that assignment
  jonasnick:
    ACK f00d6575ca0dcca11e085b20afa4d73dc8742ddc

Tree-SHA512: 9aa54c901f299341c309411b0247720f5152a131dd346c19be7ee21865e3a822e8cf91b869e28ef6288adaf31660bc2e18874e304052468a9be6b7027674af30
2020-06-29 08:38:35 +00:00