Gregory Maxwell
dcf392027b
Fix ability to compile tests without -DVERIFY.
...
Broken by 3f3964e4.
It's important that the tests are also run without -DVERIFY due to
the possibility that side-effects of a VERIFY_CHECK fix a bug that
would otherwise be detected.
Use of the verify_check macro in tests isn't sufficient.
2019-05-25 21:49:45 +00:00
Tim Ruffing
238305fdbb
Move _preallocated functions to separate header
2019-05-25 14:01:09 +02:00
Tim Ruffing
814cc78d71
Add tests for contexts in preallocated memory
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
Gregory Maxwell
248bffb052
Guard memcmp in tests against mixed size inputs.
...
Reported by real-or-random.
Fixes #623 .
2019-05-25 11:54:08 +00:00
Tim Ruffing
8979ec0d9a
Pass scalar by reference in secp256k1_wnaf_const()
...
After this change, no struct or union is passed by value in the
entire codebase. This makes it easier to compile the library with
CompCert.
2019-05-14 11:43:54 +02:00
Jonas Nick
9ab96f7b12
Use trivial algorithm in ecmult_multi if scratch space is small
2019-03-18 15:15:35 +00:00
Jonas Nick
2277af5ff0
Fix integer overflow in ecmult_multi_var when n is large
2019-02-25 16:13:17 +00:00
Jonas Nick
bade617417
Add trivial ecmult_multi algorithm. It is selected when no scratch space is given and just multiplies and adds the points.
2019-02-23 20:24:28 +00:00
Gregory Maxwell
20c5869df2
Merge #516 : improvements to random seed in src/tests.c
...
be40c4d Fixup for C90 mixed declarations. (Gregory Maxwell)
8b3841c fix bug in fread() failure check (Don Viszneki)
cddef0c tests: add warning message when /dev/urandom fails (Don Viszneki)
Pull request description:
I've made two small changes to `src/tests.c` circa random seed generation.
Added a warning when `/dev/urandom` fails, mostly to defend against the case that someone should use the code verbatim, but also to enhance its illustrative power.
Also I fixed a bug with how the return value of `fread()` was being evaluated. In fact, `/dev/urandom` was never being applied before as the check on the return value of `fread()` always failed!
Tree-SHA512: 239dbe8316220c2f0e5b370bf9a18f78196e96cc4a7edea58cf2521b2c9cbc8da065be96aa859f90324d57e388d30f7670ce6bc1cca52e5162e5ca66b1a55b34
2019-02-21 11:46:13 +00:00
Gregory Maxwell
be40c4d0b5
Fixup for C90 mixed declarations.
...
Reported-by: Jonas Nick <jonasd.nick@gmail.com>
2019-02-21 05:00:29 +00: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
Andrew Poelstra
ffd3b346fe
add secp256k1_ge_set_all_gej_var
test which deals with many infinite points
2018-11-09 00:20:53 +00:00
Andrew Poelstra
47045270fa
ecmult_impl: eliminate scratch memory used when generating context
2018-11-09 00:20:51 +00:00
Andrew Poelstra
7f7a2ed3a8
ecmult_gen_impl: eliminate scratch memory used when generating context
2018-11-09 00:16:06 +00:00
Andrew Poelstra
ed7c08417a
add static context object which has no capabilities
2018-10-04 15:16:34 +00:00
Andrew Poelstra
95e99f196f
fix tests.c in the count == 0 case
2018-04-10 19:32:04 +00:00
Andrew Poelstra
6fe50439ae
scratch: add stack frame support
2018-04-05 22:49:29 +00:00
Andrew Poelstra
7c1b91ba4b
parameterize ecmult_const over input size
2018-04-05 21:05:13 +00:00
Jonas Nick
ec0a7b3ae3
Don't touch leading zeros in wnaf_fixed.
2018-03-23 14:52:13 +00:00
Don Viszneki
8b3841c91d
fix bug in fread() failure check
...
the two middle arguments to fread() are easily confused, and cause the
checking of return value to fail incorrectly (and possibly succeed
incorrectly.)
2018-03-05 18:45:00 -08:00
Don Viszneki
cddef0c0be
tests: add warning message when /dev/urandom fails
...
in case this code should ever be used as an example, a warning is a nice
way of helping ensure insecure keys are not generated
2018-03-05 18:43:31 -08:00
Jonas Nick
6dbb007869
Increase sparsity of pippenger fixed window naf representation
2018-03-01 18:20:36 +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
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
Andrew Poelstra
dba5471b69
Add ecmult_multi tests
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
Pieter Wuille
d1dc9dfc0a
Get rid of reserved _t in type names
2017-09-27 15:03:20 -07:00
Gregory Maxwell
5e95bf2285
Remove residual parts from the schnorr expirement.
2017-05-03 11:13:28 +00: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
Wladimir J. van der Laan
5eb030ca41
test: Use checked_alloc
2017-02-26 15:05:42 +01:00
Andrew Poelstra
8e48aa60dc
Add secp256k1_ec_pubkey_negate
and secp256k1_ec_privkey_negate
2016-12-20 00:37:37 +00:00
llamasoft
353c1bf0d7
Fix secp256k1_ge_set_table_gej_var parameter order
...
Rearranged secp256k1_ge_set_table_gej_var parameters so length comes last (it modifies both *a and *zr).
2016-07-26 14:24:45 -05:00
llamasoft
541b783920
Fix secp256k1_ge_set_all_gej_var parameter order
...
Rearranged secp256k1_ge_set_all_gej_var parameters so length comes after *a.
2016-07-26 14:24:42 -05:00
llamasoft
7d893f4980
Fix secp256k1_fe_inv_all_var parameter order
...
Rearranged secp256k1_fe_inv_all_var parameters so length is after array.
Text editor removed some trailing whitespaces.
2016-07-26 12:15:19 -05:00
Pieter Wuille
926836ad36
Make secp256k1_fe_sqrt constant time
2016-07-09 14:23:44 +02:00
Pieter Wuille
65285a63ee
Merge #403 : configure: add flag to disable OpenSSL tests
...
a9b2a5d configure: add flag to disable OpenSSL tests (Andrew Poelstra)
2016-07-06 12:08:16 +02:00
Andrew Poelstra
a9b2a5d850
configure: add flag to disable OpenSSL tests
...
OpenSSL messes up valgrind.
2016-07-06 08:25:33 +00:00
Pieter Wuille
e6e9805fc4
Add function for testing quadratic residue field/group elements.
2016-07-04 13:55:04 +02:00
Peter Dettman
efd953a7a7
Add Jacobi symbol test via GMP
...
Also add native Jacobi symbol test (Andrew)
Rebased-by: Andrew Poelstra
Rebased-by: Pieter Wuille
2016-07-04 13:16:35 +02:00
Andrew Poelstra
c6191fded8
ecmult_const: unify endomorphism and non-endomorphism skew cases
...
We now do a skew correction even without the endomorphism optimization,
which costs one additional group addition but unifies a lot of code.
2016-06-30 13:28:47 +00:00
Pieter Wuille
43097a44ef
Merge #390 : Update bitcoin-core GitHub links
...
faa2a11 Update bitcoin-core GitHub links (MarcoFalke)
2016-05-08 19:56:34 +02:00
Jonas Nick
093a497ac9
Add testcase which hits additional branch in secp256k1_scalar_sqr
2016-05-02 20:19:00 -07:00