Commit Graph

14330 Commits

Author SHA1 Message Date
Jack Grigg 990f77b4c0 build: Use the endomorphism optimization for secp256k1
The relevant patents have now expired:
- US7110538B2 expired 2020-09-25.
- US7995752B2 expired 2020-09-15.
2020-10-01 10:41:26 +01:00
Jack Grigg 53ba8172c8 Update src/secp256k1 subtree to upstream libsecp256k1
This migrates us to the same dependency version that upstream Bitcoin
Core migrated to in https://github.com/bitcoin/bitcoin/pull/19944.
2020-10-01 10:28:02 +01:00
Jack Grigg 2fa8a70c11 Squashed 'src/secp256k1/' changes from 6ad5cdb42..8ab24e8da
8ab24e8da Merge #558: Add schnorrsig module which implements BIP-340 compliant signatures
f3733c543 Merge #797: Fix Jacobi benchmarks and other benchmark improvements
cb5524adc Add benchmark for secp256k1_ge_set_gej_var
5c6af60ec Make jacobi benchmarks vary inputs
d0fdd5f00 Randomize the Z coordinates in bench_internal
c7a3424c5 Rename bench_internal variables
875d68b95 Merge #699: Initialize field elements when resulting in infinity
54caf2e74 Merge #799: Add fallback LE/BE for architectures with known endianness + SHA256 selftest
f431b3f28 valgrind_ctime_test: Add schnorrsig_sign
16ffa9d97 schnorrsig: Add taproot test case
8dfd53ee3 schnorrsig: Add benchmark for sign and verify
4e4352002 schnorrsig: Add BIP-340 compatible signing and verification
7332d2db6 schnorrsig: Add BIP-340 nonce function
7a703fd97 schnorrsig: Init empty experimental module
eabd9bc46 Allow initializing tagged sha256
6fcb5b845 extrakeys: Add keypair_xonly_tweak_add
58254463f extrakeys: Add keypair struct with create, pub and pub_xonly
f0010349b Separate helper functions for pubkey_create and seckey_tweak_add
910d9c284 extrakeys: Add xonly_pubkey_tweak_add & xonly_pubkey_tweak_add_test
176bfb111 Separate helper function for ec_pubkey_tweak_add
4cd2ee474 extrakeys: Add xonly_pubkey with serialize, parse and from_pubkey
f49c9896b Merge #806: Trivial: Add test logs to gitignore
aabf00c15 Merge #648: Prevent ints from wrapping around in scratch space functions
f5adab16a Merge #805: Remove the extremely outdated TODO file.
bceefd654 Add test logs to gitignore
1c325199d Remove the extremely outdated TODO file.
47e6618e1 extrakeys: Init empty experimental module
3e08b02e2 Make the secp256k1_declassify argument constant
8bc6aeffa Add SHA256 selftest
670cdd3f8 Merge #798: Check assumptions on integer implementation at compile time
5e5fb28b4 Use additional system macros to figure out endianness
7c068998b Compile-time check assumptions on integer types
02b6c87b5 Add support for (signed) __int128
979961c50 Merge #787: Use preprocessor macros instead of autoconf to detect endianness
887bd1f8b Merge #793: Make scalar/field choice depend on C-detected __int128 availability
0dccf98a2 Use preprocessor macros instead of autoconf to detect endianness
b2c8c42cf Merge #795: Avoid linking libcrypto in the valgrind ct test.
57d3a3c64 Avoid linking libcrypto in the valgrind ct test.
79f1f7a4f Autodetect __int128 availability on the C side
0d7727f95 Add SECP256K1_FE_STORAGE_CONST_GET to 5x52 field
805082de1 Merge #696: Run a Travis test on s390x (big endian)
39295362c Test travis s390x (big endian)
6034a04fb Merge #778: secp256k1_gej_double_nonzero supports infinity
f60915906 Merge #779: travis: Fix argument quoting for ./configure
9e49a9b25 travis: Fix argument quoting for ./configure
18d36327f secp256k1_gej_double_nonzero supports infinity
214cb3c32 Merge #772: Improve constant-timeness on PowerPC
40412b193 Merge #774: tests: Abort if malloc() fails during context cloning tests
2e1b9e045 tests: Abort if malloc() fails during context cloning tests
67a429f31 Suppress a harmless variable-time optimization by clang in _int_cmov
5b196338f Remove redundant "? 1 : 0" after comparisons in scalar code
3e5cfc5c7 Merge #741: Remove unnecessary sign variable from wnaf_const
66bb9320c Merge #773: Fix some compile problems on weird/old compilers.
1309c03c4 Fix some compile problems on weird/old compilers.
2309c7dd4 Merge #769: Undef HAVE___INT128 in basic-config.h to fix gen_context compilation
22e578bb1 Undef HAVE___INT128 in basic-config.h to fix gen_context compilation
3f4a5a10e Merge #765: remove dead store in ecdsa_signature_parse_der_lax
f00d6575c remove dead store in ecdsa_signature_parse_der_lax
dbd41db16 Merge #759: Fix uninitialized variables in ecmult_multi test
2e7fc5b53 Fix uninitialized variables in ecmult_multi test
2ed54da18 Merge #755: Recovery signing: add to constant time test, and eliminate non ct operators
28609507e Add tests for the cmov implementations
73596a85a Add ecdsa_sign_recoverable to the ctime tests
2876af4f8 Split ecdsa_sign logic into a new function and use it from ecdsa_sign and recovery
5e1c885ef Merge #754: Fix uninit values passed into cmov
f79a7adcf Add valgrind uninit check to cmovs output
05d315aff Merge #752: autoconf: Use ":" instead of "dnl" as a noop
a39c2b09d Fixed UB(arithmetics on uninit values) in cmovs
3a6fd7f63 Merge #750: Add macOS to the CI
5e8747ae2 autoconf: Use ":" instead of "dnl" as a noop
71757da5c Explictly pass SECP256K1_BENCH_ITERS to the benchmarks in travis.sh
99bd661d7 Replace travis_wait with a loop printing "\a" to stdout every minute
bc818b160 Bump travis Ubuntu from xenial(16.04) to bionic(18.04)
0c5ff9066 Add macOS support to travis
b6807d91d Move travis script into a standalone sh file
f39f99be0 Merge #701: Make ec_ arithmetic more consistent and add documentation
37dba329c Remove unnecessary sign variable from wnaf_const
6bb0b77e1 Fix test_constant_wnaf for -1 and add a test for it.
39198a03e Merge #732: Retry if r is zero during signing
59a8de8f6 Merge #742: Fix typo in ecmult_const_impl.h
4e284655d Fix typo in ecmult_const_impl.h
f862b4ca1 Merge #740: Make recovery/main_impl.h non-executable
ffef45c98 Make recovery/main_impl.h non-executable
2361b3719 Merge #735: build: fix OpenSSL EC detection on macOS
3b7d26b23 build: add SECP_TEST_INCLUDES to bench_verify CPPFLAGS
84b5fc5bc build: fix OpenSSL EC detection on macOS
37ed51a7e Make ecdsa_sig_sign constant-time again after reverting 25e3cfb
93d343bfc Revert "ecdsa_impl: replace scalar if-checks with VERIFY_CHECKs in ecdsa_sig_sign"
7e3952ae8 Clarify documentation of tweak functions.
89853a0f2 Make tweak function documentation more consistent.
41fc78560 Make ec_privkey functions aliases for ec_seckey_negate, ec_seckey_tweak_add and ec_seckey_mul
22911ee6d Rename private key to secret key in public API (with the exception of function names)
5a73f14d6 Mention that value is unspecified for In/Out parameters if the function returns 0
f03df0e6d Define valid ECDSA keys in the documentation of seckey_verify
5894e1f1d Return 0 if the given seckey is invalid in privkey_negate, privkey_tweak_add and privkey_tweak_mul
8f814cddb Add test for boundary conditions of scalar_set_b32 with respect to overflows
3fec98260 Use scalar_set_b32_seckey in ecdsa_sign, pubkey_create and seckey_verify
9ab2cbe0e Add scalar_set_b32_seckey which does the same as scalar_set_b32 and also returns whether it's a valid secret key
4f27e344c Merge #728: Suppress a harmless variable-time optimization by clang in memczero
01993878b Add test for memczero()
52a03512c Suppress a harmless variable-time optimization by clang in memczero
8f78e208a Merge #722: Context isn't freed in the ECDH benchmark
ed1b91171 Merge #700: Allow overriding default flags
85b35afa7 Add running benchmarks regularly and under valgrind in travis
ca4906b02 Pass num of iters to benchmarks as variable, and define envvar
02dd5f1bb free the ctx at the end of bench_ecdh
e9fccd4de Merge #708: Constant-time behaviour test using valgrind memtest.
08fb6c492 Run valgrind_ctime_test in travis
3d2302257 Constant-time behaviour test using valgrind memtest.
96d8ccbd1 Merge #710: Eliminate harmless non-constant time operations on secret data.
0585b8b2e Merge #718: Clarify that a secp256k1_ecdh_hash_function must return 0 or 1
7b50483ad Adds a declassify operation to aid constant-time analysis.
34a67c773 Eliminate harmless non-constant time operations on secret data.
ca739cba2 Compile with optimization flag -O2 by default instead of -O3
eb45ef338 Clarify that a secp256k1_ecdh_hash_function must return 0 or 1
856a01d6a Merge #714: doc: document the length requirements of output parameter.
d72b9e248 Merge #682: Remove Java Native Interface
4b48a4310 doc: document the length requirements of output parameter.
1b4d256e2 Merge #713: Docstrings
dabfea7e2 field: extend docstring of secp256k1_fe_normalize
dc7d8fd9e scalar: extend docstring of secp256k1_scalar_set_b32
074ab582d Merge #704: README: add a section for test coverage
acb7f97eb README: add a section for test coverage
227a4f2d0 Merge #709: Remove secret-dependant non-constant time operation in ecmult_const.
d567b779f Clarify comments about use of rzr on ge functions and abs function.
2241ae6d1 Remove secret-dependant non-constant time operation in ecmult_const.
642cd062b Remove Java Native Interface
83fb1bcef Remove -O2 from default CFLAGS because this would override the -O3 flag (see AC_PROG_CC in the Autoconf manual)
ecba8138e Append instead of Prepend user-CFLAGS to default CFLAGS allowing the user to override default variables
613c34cd8 Remove test in configure.ac because it doesn't have an effect
f45d89710 Merge #703: Overhaul README.md
2e759ec75 Overhaul README.md
d644dda5c Merge #689: Remove "except in benchmarks" exception for fp math
bde2a3228 Convert bench.h to fixed-point math
47a7b8382 Clear field elements when writing infinity
61d1ecb02 Added test with additions resulting in infinity
387d723c3 Merge #679: Add SECURITY.md
0db61d25c Merge #685: Fix issue where travis does not show the ./tests seed…
a0771d15e Explicitly disable buffering for stderr in tests
fb424fbba Make travis show the ./tests seed by removing stdout buffering and always cat tests.log after a travis run.
22a603118 Merge #690: Add valgrind check to travis
544002c00 Merge #678: Preventing compiler optimizations in benchmarks without a memory fence
dd98cc988 travis: Added a valgrind test without endro and enabled recovery+ecdh
b4c1382a8 Add valgrind check to travis
0c774d89e Merge #688: Fix ASM setting in travis
5c5f71eea Fix ASM setting in travis
e2625f8a9 Merge #684: Make no-float policy explicit
bae1bea3c Make no-float policy explicit
78c383634 Add SECURITY.md
362bb2560 Modified bench_scalar_split so it won't get optimized out
73a30c6b5 Added accumulators and checks on benchmarks so they won't get optimized out
770b3dcd6 Merge #677: Remove note about heap allocation in secp256k1_ecmult_odd_multiples_table_storage_var
b76142ff2 Remove note about heap allocation in secp256k1_ecmult_odd_multiples_table_storage_var which was removed in 47045270fa90f81205d989f7107769bce1e71c4d
137d304a6 Merge #647: Increase robustness against UB in secp256k1_scalar_cadd_bit
0d9540b13 Merge #664: Remove mention of ec_privkey_export because it doesn't exist
59782c68b Remove mention of ec_privkey_export because it doesn't exist
96cd94e38 Merge #337: variable sized precomputed table for signing
dcb2e3b3f variable signing precompute table
b4bff9902 Merge #661: Make ./configure string consistent
a467047e1 Make ./configure string consistent
e729cc7f5 Merge #657: Fix a nit in the recovery tests
b64a2e259 Fix a nit in the recovery tests
e028aa33d Merge #650: secp256k1/src/tests.c:  Properly handle sscanf return value
f1e11d363 Merge #654: Fix typo (∞)
ef83281c3 Merge pull request #656 from real-or-random/patch-1
556caad2c Fix typo in docs for _context_set_illegal_callback
0d82732a9 Improve VERIFY_CHECK of overflow in secp256k1_scalar_cadd_bit. This added check ensures that any curve order overflow doesn't go undetected due a uint32_t overflow.
786dfb49f Merge #583: JNI: fix use sig array
e95f8ab09 Merge #644: Avoid optimizing out a verify_check
384f55606 Merge #652: README.md: update instruction to run tests
ee56accd4 Merge #651: Fix typo in secp256k1_preallocated.h
7b9b11723 Merge #640: scalar_impl.h: fix includes
d99bec2e2 Merge #655: jni: Use only Guava for hex encoding and decoding
2abcf951a jni: Use only Guava for hex encoding and decoding
271582b3b Fix typo
60f7f2de5 Don't assume that ALIGNMENT > 1 in tests
ada6361de Use ROUND_TO_ALIGN in scratch_create
8ecc6ce50 Add check preventing rounding to alignment from wrapping around in scratch_alloc
4edaf06fb Add check preventing integer multiplication wrapping around in scratch_max_allocation
ce6d43826 README.md: update instruction to run tests
b1e68cb8e Fix typo in secp256k1_preallocated.h
a11c76c59 secp256k1/src/tests.c:  Properly handle sscanf return value
8fe63e565 Increase robustness against UB. Thanks to elichai2 who noted that the literal '1' is a signed integer, and that shifting a signed 32-bit integer by 31 bits causes an overflow and yields undefined behaviour. While 'scalar_low_impl''s 'secp256k1_scalar_cadd_bit' is only used for testing purposes and currently the 'bit' parameter is only 0 or 1, it is better to avoid undefined behaviour in case the used domain of 'secp256k1_scalar_cadd_bit' expands.
94ae7cbf8 Moved a dereference so the null check will be before the dereferencing
2cb73b106 scalar_impl.h: fix includes
fa3301713 Merge #634: Add a descriptive comment for secp256k1_ecmult_const.
ee9e68cd3 Add a descriptive comment for secp256k1_ecmult_const.
d0d738d32 Merge #631: typo in comment for secp256k1_ec_pubkey_tweak_mul ()
6914c2527 typo in comment for secp256k1_ec_pubkey_tweak_mul ()
e541a90ef Merge #629: Avoid calling _is_zero when _set_b32 fails.
f34b0c3f3 Merge #630: Note intention of timing sidechannel freeness.
8d1563b0f Note intention of timing sidechannel freeness.
1669bb286 Merge #628: Fix ability to compile tests without -DVERIFY.
ecc94abcc Merge #627: Guard memcmp in tests against mixed size inputs.
544435fc9 Merge #578: Avoid implementation-defined and undefined behavior when dealing with sizes
143dc6e9e Merge #595: Allow to use external default callbacks
e49f7991c Add missing #(un)defines to base-config.h
77defd2c3 Add secp256k1_ prefix to default callback functions
908bdce64 Include stdio.h and stdlib.h explicitly in secp256k1.c
5db782e65 Allow usage of external default callbacks
6095a863f Replace CHECKs for no_precomp ctx by ARG_CHECKs without a return
cd473e02c Avoid calling secp256k1_*_is_zero when secp256k1_*_set_b32 fails.
6c36de7a3 Merge #600: scratch space: use single allocation
98836b11f scratch: replace frames with "checkpoint" system
7623cf2b9 scratch: save a couple bytes of unnecessarily-allocated memory
a7a164f2c scratch: rename `max_size` to `size`, document that extra will actually be allocated
5a4bc0bb9 scratch: unify allocations
c2b028a28 scratch space: thread `error_callback` into all scratch space functions
0be1a4ae6 scratch: add magic bytes to beginning of structure
92a48a764 scratch space: use single allocation
40839e21b Merge #592: Use trivial algorithm in ecmult_multi if scratch space is small
dcf392027 Fix ability to compile tests without -DVERIFY.
a484e0008 Merge #566: Enable context creation in preallocated memory
0522caac8 Explain caller's obligations for preallocated memory
238305fdb Move _preallocated functions to separate header
695feb6fb Export _preallocated functions
814cc78d7 Add tests for contexts in preallocated memory
ba12dd08d Check arguments of _preallocated functions
5feadde46 Support cloning a context into preallocated memory
c4fd5dab4 Switch to a single malloc call
ef020de16 Add size constants for preallocated memory
1bf7c056b Prepare for manual memory management in preallocated memory
248bffb05 Guard memcmp in tests against mixed size inputs.
36698dcfe Merge #596: Make WINDOW_G configurable
a61a93ff5 Clean up ./configure help strings
2842dc523 Make WINDOW_G configurable
1a02d6ce5 Merge #626: Revert "Merge #620: Install headers automatically"
662918cb2 Revert "Merge #620: Install headers automatically"
14c7dbd44 Simplify control flow in DER parsing
ec8f20bab Avoid out-of-bound pointers and integer overflows in size comparisons
01ee1b3b3 Parse DER-enconded length into a size_t instead of an int
912680ed8 Merge #561: Respect LDFLAGS and #undef STATIC_PRECOMPUTATION if using basic config
91fae3ace Merge #620: Install headers automatically
5df77a0ed Merge #533: Make sure we're not using an uninitialized variable in secp256k1_wnaf_const(...)
975e51e0d Merge #617: Pass scalar by reference in secp256k1_wnaf_const()
735fbde04 Merge #619: Clear a copied secret key after negation
16e86150d Install headers automatically
069870d92 Clear a copied secret key after negation
8979ec0d9 Pass scalar by reference in secp256k1_wnaf_const()
84a808598 Merge #612: Allow field_10x26_arm.s to compile for ARMv7 architecture
d4d270a59 Allow field_10x26_arm.s to compile for ARMv7 architecture
b19c00006 Merge #607: Use size_t shifts when computing a size_t
4d01bc2d9 Merge #606: travis: Remove unused sudo:false
e6d01e934 Use size_t shifts when computing a size_t
7667532bd travis: Remove unused sudo:false
248f04661 Make sure we're not using an uninitialized variable in secp256k1_wnaf_const(...)
9ab96f7b1 Use trivial algorithm in ecmult_multi if scratch space is small
ee99f12f3 Merge #599: Switch x86_64 asm to use "i" instead of "n" for immediate values.
d58bc93f2 Switch x86_64 asm to use "i" instead of "n" for immediate values.
05362ee04 Merge #597: Add $(COMMON_LIB) to exhaustive tests to fix ARM asm build
83483869a Add $(COMMON_LIB) to exhaustive tests to fix ARM asm build
aa15154a4 Merge #568: Fix integer overflow in ecmult_multi_var when n is large
2277af5ff Fix integer overflow in ecmult_multi_var when n is large
dbed75d96 Undefine `STATIC_PRECOMPUTATION` if using the basic config
310111e09 Keep LDFLAGS if `--coverage`
85d0e1bcc Merge #591: Make bench_internal obey secp256k1_fe_sqrt's contract wrt aliasing.
14196379e Merge #580: Add trivial ecmult_multi algorithm which does not require a scratch space
a697d82da Add trivial ecmult_multi to the benchmark tool
bade61741 Add trivial ecmult_multi algorithm. It is selected when no scratch space is given and just multiplies and adds the points.
5545e13de Merge #584: configure: Use CFLAGS_FOR_BUILD when checking native compiler
20c5869df Merge #516: improvements to random seed in src/tests.c
b76e45d5d Make bench_internal obey secp256k1_fe_sqrt's contract wrt aliasing.
870a97764 Merge #562: Make use of TAG_PUBKEY constants in secp256k1_eckey_pubkey_parse
be40c4d0b Fixup for C90 mixed declarations.
c71dd2c08 Merge #509: Fix algorithm selection in bench_ecmult
6492bf88c Merge #518: Summarize build options after running configure
0e9ada194 Merge #567: Correct order of libs returned on pkg-config --libs --static libsecp2…
e96901a4b Merge #587: Make randomization of a non-signing context a noop
58df8d03a Merge #511: Portability fix for the configure scripts generated
2ebdad772 Merge #552: Make constants static:
1c131affd Merge #551: secp256k1_fe_sqrt: Verify that the arguments don't alias.
ba698f883 Merge #539: Assorted minor corrections
949e85b00 Merge #550: Optimize secp256k1_fe_normalize_weak calls.
a34bcaadf Actually pass CFLAGS_FOR_BUILD and LDFLAGS_FOR_BUILD to linker
2d5f4cebd configure: Use CFLAGS_FOR_BUILD when checking native compiler
b408c6a8b Merge #579: Use __GNUC_PREREQ for detecting __builtin_expect
619837521 Make randomization of a non-signing context a noop
74e2dbd68 JNI: fix use sig array
c663397f4 Use __GNUC_PREREQ for detecting __builtin_expect
3cb057f84 Fix possible integer overflow in DER parsing
e34ceb333 Merge #557: Eliminate scratch memory used when generating contexts
b3bf5f99a ecmult_impl: expand comment to explain how effective affine interacts with everything
efa783f8f Store z-ratios in the 'x' coord they'll recover
ffd3b346f add `secp256k1_ge_set_all_gej_var` test which deals with many infinite points
84740acd2 ecmult_impl: save one fe_inv_var
47045270f ecmult_impl: eliminate scratch memory used when generating context
7f7a2ed3a ecmult_gen_impl: eliminate scratch memory used when generating context
314a61d72 Merge #553: add static context object which has no capabilities
89a20a894 Correct order of libs returned on pkg-config --libs --static libsecp256k1 call.
1086fda4c Merge #354: [ECDH API change] Support custom hash function
d3cb1f95e Make use of TAG_PUBKEY constants in secp256k1_eckey_pubkey_parse
40fde611b prevent attempts to modify `secp256k1_context_no_precomp`
ed7c08417 add static context object which has no capabilities
496c5b43b Make constants static: static const secp256k1_ge secp256k1_ge_const_g; static const int CURVE_B;
bf8b86cc0 secp256k1_fe_sqrt: Verify that the arguments don't alias.
9bd89c836 Optimize secp256k1_fe_normalize_weak calls. Move secp256k1_fe_normalize_weak calls out of ECMULT_TABLE_GET_GE and ECMULT_TABLE_GET_GE_STORAGE and into secp256k1_ge_globalz_set_table_gej instead.
52ab96fed clean dependendies in field_*_impl.h
deff5edd4 Correct math typos in field_*.h
4efb3f8dd Add check that restrict pointers don't alias with all parameters.
1e6f1f5ad Merge #529: fix tests.c in the count == 0 case
c8fbc3c39 [ECDH API change] Allow pass arbitrary data to hash function
b00be6505 [ECDH API change] Support custom hash function
95e99f196 fix tests.c in the count == 0 case
452d8e4d2 Merge #523: scratch: add stack frame support
6fe50439a scratch: add stack frame support
9bc2e2650 Merge #522: parameterize ecmult_const over input size
7c1b91ba4 parameterize ecmult_const over input size
dbc3ddd5e Merge #513: Increase sparsity of pippenger fixed window naf representation
3965027c8 Summarize build options in configure script
0f0517369 Fix algorithm selection in bench_ecmult
fb9271dcf Merge #510: add a couple missing `const`s to ecmult_pippenger_wnaf
cd5f6028e Merge #515: Fix typo
09146ae85 Merge #512: secp256k1_ec_privkey_negate - fix documentation
ec0a7b3ae Don't touch leading zeros in wnaf_fixed.
9e36d1bfe Fix bug in wnaf_fixed where the wnaf array is not completely zeroed when given a 0 scalar.
96f68a0af Don't invert scalar in wnaf_fixed when it is even because a caller might intentionally give a scalar with many leading zeros.
8b3841c91 fix bug in fread() failure check
cddef0c0b tests: add warning message when /dev/urandom fails
9b7c47a21 Fix typo
6dbb00786 Increase sparsity of pippenger fixed window naf representation
1646ace4d secp256k1_ec_privkey_negate - fix documentation
270f6c80d Portability fix for the configure scripts generated
9b3ff0309 add a couple missing `const`s to ecmult_pippenger_wnaf
cd329dbc3 Merge #460: [build] Update ax_jni_include_dir.m4 macro
7f9c1a156 Merge #498: tests: Avoid calling fclose(...) with an invalid argument
f99aa8d4d Merge #499: tests: Make sure we get the requested number of bytes from /dev/urandom
b549d3d5f Merge #472: [build] Set --enable-jni to no by default instead of auto.
d33352151 Merge #494: Support OpenSSL versions >= 1.1 for ENABLE_OPENSSL_TESTS
2ef8ea5d2 Merge #495: Add bench_ecmult to .gitignore
82a96e458 tests: Make sure we get the requested number of bytes from /dev/urandom
5aae5b5bb Avoid calling fclose(...) with an invalid argument
cb32940df Add bench_ecmult to .gitignore
31abd3ab8 Support OpenSSL versions >= 1.1 for ENABLE_OPENSSL_TESTS
c95f6f136 Merge #487: fix tests typo, s/changed/unchanged
fb46c8388 Merge #463: Reduce usage of hardcoded size constants
02f5001df Merge #490: Disambiguate bench functions and types
1f46d6089 Disambiguate bench functions and types
f54c6c508 Merge #480: Enable benchmark building by default
c77fc0859 Merge #486: Add pippenger_wnaf for multi-multiplication
d2f9c6b5d Use more precise pippenger bucket windows
4c950bbea Save some additions per window in _pippenger_wnaf
a58f543f5 Add flags for choosing algorithm in ecmult_multi benchmark
36b22c933 Use scratch space dependent batching in ecmult_multi
355a38f11 Add pippenger_wnaf ecmult_multi
bc65aa794 Add bench_ecmult
dba5471b6 Add ecmult_multi tests
8c1c831bd Generalize Strauss to support multiple points
548de42ec add resizeable scratch space API
0e96cdc6b fix typo, s/changed/unchanged
c7680e570 Reduce usage of hardcoded size constants
7a78f6059 Print whether we're building benchmarks
4afec9f1a Build benchmarks by default
57752d28b [build] Set --enable-jni to no by default instead of auto.
e7daa9b3c [build] Tweak JNI macro to warn instead of error for JNI not found.
5b2297792 [build] Update ax_jni_include_dir.m4 macro to deal with recent versions of macOS

git-subtree-dir: src/secp256k1
git-subtree-split: 8ab24e8dad9d43fc6661842149899e3cc9213b24
2020-10-01 10:27:05 +01:00
Jack Grigg be7876adbb build: Remove a stray -lcrypto
zcash/zcash#4740 removed OpenSSL from our depends system, so we were
not satisfying this linker flag intentionally. Configurations where a
target OpenSSL could not be found by the linker, such as cross-compiles
and native macOS builds, were therefore failing. However, OpenSSL is
likely available in the system for all the "supported builders" (which
are all Linux-based), so the linker was likely being satisfied by that
library, enabling the previous PR to be merged.
2020-10-01 09:59:02 +01:00
Homu b5fa52b701 Auto merge of #4740 - str4d:remove-openssl, r=daira
Remove OpenSSL

Includes changes cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7095
- bitcoin/bitcoin#11024
- bitcoin/bitcoin#17165
  - Only the commit removing SSL lib detection (we have long since removed the rest).
- bitcoin/bitcoin#17265
  - We had already migrated away from OpenSSL for randomness.
- bitcoin/bitcoin#17515
  - Only the second commit.

Closes #145.
2020-10-01 00:34:47 +00:00
Daira Hopwood ce0654e13a Cosmetics in CScriptNum code and tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-01 00:34:31 +01:00
Daira Hopwood 932d627753 It's unnecessary to pass int64_t by const reference.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-01 00:34:31 +01:00
Daira Hopwood f432fe5ebf Add assertions for CScriptNum[10] +/- int64_t to avoid the possibility of UB.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-01 00:34:31 +01:00
Daira Hopwood 9ba10a8071 Avoid undefined behaviour in scriptnum tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-01 00:34:31 +01:00
Cory Fields 860e6e600c httpserver: replace boost threads with std
along with mutex/condvar/bind/etc.

httpserver handles its own interruption, so there's no reason not to use std
threading.

While we're at it, may as well kill the BOOST_FOREACH's as well.
2020-09-30 12:48:35 +01:00
Cory Fields 97194f2abc httpserver: use a future rather than relying on boost's try_join_for 2020-09-30 12:48:35 +01:00
Wladimir J. van der Laan 26efd3aaf9 http: use std::move to move HTTPRequest into HTTPWorkItem
Thanks to Cory Fields for the idea.
2020-09-30 12:48:35 +01:00
Wladimir J. van der Laan a500df5561 http: Change boost::scoped_ptr to std::unique_ptr in HTTPRequest
No need for boost here.
2020-09-30 12:48:35 +01:00
Wladimir J. van der Laan 1f106fa803 http: Add log message when work queue is full
More useful error reporting.
2020-09-30 12:48:35 +01:00
Wladimir J. van der Laan fc9ce9e766 http: Do a pending c++11 simplification
Use std::unique_ptr for handling work items.

This makes the code more RAII and, as mentioned in the comment, is what
I planned when I wrote the code in the first place.
2020-09-30 12:48:35 +01:00
Daira Hopwood b165ead16a Minor additional OpenSSL scouring.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-09-30 10:44:42 +01:00
Jack Grigg bab853748e QA: Remove OpenSSL from updatecheck.py 2020-09-30 00:40:12 +01:00
Jack Grigg ab35a260d5 Remove remaining OpenSSL references 2020-09-30 00:40:12 +01:00
Jack Grigg ce1b5491db util: Remove OpenSSL multithreading infrastructure 2020-09-30 00:40:12 +01:00
Wladimir J. van der Laan fe49dc5282 build: remove libcrypto as internal dependency in libbitcoinconsensus.pc 2020-09-30 00:40:12 +01:00
fanquake 4526ecf9b2 doc: remove OpenSSL from build instructions and licensing info 2020-09-30 00:40:12 +01:00
fanquake f477932d38 depends: remove OpenSSL package 2020-09-30 00:40:12 +01:00
fanquake 0ad49bca44 build: remove OpenSSL detection and libs 2020-09-30 00:40:12 +01:00
fanquake 8993f1f708 build: remove SSL lib detection 2020-09-30 00:40:12 +01:00
practicalswift c28c9b96a1 tests: Remove OldSetKeyFromPassphrase/OldEncrypt/OldDecrypt 2020-09-30 00:40:12 +01:00
Wladimir J. van der Laan 7b3cb48232 Replace scriptnum_test's normative ScriptNum implementation
Compare against the scriptnum from Bitcoin Core 0.10 instead of OpenSSL.
Closes #7086.
2020-09-30 00:40:12 +01:00
Jonas Schnelli 220e166e47 Move uiInterface.NotifyBlockTip signal above the core/wallet signal
- This will keep getbestblockhash more in sync with blocknotify callbacks
2020-09-30 00:35:32 +01:00
Jonas Schnelli 66515b0628 NotifyBlockTip signal: switch from hash (uint256) to CBlockIndex*
- also adds a boolean for indication if the tip update was happening during initial sync
- emit notification also during initial sync
2020-09-30 00:35:32 +01:00
Wladimir J. van der Laan 23556e690e http: Restrict maximum size of request line + headers
Prevent memory exhaustion by sending lots of data.
Also add a test to `httpbasics.py`.

Closes #6425
2020-09-30 00:35:32 +01:00
Homu 7d94064616 Auto merge of #4643 - str4d:locked-memory-manager, r=str4d
Locked memory manager

Add a pool for locked memory chunks, replacing `LockedPageManager`.

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#8321
- bitcoin/bitcoin#8753
- bitcoin/bitcoin#9063
- bitcoin/bitcoin#9070
- bitcoin/bitcoin#11385
- bitcoin/bitcoin#12048
  - Excludes change to benchmark.
- bitcoin/bitcoin#15117
- bitcoin/bitcoin#16161
  - Excludes Travis CI changes.
  - Includes change from bitcoin/bitcoin#13163
- bitcoin/bitcoin#15600
- bitcoin/bitcoin#18443
- Assorted small changes from:
  - bitcoin/bitcoin#9233
  - bitcoin/bitcoin#10483
  - bitcoin/bitcoin#10645
  - bitcoin/bitcoin#10969
  - bitcoin/bitcoin#11351
- bitcoin/bitcoin#19111
  - Excludes change to `src/rpc/server.cpp`
- bitcoin/bitcoin#9804
  - Only the commit for `src/key.cpp`
- bitcoin/bitcoin#9598
2020-09-29 22:18:48 +00:00
Homu 9245388bbc Auto merge of #4749 - str4d:update-config-guess-and-sub, r=str4d
depends: Update to latest config.guess & config.sub
2020-09-29 02:17:39 +00:00
Homu 94cf4a4946 Auto merge of #4558 - linuxion:master, r=str4d
[RPC] Add transaction size to JSON output

Cherry-picked from upstream PR https://github.com/bitcoin/bitcoin/pull/7072.
2020-09-28 22:40:09 +00:00
Nick abcce56fe1 [RPC] Add transaction size to JSON output
This may be useful for blockchain explorers.
2020-09-28 23:12:21 +01:00
Jack Grigg f43e3833f3 gitian: Switch from x86_64-unknown-linux-gnu to x86_64-linux-gnu
This will work regardless of how config.sub behaves, and matches what
upstream currently uses.
2020-09-28 21:36:46 +01:00
Jack Grigg bd87bcf1b4 build: Switch to x86_64-pc-linux-gnu for codecov filtering 2020-09-28 21:36:02 +01:00
Jack Grigg f52793d0d0 QA: Switch to x86_64-pc-linux-gnu for hard-coded Linux HOST
The change to config.guess for x86_64:Linux was made here:
    http://git.savannah.gnu.org/cgit/config.git/commit/?id=ca9bfb8cc75a2be1819d89c664a867785c96c9ba
2020-09-28 21:28:43 +01:00
Jack Grigg 9384b78c0f depends: Update map of GCC canonical hosts to Rust targets
The updated files now output x86_64-pc-linux-gnu on some platforms where
they previously output x86_64-unknown-linux-gnu.
2020-09-28 18:20:47 +01:00
Jack Grigg 55acaf4bc5 allocators: Apply Allocator named requirements to secure_allocator::deallocate
The named requirements for Allocator are here:
    https://en.cppreference.com/w/cpp/named_req/Allocator

It gives the following requirements for `a.deallocate(p, n)`:

> Deallocates storage pointed to `p`, which must be a value returned by
> a previous call to `allocate` that has not been invalidated by an
> intervening call to `deallocate`. `n` must match the value previously
> passed to `allocate`. Does not throw exceptions.

This explicitly excludes both calling `secure_allocator::deallocate` on
`nullptr`, and throwing exceptions of any kind. We address the former by
asserting that `p != nullptr` (because `LockedPool::free` does support
`nullptr`), and we address the latter by adding the `noexcept` keyword
(which the example C++11 allocator on the page above also uses).
2020-09-28 16:22:43 +01:00
Jack Grigg 66ac442da8 LockedPool: Make Arena::free and LockedPool::free noexcept
Attempting to free a detectably invalid pointer should terminate, as
this would be a programming error.
2020-09-28 16:20:06 +01:00
Jack Grigg fa6921c480 LockedPool: Fix LockedPool::free(nullptr) to be a no-op
It was documented as such, but nullptr is never an address within an
Arena, so it would fall through and trigger the std::runtime_error.
2020-09-28 15:46:00 +01:00
str4d b2b5cccf39
test: Fix LFSR period in comments
Verified using a Python implementation.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-09-26 00:56:20 +01:00
str4d b5ddac4b71
LockedPool: Switch to HTTPS URLs in licenses and comments
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-09-26 00:30:45 +01:00
Homu 514d868179 Auto merge of #4739 - str4d:update-leveldb, r=str4d
Update LevelDB to upstream commit f545dfabf

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7911
- bitcoin/bitcoin#7982
- bitcoin/bitcoin#8133
- bitcoin/bitcoin#8784
  - Only the missing changes.
- bitcoin/bitcoin#8826
- bitcoin/bitcoin#8613
- bitcoin/bitcoin#10544
- bitcoin/bitcoin#10633
  - Only the changes to files and code we have.
- bitcoin/bitcoin#10806
- bitcoin/bitcoin#10958
- bitcoin/bitcoin#12451
- bitcoin/bitcoin#13925
- bitcoin/bitcoin#15270

This upgrades LevelDB in the exact same commit progression as upstream, up to January 2019.
2020-09-25 16:16:37 +00:00
str4d f4c78c45b5
leveldb: Fix typo
Co-authored-by: Dimitris Apostolou <dimitris.apostolou@icloud.com>
2020-09-25 16:02:52 +01:00
str4d e2eeabe9e0
Update license headers
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-09-25 16:02:25 +01:00
Jack Grigg f5582677a6 leveldb: Assert that ssize_t is the same size as size_t on Windows
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-09-25 15:59:05 +01:00
Jack Grigg 3d79da1beb build: out-of-tree fixups
Accidentally excluded from 9cc7497692 when
backporting upstream commit 0cb0f2626e1553426e16a52fc6928d35824827f5.
2020-09-25 15:39:08 +01:00
practicalswift a3fbfe4efc Improve readability by removing redundant casts to same type (on all platforms) 2020-09-25 14:56:20 +01:00
Jeremy Rubin 94f7ae6ce8 Fix subscript[0] potential bugs in key.cpp 2020-09-25 14:54:17 +01:00
Homu e886263547 Auto merge of #4748 - rex4539:fix-typos, r=daira
Fix typos
2020-09-25 13:42:27 +00:00