Commit Graph

23 Commits

Author SHA1 Message Date
Russell O'Connor 16a3cc07e8 Generate ecmult_static_pre_g.h
This header contains a static array that replaces the ecmult_context pre_g and pre_g_128 tables.
The gen_ecmult_static_pre_g program generates this header file.
2021-08-20 11:11:26 -04:00
Tim Ruffing b924e1e605 build: Ensure that configure's compile checks default to -O2
Fixes #896.
2021-07-01 19:59:25 +02:00
Tim Ruffing 09b3bb8648 Clean up git tree
This removes the ununsed `obj` directory. It also suggests in the README
to create the "coverage" files in a separate directory and adds the
coverage files to .gitignore.

readme: Improve instructions for coverage reports
2021-05-14 11:37:44 +02:00
Tim Ruffing 8ab24e8dad
Merge #558: Add schnorrsig module which implements BIP-340 compliant signatures
f431b3f28a valgrind_ctime_test: Add schnorrsig_sign (Jonas Nick)
16ffa9d97c schnorrsig: Add taproot test case (Jonas Nick)
8dfd53ee3f schnorrsig: Add benchmark for sign and verify (Jonas Nick)
4e43520026 schnorrsig: Add BIP-340 compatible signing and verification (Jonas Nick)
7332d2db6b schnorrsig: Add BIP-340 nonce function (Jonas Nick)
7a703fd97d schnorrsig: Init empty experimental module (Jonas Nick)
eabd9bc46a Allow initializing tagged sha256 (Jonas Nick)
6fcb5b845d extrakeys: Add keypair_xonly_tweak_add (Jonas Nick)
58254463f9 extrakeys: Add keypair struct with create, pub and pub_xonly (Jonas Nick)
f0010349b8 Separate helper functions for pubkey_create and seckey_tweak_add (Jonas Nick)
910d9c284c extrakeys: Add xonly_pubkey_tweak_add & xonly_pubkey_tweak_add_test (Jonas Nick)
176bfb1110 Separate helper function for ec_pubkey_tweak_add (Jonas Nick)
4cd2ee474d extrakeys: Add xonly_pubkey with serialize, parse and from_pubkey (Jonas Nick)
47e6618e11 extrakeys: Init empty experimental module (Jonas Nick)
3e08b02e2a Make the secp256k1_declassify argument constant (Jonas Nick)

Pull request description:

  This PR implements signing, verification and batch verification as described in [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki) in an experimental module named `schnorrsig`. It includes the test vectors and a benchmarking tool.
  This PR also adds a module `extrakeys` that allows [BIP-341](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki)-style key tweaking.

  (Adding ChaCha20 as a CSPRNG and batch verification was moved to PR #760).

  In order to enable the module run `./configure` with `--enable-experimental --enable-module-schnorrsig`.

  Based on apoelstra's work.

ACKs for top commit:
  gmaxwell:
    ACK f431b3f28a  (exactly matches the previous post-fixup version which I have already reviewed and tested)
  sipa:
    ACK f431b3f28a
  real-or-random:
    ACK f431b3f28a careful code review

Tree-SHA512: e15e849c7bb65cdc5d7b1d6874678e275a71e4514de9d5432ec1700de3ba92aa9f381915813f4729057af152d90eea26aabb976ed297019c5767e59cf0bbc693
2020-09-11 21:25:34 +02:00
Jonas Nick 4e43520026 schnorrsig: Add BIP-340 compatible signing and verification 2020-09-06 19:00:03 +00:00
Jake Rawsthorne bceefd6547
Add test logs to gitignore 2020-09-01 00:35:47 +01:00
Gregory Maxwell 3d2302257f Constant-time behaviour test using valgrind memtest.
Valgrind does bit-level tracking of the "uninitialized" status of memory,
 property tracks memory which is tainted by any uninitialized memory, and
 warns if any branch or array access depends on an uninitialized bit.

That is exactly the verification we need on secret data to test for
 constant-time behaviour. All we need to do is tell valgrind our
 secret key is actually uninitialized memory.

This adds a valgrind_ctime_test which is compiled if valgrind is installed:

Run it with libtool --mode=execute:
$ libtool --mode=execute valgrind ./valgrind_ctime_test
2020-02-24 18:59:30 +00:00
Tony Rizko cb32940df3 Add bench_ecmult to .gitignore 2017-12-30 19:59:17 -08:00
Andrew Poelstra 20b8877be1 Add exhaustive test for group functions on a low-order subgroup
We observe that when changing the b-value in the elliptic curve formula
`y^2 = x^3 + ax + b`, the group law is unchanged. Therefore our functions
for secp256k1 will be correct if and only if they are correct when applied
to the curve defined by `y^2 = x^3 + 4` defined over the same field. This
curve has a point P of order 199.

This commit adds a test which computes the subgroup generated by P and
exhaustively checks that addition of every pair of points gives the correct
result.

Unfortunately we cannot test const-time scalar multiplication by the same
mechanism. The reason is that these ecmult functions both compute a wNAF
representation of the scalar, and this representation is tied to the order
of the group.

Testing with the incomplete version of gej_add_ge (found in 5de4c5dff^)
shows that this detects the incompleteness when adding P - 106P, which
is exactly what we expected since 106 is a cube root of 1 mod 199.
2016-11-25 20:45:29 +00:00
upgradeadvice 70141a85d0 Update .gitignore
Don't ignore everything under build-aux
2016-02-16 16:59:00 -06:00
Pieter Wuille 14727fd9e1 Use correct name in gitignore 2015-08-03 22:40:00 +02:00
Pieter Wuille a5a66c70b6 Add support for custom EC-Schnorr-SHA256 signatures 2015-08-03 20:08:51 +02:00
Andrew Poelstra 91c0ce95ca Add benchmarks for ECDH and const-time multiplication 2015-08-01 10:57:36 -05:00
Thomas Daede fbecc38a89 Add ability to use a statically generated ecmult context.
This vastly shrinks the size of the context required for signing on devices with
memory-mapped Flash.

Tables are generated by the new gen_context tool into a header.
2015-07-13 18:00:03 -07:00
Gregory Maxwell c146b4a446 Add bench_internal to gitignore. 2015-04-22 19:11:19 +00:00
Pavel Janík 6a59012f04 Make git ignore bench_recover when configured with benchmark enabled 2014-12-16 07:43:19 +01:00
Phillip Mienk 8ca6a9c06f Correct .gitignore to correctly account for build-aux. 2014-11-15 19:47:03 -08:00
Pieter Wuille 8f9a307818 Better .gitignore for bench binaries 2014-11-01 06:01:40 -07:00
Cory Fields d40908763a build: add autogen. How was this missing? 2014-06-19 14:56:23 -04:00
Cory Fields 4212f7d7cb packaging: add pkg-config file to gitignore 2014-05-20 21:04:31 -04:00
Cory Fields 78cd96b151 autotools: autotools'ify libsecp256k1 2014-01-17 23:24:12 -05:00
Pieter Wuille a16c3a905b Add obj/ directory 2013-04-11 12:46:39 +02:00
Pieter Wuille f0c89aadc6 Revamp makefile 2013-04-07 01:39:57 +02:00