1039 Commits

Author SHA1 Message Date
Andrew Poelstra
9b3ff0309d add a couple missing consts to ecmult_pippenger_wnaf 2018-02-24 17:29:34 +00:00
Gregory Maxwell
cd329dbc3e
Merge #460: [build] Update ax_jni_include_dir.m4 macro
e7daa9b [build] Tweak JNI macro to warn instead of error for JNI not found. (Karl-Johan Alm)
5b22977 [build] Update ax_jni_include_dir.m4 macro to deal with recent versions of macOS (Karl-Johan Alm)

Pull request description:

  Prior to this patch, this macro fails to find a working directory for the JNI headers, and results in compile failure when doing
  ```
  ./configure --enable-experimental --enable-module-ecdh --enable-jni
  ```
  on more recent macOS versions. The relevant commit upstream is [here](http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=commit;h=ab23d25b1f1ae544fffdaa0a94a794798695c672) from the [GNU.org page for the macro](https://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html). The original (identical to the version in this commit) is [here](http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_jni_include_dir.m4).

  The compile failure:
  ```Bash
  $ make
  gcc -I. -g -O2 -Wall -Wextra -Wno-unused-function -c src/gen_context.c -o gen_context.o
  gcc gen_context.o -o gen_context
  ./gen_context
    CC       src/libsecp256k1_la-secp256k1.lo
    CC       src/java/libsecp256k1_jni_la-org_bitcoin_NativeSecp256k1.lo
  In file included from src/java/org_bitcoin_NativeSecp256k1.c:4:
  In file included from src/java/org_bitcoin_NativeSecp256k1.h:2:
  /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Headers/jni.h:45:10: fatal error:
        'jni_md.h' file not found
  #include "jni_md.h"
           ^
  1 error generated.
  make: *** [src/java/libsecp256k1_jni_la-org_bitcoin_NativeSecp256k1.lo] Error 1
  ```

Tree-SHA512: 9a8305b3ed67eba0de728f91cf435857a676ba10507ab8481a3c03b50e1ce0469a3d79e751d0a697018789f21e2aa48b7eccca4d225520a3863fcf23f1fd487a
2018-02-06 23:08:50 +00:00
Gregory Maxwell
7f9c1a1565
Merge #498: tests: Avoid calling fclose(...) with an invalid argument
5aae5b5 Avoid calling fclose(...) with an invalid argument (practicalswift)

Pull request description:

  Avoid calling `fclose(...)` with an invalid argument.

Tree-SHA512: f1a057b8c52089a3af1d9bfe97b751a4003b944d293147855eca452d1766c4ead5701d06f546153e654c9cb07b3fe2bcc4e28c8a54a27263d1e2434be123ca3b
2018-02-06 23:04:51 +00:00
Gregory Maxwell
f99aa8d4d3
Merge #499: tests: Make sure we get the requested number of bytes from /dev/urandom
82a96e4 tests: Make sure we get the requested number of bytes from /dev/urandom (practicalswift)

Pull request description:

  Make sure we get the requested number of bytes from `/dev/urandom`.

Tree-SHA512: 1b035942fd2a6ee2423fb2a2a0a0f294682c51434f86e5c106fb493d77f45aa8070662190aca6441fe389b8cdcc132d432517b8e826be2ac530a1511cd0c8919
2018-02-06 23:00:25 +00:00
Gregory Maxwell
b549d3d5f7
Merge #472: [build] Set --enable-jni to no by default instead of auto.
57752d2 [build] Set --enable-jni to no by default instead of auto. (Karl-Johan Alm)

Pull request description:

  Having `--enable-jni` be `auto` doesn't make a lot of sense, and results in things like https://github.com/bitcoin/bitcoin/pull/11056.

Tree-SHA512: 27d6ea041f5d6e249857869ab87b8f7b1f6d18ec5ec82d2c46e692cd690b9f5c5857886725901a29d3539d427d8b6154d0c7909cfa2ce30bb3d4460c05708386
2018-02-06 22:54:03 +00:00
Gregory Maxwell
d333521516
Merge #494: Support OpenSSL versions >= 1.1 for ENABLE_OPENSSL_TESTS
31abd3a Support OpenSSL versions >= 1.1 for ENABLE_OPENSSL_TESTS (Alexander Block)

Pull request description:

  The only reason OpenSSL 1.1 was not supported was the removal of direct
  access to r and s in ECDSA_SIG. This commit adds a simplified version of
  ECDSA_SIG_get0 for < 1.1 that can be used like ECDSA_SIG_get0 in >= 1.1

Tree-SHA512: 7ee49cd8424086bb96968c632b5babce50af98e13c414c4d5028a30fb86896956f829415a92c66387cde57941ab6999b0db823752cb36dd8932d15dd32980763
2018-02-06 22:49:16 +00:00
Gregory Maxwell
2ef8ea5d21
Merge #495: Add bench_ecmult to .gitignore
cb32940 Add bench_ecmult to .gitignore (Tony Rizko)

Pull request description:

Tree-SHA512: d346d3e99c9bd34a29741652e0f961dfdfce2c97aa8b26744a631a4eebfdf58afa127252b8a1c0772a89db74d1e26f55037794e9c2ab697511a66bffb5991909
2018-02-06 22:30:09 +00:00
practicalswift
82a96e4587 tests: Make sure we get the requested number of bytes from /dev/urandom 2018-01-12 11:24:43 +01:00
practicalswift
5aae5b5bb2 Avoid calling fclose(...) with an invalid argument 2018-01-12 11:18:25 +01:00
Tony Rizko
cb32940df3 Add bench_ecmult to .gitignore 2017-12-30 19:59:17 -08:00
Alexander Block
31abd3ab8d Support OpenSSL versions >= 1.1 for ENABLE_OPENSSL_TESTS
The only reason OpenSSL 1.1 was not supported was the removal of direct
access to r and s in ECDSA_SIG. This commit adds a simplified version of
ECDSA_SIG_get0 for < 1.1 that can be used like ECDSA_SIG_get0 in >= 1.1
2017-12-28 11:36:24 +01:00
Pieter Wuille
c95f6f1360
Merge #487: fix tests typo, s/changed/unchanged
0e96cdc fix typo, s/changed/unchanged (Daniel Cousens)

Pull request description:

Tree-SHA512: 023f04d3743318123977d1c4600d664e2b7578ad973db54b9e65629344be087949540b3450ba467de33d319738304a46aa4caae084cfe387fdf87ed8242ac9ce
2017-12-21 14:29:57 -08:00
Pieter Wuille
fb46c83881
Merge #463: Reduce usage of hardcoded size constants
c7680e5 Reduce usage of hardcoded size constants (Thomas Snider)

Pull request description:

  In particular the usage of keylen in nonce_function_rfc6979 seemed precarious - in one conditional it was unconditionally set, then in the next it was added to.  While it was clearly correct as written, I think this change makes it easier to reason about for new eyes and more resistant to breakage if there is any future change to what gets fed into the PRNG.

Tree-SHA512: 2241c183acc0f318f85a11ccff7fe28de7777bc53dea93ab8308bad15871047a268c6a2b36f77a599dce536fca48ab305ea746223840bc10953c893daffa0a50
2017-12-21 14:10:50 -08:00
Pieter Wuille
02f5001dfc
Merge #490: Disambiguate bench functions and types
1f46d60 Disambiguate bench functions and types (Pieter Wuille)

Pull request description:

  This fixes a Travis failure.

Tree-SHA512: ff601507c0bf286e29d202f3a4419977e394416e200c86848417040c79aad683399f6be1cc90b18842f4f7f2d928ef6f7562c1372bd4d4a258705819149972b2
2017-12-21 14:06:44 -08:00
Pieter Wuille
1f46d6089e Disambiguate bench functions and types 2017-12-18 18:22:09 -08:00
Pieter Wuille
f54c6c5083
Merge #480: Enable benchmark building by default
7a78f60 Print whether we're building benchmarks (Pieter Wuille)
4afec9f Build benchmarks by default (Pieter Wuille)

Pull request description:

  Building benchmarks is fast, and I have on more than one occasion forgotten to pass `--enable-benchmark`, resulting in accidentally benchmarking a former build.

  Build them by default.

Tree-SHA512: ce9096e42d9c19b63644f6b7ae153e92f9a37c3727f380329dfa332ce22a5e43151f1525979bd3516dd12f568e5e389b0acda2c383fca0e80c3cadc1d9b1d55a
2017-12-18 14:39:37 -08:00
Pieter Wuille
c77fc08597
Merge #486: Add pippenger_wnaf for multi-multiplication
d2f9c6b Use more precise pippenger bucket windows (Jonas Nick)
4c950bb Save some additions per window in _pippenger_wnaf (Peter Dettman)
a58f543 Add flags for choosing algorithm in ecmult_multi benchmark (Jonas Nick)
36b22c9 Use scratch space dependent batching in ecmult_multi (Jonas Nick)
355a38f Add pippenger_wnaf ecmult_multi (Jonas Nick)
bc65aa7 Add bench_ecmult (Pieter Wuille)
dba5471 Add ecmult_multi tests (Andrew Poelstra)
8c1c831 Generalize Strauss to support multiple points (Pieter Wuille)
548de42 add resizeable scratch space API (Andrew Poelstra)

Pull request description:

  This PR is based on #473 and adds a variant of "Pippengers algorithm" (see [Bernstein et al., Faster batch forgery identification](https://eprint.iacr.org/2012/549.pdf), page 15 and https://github.com/scipr-lab/libff/pull/10) for point multi-multiplication that performs better with a large number of points than Strauss' algorithm.

  ![aggsig](https://user-images.githubusercontent.com/2582071/32731185-12c0f108-c881-11e7-83c7-c2432b5fadf5.png)

  Thanks to @sipa for providing `wnaf_fixed`, benchmarking, and the crucial suggestion to use affine addition.

  The PR also makes `ecmult_multi` decide which algorithm to use, based on the number of points and the available scratch space.
  For restricted scratch spaces this can be further optimized in the future (f.e. a 35kB scratch space allows batches of 11 points with strauss or 95 points with pippenger; choosing pippenger would be 5% faster).

  As soon as this PR has received some feedback I'll repeat the benchmarks to determine the optimal `pippenger_bucket_window` with the new benchmarking code in #473.

Tree-SHA512: 8e155107a00d35f412300275803f912b1d228b7adff578bc4754c5b29641100b51b9d37f989316b636f7144e6b199febe7de302a44f498bbfd8d463bdbe31a5c
2017-12-07 17:59:33 -08:00
Jonas Nick
d2f9c6b5dc Use more precise pippenger bucket windows 2017-12-07 20:13:04 +00:00
Peter Dettman
4c950bbeaf Save some additions per window in _pippenger_wnaf 2017-12-07 20:13:04 +00:00
Jonas Nick
a58f543f5a Add flags for choosing algorithm in ecmult_multi benchmark 2017-12-07 20:13:04 +00:00
Jonas Nick
36b22c9337 Use scratch space dependent batching in ecmult_multi 2017-12-07 20:13:04 +00:00
Jonas Nick
355a38f113 Add pippenger_wnaf ecmult_multi 2017-12-07 20:13:04 +00:00
Pieter Wuille
bc65aa794e Add bench_ecmult 2017-12-07 20:13:04 +00:00
Andrew Poelstra
dba5471b69 Add ecmult_multi tests 2017-12-07 20:13:04 +00:00
Pieter Wuille
8c1c831bdb Generalize Strauss to support multiple points
API by Andrew Poelstra.
2017-12-07 20:13:04 +00:00
Andrew Poelstra
548de42ecf add resizeable scratch space API
Alignment support by Pieter Wuille.
2017-12-07 20:13:04 +00:00
Daniel Cousens
0e96cdc6b6
fix typo, s/changed/unchanged 2017-11-29 12:32:01 +11:00
Thomas Snider
c7680e570f Reduce usage of hardcoded size constants 2017-11-16 13:09:05 -08:00
Pieter Wuille
6ad5cdb42a
Merge #479: Get rid of reserved _t in type names
d1dc9df Get rid of reserved _t in type names (Pieter Wuille)

Pull request description:

Tree-SHA512: 5da4a2cb15106c47fbe14346562444eff322a5e4e2386af8b0b879b72e22f08d704ac09746d6a22ff76e8892fc20208932b2a45d01de0e2e089686dabe45e633
2017-11-08 15:35:45 -08:00
Pieter Wuille
7a78f60598 Print whether we're building benchmarks 2017-09-27 17:25:12 -07:00
Pieter Wuille
4afec9f1ae Build benchmarks by default 2017-09-27 17:25:12 -07:00
Pieter Wuille
d1dc9dfc0a Get rid of reserved _t in type names 2017-09-27 15:03:20 -07:00
Pieter Wuille
0b70241850
Merge #474: Fix header guards using reserved identifiers
abe2d3e Fix header guards using reserved identifiers (Dan Raviv)

Pull request description:

  Identifiers starting with an underscore and followed immediately by a capital letter are reserved by the C++ standard.

  The only header guards not fixed are those in the headers auto-generated from java.

Tree-SHA512: da31b8d718b3c3ffb81b3d12c93ce2d56c176f19a1936776c843fee069dbaa916946556cea16db34e1f977a937924d72c870230ac26e44386706ecd7cb25ba65
2017-09-27 14:56:01 -07:00
Pieter Wuille
ab1f89f00a
Merge #478: Fixed multiple typos
8c7ea22 Fixed multiple typos (Dimitris Tsapakidis)

Pull request description:

  Forward port of fixes introduced in https://github.com/bitcoin/bitcoin/pull/10633 by @dimitris-t.

Tree-SHA512: a979b3e14bf2660cb0fcd809854654bd0f6277399afe948917be6c061a04835d404e590dc58bcb4a9e2ccfbfb38de944cbdba349092465f637606d3bee49fc16
2017-09-24 18:55:31 -07:00
Dimitris Tsapakidis
8c7ea22d54 Fixed multiple typos 2017-09-24 17:53:13 -07:00
Dan Raviv
abe2d3e84b Fix header guards using reserved identifiers
Identifiers starting with an underscore and followed immediately by a capital letter are reserved by the C++ standard.

The only header guards not fixed are those in the headers auto-generated from java.
2017-08-26 18:44:21 +03:00
Karl-Johan Alm
57752d28b3
[build] Set --enable-jni to no by default instead of auto. 2017-08-17 17:10:57 +09:00
Pieter Wuille
f532bdc9f7
Merge #459: Add pubkey prefix constants to include/secp256k1.h
bc61b91 add pubkey prefix constants to include/secp256k1.h (Andrew Poelstra)

Pull request description:

  In future multisig implementations we will need to pass nonces around, which are algebraically pubkeys but should not be decodable as pubkeys. The way to do this is to change the prefix byte from the ordinary 0x02/0x03 to something else. However, some forks (notably `secp256k1-zkp`) have started using some bytes for their own encodings, and if we continue to use hardcoded constants the risk of conflict is increased.

  This commit puts the prefixes used by the main library into the `include/secp256k1.h` so that the constants we're using will at least be in a standard easy-to-reference place.

Tree-SHA512: 37fa25be5074b7c519a9c69421320a62f32a3818f144254eb57f96c6657b993fc01962a5c670574275d1c59b095a6c89e60736123f032d6736907284eac526d7
2017-08-10 16:42:01 -07:00
Pieter Wuille
cac7c5559d
Merge #470: Fix wnaf_const documentation
768514b Fix wnaf_const documentation with respect to return value and number of words set (Jonas Nick)

Pull request description:

Tree-SHA512: e2e49036c5930c74fff12626957a43000e5f86180791f2b857d279e83c609663ee5cbee4c3380f3df3d29e493f40051d63a8eff1badeea99e06652d9e72f4d29
2017-08-10 16:36:34 -07:00
Jonas Nick
768514bac0 Fix wnaf_const documentation with respect to return value and number of words set 2017-08-09 10:54:30 +02:00
Pieter Wuille
b8c26a3990
Merge #458: Fix typo in API documentation
b0452e6 Fix typo in API documentation (Tim Ruffing)

Pull request description:

Tree-SHA512: 0376756fc36004e9bb205c6b811e8b28ecd595db1fc2b577bf27c5c227d81ec8bca2e44cfab91fb76c9640d0f7c99970ce9ab94d72e26289cc8faeb747337309
2017-07-31 00:44:40 -07:00
Pieter Wuille
817fb2013a
Merge #440: Fix typos
4c0f32e Fix typo: "Agressive" → "Aggressive" (practicalswift)
73aca83 Fix typo: "exectured" → "executed" (practicalswift)

Pull request description:

Tree-SHA512: 1dbb47789489aec4c133b049ccd007b67d719fe1e2500ba4c6242274a3b537027ceb17a311fca5e0e0324f0ecd48a53e84c0f51514f00fa7ef533ab3e6c87bd3
2017-07-31 00:41:37 -07:00
Pieter Wuille
12230f90ed
Merge #468: Remove redundant conditional expression
2e1ccdc Remove redundant conditional expression (Dag Robole)

Pull request description:

Tree-SHA512: 999ed3d9d805ec48a92a17554097fcd9d62c2fe859346d381d3a7b38b767e45f57df6cd71eb6dddbea343e4e180c844900fed37d88d21f5a851bd044212aff2e
2017-07-31 00:38:07 -07:00
Dag Robole
2e1ccdca0d Remove redundant conditional expression 2017-07-13 18:00:03 +02:00
Karl-Johan Alm
e7daa9b3c2
[build] Tweak JNI macro to warn instead of error for JNI not found. 2017-07-06 18:06:51 +09:00
Karl-Johan Alm
5b22977922
[build] Update ax_jni_include_dir.m4 macro to deal with recent versions of macOS 2017-07-06 18:04:52 +09:00
Andrew Poelstra
bc61b91aca
add pubkey prefix constants to include/secp256k1.h 2017-06-27 14:05:26 +00:00
Tim Ruffing
b0452e664b Fix typo in API documentation 2017-06-05 19:17:53 +02:00
Pieter Wuille
84973d393a
Merge #454: Remove residual parts from the schnorr expirement.
5e95bf2 Remove residual parts from the schnorr expirement. (Gregory Maxwell)

Tree-SHA512: de1e56cc54443e29a60787996a1b1381b0b84eacb87a8f1af06b5ba3900b1771c3a04fd547c65e21979e3c08c3a45d258d699eb951a956f8e617833c5396ecfe
2017-05-05 11:12:00 -07:00
Gregory Maxwell
5e95bf2285 Remove residual parts from the schnorr expirement. 2017-05-03 11:13:28 +00:00