532 Commits

Author SHA1 Message Date
Jonas Nick
6dbb007869 Increase sparsity of pippenger fixed window naf representation 2018-03-01 18:20:36 +00:00
Andrew Poelstra
9b3ff0309d add a couple missing consts to ecmult_pippenger_wnaf 2018-02-24 17:29:34 +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
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
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
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
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
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
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
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
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
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
Dag Robole
2e1ccdca0d Remove redundant conditional expression 2017-07-13 18:00:03 +02:00
Andrew Poelstra
bc61b91aca
add pubkey prefix constants to include/secp256k1.h 2017-06-27 14:05:26 +00:00
Gregory Maxwell
5e95bf2285 Remove residual parts from the schnorr expirement. 2017-05-03 11:13:28 +00:00
Pieter Wuille
cbc20b8c34
Merge #452: Minor optimizations to _scalar_inverse to save 4M
465159c Further shorten the addition chain for scalar inversion. (Brian Smith)
cf12fa1 Minor optimizations to _scalar_inverse to save 4M (Peter Dettman)

Tree-SHA512: b03ae53bd48435f8ef8a89ba3b45f9a35f3f3c6cfba7deb6820ab2146205656d198e4317a4cb98a986f434df244ae735313d303d0ce5a5c40519d37621238957
2017-04-26 16:57:46 -07:00
Brian Smith
465159c278 Further shorten the addition chain for scalar inversion.
Reduce the number of squarings by one and reduce the number of
multiplications by three.
2017-04-24 21:07:58 -10:00
Gregory Maxwell
a2b6b1914f Fix benchmark print_number infinite loop. 2017-04-24 06:02:36 +00:00
Gregory Maxwell
8b7680a826 Unroll secp256k1_fe_(get|set)_b32 for 10x26.
field_get_b32: min 0.890us / avg 0.905us / max 0.956us
field_set_b32: min 1.12us / avg 1.15us / max 1.19us

becomes

field_get_b32: min 0us / avg 0.000000119us / max 0.000000238us
field_set_b32: min 0.0532us / avg 0.0584us / max 0.0782us
2017-04-24 00:01:14 +00:00
CryptoGuru
aa8499080e Unroll secp256k1_fe_(get|set)_b32 for 5x52.
field_get_b32: min 0.647us / avg 0.666us / max 0.751us
field_set_b32: min 0.551us / avg 0.571us / max 0.624us

becomes

field_get_b32: min 0us / avg 0.0000000477us / max 0.000000238us
field_set_b32: min 0us / avg 0.0000000238us / max 0.000000238us

(Patch from https://bitcointalk.org/index.php?topic=1740973.0
 _get was reversed from the patch because this order appeared
 somewhat faster in testing.)

Signed-off-by: Gregory Maxwell <greg@xiph.org>
2017-04-24 00:01:14 +00:00
Peter Dettman
cf12fa13cb Minor optimizations to _scalar_inverse to save 4M
- Precalculate x^5 and use for "01010" patterns during accumulation. (net -2M)
- Further use of x^5 to allow shorter addition chain (net -2M)
2017-04-18 11:55:07 +07:00
Pieter Wuille
119949232a
Merge #408: Add secp256k1_ec_pubkey_negate and secp256k1_ec_privkey_negate
8e48aa6 Add `secp256k1_ec_pubkey_negate` and `secp256k1_ec_privkey_negate` (Andrew Poelstra)

Tree-SHA512: 28eeca0b04001958ad86b3c802e33a13273514e9e9802d5b358fd577dc95421a2cffb5591716bea10300717f742f0941c465b9df71dbb4c66d174c643887e06f
2017-03-21 17:54:06 -07:00
Pieter Wuille
ab31a524b4
Merge #444: test: Use checked_alloc
5eb030c test: Use checked_alloc (Wladimir J. van der Laan)

Tree-SHA512: f0fada02664fca3b4f48795ce29a187331f86f80fc1605150fcfc451e7eb4671f7b5dff09105c9927e28af6d1dafd1edad1671dddd412110f4b5950153df499d
2017-03-21 17:34:05 -07:00
Emil Rus
51b77ae619 Remove executable bit from secp256k1.c 2017-03-17 17:27:25 +02:00
Wladimir J. van der Laan
5eb030ca41 test: Use checked_alloc 2017-02-26 15:05:42 +01:00
practicalswift
4c0f32ed51 Fix typo: "Agressive" → "Aggressive" 2017-01-29 18:37:29 +01:00
Andrew Poelstra
8e48aa60dc Add secp256k1_ec_pubkey_negate and secp256k1_ec_privkey_negate 2016-12-20 00:37:37 +00:00
Andrew Poelstra
2cee5fd4c9 exhaustive tests: add recovery module 2016-12-16 21:50:16 +00:00
Andrew Poelstra
678b0e5466 exhaustive tests: remove erroneous comment from ecdsa_sig_sign
Mathematically, we always overflow when using the exhaustive tests (because our
scalar order is 13 and our field order is on the order of 2^256), but the
`overflow` variable returned when parsing a b32 as a scalar is always set
to 0, to prevent infinite (or practically infinite) loops searching for
non-overflowing scalars.
2016-11-28 19:46:18 +00:00
Andrew Poelstra
03ff8c2d0a group_impl.h: remove unused secp256k1_ge_set_infinity function
Also remove `secp256k1_fe_verify` from field_*_.impl.h when VERIFY is not defined
2016-11-28 03:29:01 +00:00
Andrew Poelstra
a724d7296d configure: add --enable-coverage to set options for coverage analysis 2016-11-28 03:29:01 +00:00
Andrew Poelstra
b595163992 recovery: add tests to cover API misusage 2016-11-28 03:28:58 +00:00